Skip to content

Commit 4cb08df

Browse files
Emil Medvegitster
authored andcommitted
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>
1 parent 3f2fd36 commit 4cb08df

File tree

5 files changed

+48
-43
lines changed

5 files changed

+48
-43
lines changed

Documentation/Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ifdef ASCIIDOC8
4141
ASCIIDOC_EXTRA += -a asciidoc7compatible
4242
endif
4343
INSTALL?=install
44+
RM ?= rm -f
4445
DOC_REF = origin/man
4546

4647
-include ../config.mak.autogen
@@ -84,7 +85,7 @@ install: man
8485
# Determine "include::" file references in asciidoc files.
8586
#
8687
doc.dep : $(wildcard *.txt) build-docdep.perl
87-
rm -f $@+ $@
88+
$(RM) $@+ $@
8889
perl ./build-docdep.perl >$@+
8990
mv $@+ $@
9091

@@ -109,11 +110,11 @@ cmd-list.made: cmd-list.perl $(MAN1_TXT)
109110
git.7 git.html: git.txt core-intro.txt
110111

111112
clean:
112-
rm -f *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep
113-
rm -f $(cmds_txt) *.made
113+
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep
114+
$(RM) $(cmds_txt) *.made
114115

115116
%.html : %.txt
116-
rm -f $@+ $@
117+
$(RM) $@+ $@
117118
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
118119
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
119120
mv $@+ $@
@@ -122,7 +123,7 @@ clean:
122123
xmlto -m callouts.xsl man $<
123124

124125
%.xml : %.txt
125-
rm -f $@+ $@
126+
$(RM) $@+ $@
126127
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
127128
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
128129
mv $@+ $@
@@ -137,7 +138,7 @@ user-manual.html: user-manual.xml
137138
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
138139

139140
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
140-
rm -f $@+ $@
141+
$(RM) $@+ $@
141142
sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
142143
mv $@+ $@
143144

@@ -147,7 +148,7 @@ $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
147148
WEBDOC_DEST = /pub/software/scm/git/docs
148149

149150
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
150-
rm -f $@+ $@
151+
$(RM) $@+ $@
151152
sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
152153
mv $@+ $@
153154

Makefile

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export prefix bindir gitexecdir sharedir template_dir sysconfdir
176176

177177
CC = gcc
178178
AR = ar
179+
RM = rm -f
179180
TAR = tar
180181
INSTALL = install
181182
RPMBUILD = rpmbuild
@@ -729,7 +730,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
729730

730731
all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS)
731732
ifneq (,$X)
732-
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';)
733+
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$p';)
733734
endif
734735

735736
all::
@@ -743,7 +744,7 @@ strip: $(PROGRAMS) git$X
743744
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
744745

745746
gitk-wish: gitk GIT-GUI-VARS
746-
$(QUIET_GEN)rm -f $@ $@+ && \
747+
$(QUIET_GEN)$(RM) $@ $@+ && \
747748
sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
748749
chmod +x $@+ && \
749750
mv -f $@+ $@
@@ -759,18 +760,18 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
759760
help.o: common-cmds.h
760761

761762
git-merge-subtree$X: git-merge-recursive$X
762-
$(QUIET_BUILT_IN)rm -f $@ && ln git-merge-recursive$X $@
763+
$(QUIET_BUILT_IN)$(RM) $@ && ln git-merge-recursive$X $@
763764

764765
$(BUILT_INS): git$X
765-
$(QUIET_BUILT_IN)rm -f $@ && ln git$X $@
766+
$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
766767

767768
common-cmds.h: ./generate-cmdlist.sh
768769

769770
common-cmds.h: $(wildcard Documentation/git-*.txt)
770771
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
771772

772773
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
773-
$(QUIET_GEN)rm -f $@ $@+ && \
774+
$(QUIET_GEN)$(RM) $@ $@+ && \
774775
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
775776
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
776777
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
@@ -782,7 +783,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
782783
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
783784

784785
$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
785-
rm -f $@ $@+
786+
$(RM) $@ $@+
786787
sed -e '1s|#!.*/python|#!$(PYTHON_PATH_SQ)|' \
787788
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
788789
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
@@ -794,7 +795,7 @@ perl/perl.mak: GIT-CFLAGS
794795
$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
795796

796797
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
797-
$(QUIET_GEN)rm -f $@ $@+ && \
798+
$(QUIET_GEN)$(RM) $@ $@+ && \
798799
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
799800
sed -e '1{' \
800801
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
@@ -813,7 +814,7 @@ git-status: git-commit
813814
$(QUIET_GEN)cp $< $@+ && mv $@+ $@
814815

815816
gitweb/gitweb.cgi: gitweb/gitweb.perl
816-
$(QUIET_GEN)rm -f $@ $@+ && \
817+
$(QUIET_GEN)$(RM) $@ $@+ && \
817818
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
818819
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
819820
-e 's|++GIT_BINDIR++|$(bindir)|g' \
@@ -836,7 +837,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
836837
mv $@+ $@
837838

838839
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
839-
$(QUIET_GEN)rm -f $@ $@+ && \
840+
$(QUIET_GEN)$(RM) $@ $@+ && \
840841
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
841842
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
842843
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
@@ -849,11 +850,11 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
849850
mv $@+ $@
850851

851852
configure: configure.ac
852-
$(QUIET_GEN)rm -f $@ $<+ && \
853+
$(QUIET_GEN)$(RM) $@ $<+ && \
853854
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
854855
$< > $<+ && \
855856
autoconf -o $@ $<+ && \
856-
rm -f $<+
857+
$(RM) $<+
857858

