Use $(RM) in Makefiles instead of 'rm -f'

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Emil Medve 2007-07-14 12:51:44 -05:00 committed by Junio C Hamano
parent 3f2fd36ebc
commit 4cb08df553
5 changed files with 48 additions and 43 deletions

View File

@ -41,6 +41,7 @@ ifdef ASCIIDOC8
ASCIIDOC_EXTRA += -a asciidoc7compatible ASCIIDOC_EXTRA += -a asciidoc7compatible
endif endif
INSTALL?=install INSTALL?=install
RM ?= rm -f
DOC_REF = origin/man DOC_REF = origin/man
-include ../config.mak.autogen -include ../config.mak.autogen
@ -84,7 +85,7 @@ install: man
# Determine "include::" file references in asciidoc files. # Determine "include::" file references in asciidoc files.
# #
doc.dep : $(wildcard *.txt) build-docdep.perl doc.dep : $(wildcard *.txt) build-docdep.perl
rm -f $@+ $@ $(RM) $@+ $@
perl ./build-docdep.perl >$@+ perl ./build-docdep.perl >$@+
mv $@+ $@ mv $@+ $@
@ -109,11 +110,11 @@ cmd-list.made: cmd-list.perl $(MAN1_TXT)
git.7 git.html: git.txt core-intro.txt git.7 git.html: git.txt core-intro.txt
clean: clean:
rm -f *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep
rm -f $(cmds_txt) *.made $(RM) $(cmds_txt) *.made
%.html : %.txt %.html : %.txt
rm -f $@+ $@ $(RM) $@+ $@
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \ $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
mv $@+ $@ mv $@+ $@
@ -122,7 +123,7 @@ clean:
xmlto -m callouts.xsl man $< xmlto -m callouts.xsl man $<
%.xml : %.txt %.xml : %.txt
rm -f $@+ $@ $(RM) $@+ $@
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
mv $@+ $@ mv $@+ $@
@ -137,7 +138,7 @@ user-manual.html: user-manual.xml
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $< xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
howto-index.txt: howto-index.sh $(wildcard howto/*.txt) howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
rm -f $@+ $@ $(RM) $@+ $@
sh ./howto-index.sh $(wildcard howto/*.txt) >$@+ sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
mv $@+ $@ mv $@+ $@
@ -147,7 +148,7 @@ $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
WEBDOC_DEST = /pub/software/scm/git/docs WEBDOC_DEST = /pub/software/scm/git/docs
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
rm -f $@+ $@ $(RM) $@+ $@
sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
mv $@+ $@ mv $@+ $@

View File

@ -176,6 +176,7 @@ export prefix bindir gitexecdir sharedir template_dir sysconfdir
CC = gcc CC = gcc
AR = ar AR = ar
RM = rm -f
TAR = tar TAR = tar
INSTALL = install INSTALL = install
RPMBUILD = rpmbuild RPMBUILD = rpmbuild
@ -729,7 +730,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS)
ifneq (,$X) ifneq (,$X)
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';) $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$p';)
endif endif
all:: all::
@ -743,7 +744,7 @@ strip: $(PROGRAMS) git$X
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
gitk-wish: gitk GIT-GUI-VARS gitk-wish: gitk GIT-GUI-VARS
$(QUIET_GEN)rm -f $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \ sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
chmod +x $@+ && \ chmod +x $@+ && \
mv -f $@+ $@ mv -f $@+ $@
@ -759,10 +760,10 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
help.o: common-cmds.h help.o: common-cmds.h
git-merge-subtree$X: git-merge-recursive$X git-merge-subtree$X: git-merge-recursive$X
$(QUIET_BUILT_IN)rm -f $@ && ln git-merge-recursive$X $@ $(QUIET_BUILT_IN)$(RM) $@ && ln git-merge-recursive$X $@
$(BUILT_INS): git$X $(BUILT_INS): git$X
$(QUIET_BUILT_IN)rm -f $@ && ln git$X $@ $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
common-cmds.h: ./generate-cmdlist.sh common-cmds.h: ./generate-cmdlist.sh
@ -770,7 +771,7 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@ $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)rm -f $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
@ -782,7 +783,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
rm -f $@ $@+ $(RM) $@ $@+
sed -e '1s|#!.*/python|#!$(PYTHON_PATH_SQ)|' \ sed -e '1s|#!.*/python|#!$(PYTHON_PATH_SQ)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
@ -794,7 +795,7 @@ perl/perl.mak: GIT-CFLAGS
$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F) $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
$(QUIET_GEN)rm -f $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \ INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
sed -e '1{' \ sed -e '1{' \
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
@ -813,7 +814,7 @@ git-status: git-commit
$(QUIET_GEN)cp $< $@+ && mv $@+ $@ $(QUIET_GEN)cp $< $@+ && mv $@+ $@
gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.cgi: gitweb/gitweb.perl
$(QUIET_GEN)rm -f $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
-e 's|++GIT_BINDIR++|$(bindir)|g' \ -e 's|++GIT_BINDIR++|$(bindir)|g' \
@ -836,7 +837,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
mv $@+ $@ mv $@+ $@
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
$(QUIET_GEN)rm -f $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
@ -849,11 +850,11 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
mv $@+ $@ mv $@+ $@
configure: configure.ac configure: configure.ac
$(QUIET_GEN)rm -f $@ $<+ && \ $(QUIET_GEN)$(RM) $@ $<+ && \
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$< > $<+ && \ $< > $<+ && \
autoconf -o $@ $<+ && \ autoconf -o $@ $<+ && \
rm -f $<+ $(RM) $<+
# These can record GIT_VERSION # These can record GIT_VERSION
git.o git.spec \ git.o git.spec \
@ -908,7 +909,7 @@ $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
$(DIFF_OBJS): diffcore.h $(DIFF_OBJS): diffcore.h
$(LIB_FILE): $(LIB_OBJS) $(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(LIB_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
xdiff/xmerge.o xdiff/xmerge.o
@ -916,7 +917,7 @@ $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
$(XDIFF_LIB): $(XDIFF_OBJS) $(XDIFF_LIB): $(XDIFF_OBJS)
$(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
@ -927,11 +928,11 @@ doc:
$(MAKE) -C Documentation all $(MAKE) -C Documentation all
TAGS: TAGS:
rm -f TAGS $(RM) TAGS
find . -name '*.[hcS]' -print | xargs etags -a find . -name '*.[hcS]' -print | xargs etags -a
tags: tags:
rm -f tags $(RM) tags
find . -name '*.[hcS]' -print | xargs ctags -a find . -name '*.[hcS]' -print | xargs ctags -a
### Detect prefix changes ### Detect prefix changes
@ -1010,9 +1011,9 @@ endif
cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \ cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \ '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
fi fi
$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;) $(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
ifneq (,$X) ifneq (,$X)
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';) $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
endif endif
install-doc: install-doc:
@ -1042,7 +1043,7 @@ dist: git.spec git-archive configure
$(GIT_TARNAME)/configure \ $(GIT_TARNAME)/configure \
$(GIT_TARNAME)/version \ $(GIT_TARNAME)/version \
$(GIT_TARNAME)/git-gui/version $(GIT_TARNAME)/git-gui/version
@rm -rf $(GIT_TARNAME) @$(RM) -r $(GIT_TARNAME)
gzip -f -9 $(GIT_TARNAME).tar gzip -f -9 $(GIT_TARNAME).tar
rpm: dist rpm: dist
@ -1051,13 +1052,13 @@ rpm: dist
htmldocs = git-htmldocs-$(GIT_VERSION) htmldocs = git-htmldocs-$(GIT_VERSION)
manpages = git-manpages-$(GIT_VERSION) manpages = git-manpages-$(GIT_VERSION)
dist-doc: dist-doc:
rm -fr .doc-tmp-dir $(RM) -r .doc-tmp-dir
mkdir .doc-tmp-dir mkdir .doc-tmp-dir
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar . cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
gzip -n -9 -f $(htmldocs).tar gzip -n -9 -f $(htmldocs).tar
: :
rm -fr .doc-tmp-dir $(RM) -r .doc-tmp-dir
mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
$(MAKE) -C Documentation DESTDIR=./ \ $(MAKE) -C Documentation DESTDIR=./ \
man1dir=../.doc-tmp-dir/man1 \ man1dir=../.doc-tmp-dir/man1 \
@ -1066,31 +1067,31 @@ dist-doc:
install install
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar . cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
gzip -n -9 -f $(manpages).tar gzip -n -9 -f $(manpages).tar
rm -fr .doc-tmp-dir $(RM) -r .doc-tmp-dir
### Cleaning rules ### Cleaning rules
clean: clean:
rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \ $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
$(LIB_FILE) $(XDIFF_LIB) $(LIB_FILE) $(XDIFF_LIB)
rm -f $(ALL_PROGRAMS) $(BUILT_INS) git$X $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
rm -f $(TEST_PROGRAMS) $(RM) $(TEST_PROGRAMS)
rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
rm -rf autom4te.cache $(RM) -r autom4te.cache
rm -f configure config.log config.mak.autogen config.mak.append config.status config.cache $(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
rm -rf $(GIT_TARNAME) .doc-tmp-dir $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
rm -f $(htmldocs).tar.gz $(manpages).tar.gz $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
rm -f gitweb/gitweb.cgi $(RM) gitweb/gitweb.cgi
$(MAKE) -C Documentation/ clean $(MAKE) -C Documentation/ clean
$(MAKE) -C perl clean $(MAKE) -C perl clean
$(MAKE) -C templates/ clean $(MAKE) -C templates/ clean
$(MAKE) -C t/ clean $(MAKE) -C t/ clean
ifndef NO_TCLTK ifndef NO_TCLTK
rm -f gitk-wish $(RM) gitk-wish
$(MAKE) -C git-gui clean $(MAKE) -C git-gui clean
endif endif
rm -f GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
.PHONY: all install clean strip .PHONY: all install clean strip
.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS

View File

@ -7,6 +7,7 @@ INSTALL ?= install
INSTALL_ELC = $(INSTALL) -m 644 INSTALL_ELC = $(INSTALL) -m 644
prefix ?= $(HOME) prefix ?= $(HOME)
emacsdir = $(prefix)/share/emacs/site-lisp emacsdir = $(prefix)/share/emacs/site-lisp
RM ?= rm -f
all: $(ELC) all: $(ELC)
@ -17,4 +18,4 @@ install: all
%.elc: %.el %.elc: %.el
$(EMACS) -batch -f batch-byte-compile $< $(EMACS) -batch -f batch-byte-compile $<
clean:; rm -f $(ELC) clean:; $(RM) $(ELC)

View File

@ -6,6 +6,7 @@
#GIT_TEST_OPTS=--verbose --debug #GIT_TEST_OPTS=--verbose --debug
SHELL_PATH ?= $(SHELL) SHELL_PATH ?= $(SHELL)
TAR ?= $(TAR) TAR ?= $(TAR)
RM ?= rm -f
# Shell quote; # Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
@ -19,7 +20,7 @@ $(T):
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
clean: clean:
rm -fr trash $(RM) -r trash
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
full-svn-test: full-svn-test:

View File

@ -6,6 +6,7 @@ endif
INSTALL ?= install INSTALL ?= install
TAR ?= tar TAR ?= tar
RM ?= rm -f
prefix ?= $(HOME) prefix ?= $(HOME)
template_dir ?= $(prefix)/share/git-core/templates template_dir ?= $(prefix)/share/git-core/templates
# DESTDIR= # DESTDIR=
@ -42,7 +43,7 @@ custom:
$(QUIET): no custom templates yet $(QUIET): no custom templates yet
clean: clean:
rm -rf blt boilerplates.made $(RM) -r blt boilerplates.made
install: all install: all
$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)' $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'