858859
# These can record GIT_VERSION
859860
git.o git.spec \
@@ -908,15 +909,15 @@ $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
908909
$(DIFF_OBJS): diffcore.h
909910

910911
$(LIB_FILE): $(LIB_OBJS)
911-
$(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
912+
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
912913

913914
XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
914915
xdiff/xmerge.o
915916
$(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
916917
xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
917918

918919
$(XDIFF_LIB): $(XDIFF_OBJS)
919-
$(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
920+
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
920921

921922

922923
perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
@@ -927,11 +928,11 @@ doc:
927928
$(MAKE) -C Documentation all
928929

929930
TAGS:
930-
rm -f TAGS
931+
$(RM) TAGS
931932
find . -name '*.[hcS]' -print | xargs etags -a
932933

933934
tags:
934-
rm -f tags
935+
$(RM) tags
935936
find . -name '*.[hcS]' -print | xargs ctags -a
936937

937938
### Detect prefix changes
@@ -1010,9 +1011,9 @@ endif
10101011
cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
10111012
'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
10121013
fi
1013-
$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
1014+
$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
10141015
ifneq (,$X)
1015-
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
1016+
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
10161017
endif
10171018

10181019
install-doc:
@@ -1042,7 +1043,7 @@ dist: git.spec git-archive configure
10421043
$(GIT_TARNAME)/configure \
10431044
$(GIT_TARNAME)/version \
10441045
$(GIT_TARNAME)/git-gui/version
1045-
@rm -rf $(GIT_TARNAME)
1046+
@$(RM) -r $(GIT_TARNAME)
10461047
gzip -f -9 $(GIT_TARNAME).tar
10471048

10481049
rpm: dist
@@ -1051,13 +1052,13 @@ rpm: dist
10511052
htmldocs = git-htmldocs-$(GIT_VERSION)
10521053
manpages = git-manpages-$(GIT_VERSION)
10531054
dist-doc:
1054-
rm -fr .doc-tmp-dir
1055+
$(RM) -r .doc-tmp-dir
10551056
mkdir .doc-tmp-dir
10561057
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
10571058
cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
10581059
gzip -n -9 -f $(htmldocs).tar
10591060
:
1060-
rm -fr .doc-tmp-dir
1061+
$(RM) -r .doc-tmp-dir
10611062
mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
10621063
$(MAKE) -C Documentation DESTDIR=./ \
10631064
man1dir=../.doc-tmp-dir/man1 \
@@ -1066,31 +1067,31 @@ dist-doc:
10661067
install
10671068
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
10681069
gzip -n -9 -f $(manpages).tar
1069-
rm -fr .doc-tmp-dir
1070+
$(RM) -r .doc-tmp-dir
10701071

10711072
### Cleaning rules
10721073

10731074
clean:
1074-
rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
1075+
$(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
10751076
$(LIB_FILE) $(XDIFF_LIB)
1076-
rm -f $(ALL_PROGRAMS) $(BUILT_INS) git$X
1077-
rm -f $(TEST_PROGRAMS)
1078-
rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
1079-
rm -rf autom4te.cache
1080-
rm -f configure config.log config.mak.autogen config.mak.append config.status config.cache
1081-
rm -rf $(GIT_TARNAME) .doc-tmp-dir
1082-
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1083-
rm -f $(htmldocs).tar.gz $(manpages).tar.gz
1084-
rm -f gitweb/gitweb.cgi
1077+
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1078+
$(RM) $(TEST_PROGRAMS)
1079+
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
1080+
$(RM) -r autom4te.cache
1081+
$(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
1082+
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1083+
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1084+
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
1085+
$(RM) gitweb/gitweb.cgi
10851086
$(MAKE) -C Documentation/ clean
10861087
$(MAKE) -C perl clean
10871088
$(MAKE) -C templates/ clean
10881089
$(MAKE) -C t/ clean
10891090
ifndef NO_TCLTK
1090-
rm -f gitk-wish
1091+
$(RM) gitk-wish
10911092
$(MAKE) -C git-gui clean
10921093
endif
1093-
rm -f GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
1094+
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
10941095

10951096
.PHONY: all install clean strip
10961097
.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS

contrib/emacs/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ INSTALL ?= install
77
INSTALL_ELC = $(INSTALL) -m 644
88
prefix ?= $(HOME)
99
emacsdir = $(prefix)/share/emacs/site-lisp
10+
RM ?= rm -f
1011

1112
all: $(ELC)
1213

@@ -17,4 +18,4 @@ install: all
1718
%.elc: %.el
1819
$(EMACS) -batch -f batch-byte-compile $<
1920

20-
clean:; rm -f $(ELC)
21+
clean:; $(RM) $(ELC)

t/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#GIT_TEST_OPTS=--verbose --debug
77
SHELL_PATH ?= $(SHELL)
88
TAR ?= $(TAR)
9+
RM ?= rm -f
910

1011
# Shell quote;
1112
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
@@ -19,7 +20,7 @@ $(T):
1920
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
2021

2122
clean:
22-
rm -fr trash
23+
$(RM) -r trash
2324

2425
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
2526
full-svn-test:

templates/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ endif
66

77
INSTALL ?= install
88
TAR ?= tar
9+
RM ?= rm -f
910
prefix ?= $(HOME)
1011
template_dir ?= $(prefix)/share/git-core/templates
1112
# DESTDIR=
@@ -42,7 +43,7 @@ custom:
4243
$(QUIET): no custom templates yet
4344

4445
clean:
45-
rm -rf blt boilerplates.made
46+
$(RM) -r blt boilerplates.made
4647

4748
install: all
4849
$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'

0 commit comments

Comments
 (0)