Skip to content

Commit 72a27b3

Browse files
gibfahnitaloacasas
authored andcommitted
build: use $(RM) in Makefile for consistency
Also allows someone to reassign `$RM`, e.g. with `RM=rm -v` instead of `rm -f` (the default) should they want to. We're currently using a mixture of `$(RM)` and `rm -f`. There are a couple of places which aren't doing -f, have them do it for consistency. PR-URL: #12157 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent 3af9101 commit 72a27b3

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

Makefile

+51-51
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,38 @@ uninstall:
9595
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
9696

9797
clean:
98-
-rm -rf out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
98+
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
9999
out/$(BUILDTYPE)/node.exp
100-
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs rm -rf; fi
101-
-rm -rf node_modules
102-
@if [ -d deps/icu ]; then echo deleting deps/icu; rm -rf deps/icu; fi
103-
-rm -f test.tap
100+
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
101+
$(RM) -r node_modules
102+
@if [ -d deps/icu ]; then echo deleting deps/icu; $(RM) -r deps/icu; fi
103+
$(RM) test.tap
104104

105105
distclean:
106-
-rm -rf out
107-
-rm -f config.gypi icu_config.gypi config_fips.gypi
108-
-rm -f config.mk
109-
-rm -rf $(NODE_EXE) $(NODE_G_EXE)
110-
-rm -rf node_modules
111-
-rm -rf deps/icu
112-
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
113-
-rm -f $(BINARYTAR).* $(TARBALL).*
114-
-rm -rf deps/v8/testing/gmock
106+
$(RM) -r out
107+
$(RM) config.gypi icu_config.gypi config_fips.gypi
108+
$(RM) config.mk
109+
$(RM) -r $(NODE_EXE) $(NODE_G_EXE)
110+
$(RM) -r node_modules
111+
$(RM) -r deps/icu
112+
$(RM) -r deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
113+
$(RM) $(BINARYTAR).* $(TARBALL).*
114+
$(RM) -r deps/v8/testing/gmock
115115

116116
check: test
117117

118118
# Remove files generated by running coverage, put the non-instrumented lib back
119119
# in place
120120
coverage-clean:
121-
if [ -d lib_ ]; then rm -rf lib; mv lib_ lib; fi
122-
-rm -rf node_modules
123-
-rm -rf gcovr testing
124-
-rm -rf out/$(BUILDTYPE)/.coverage
125-
-rm -rf .cov_tmp coverage
126-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/*.gcda
127-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
128-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/*.gcno
129-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/tracing*.gcno
121+
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
122+
$(RM) -r node_modules
123+
$(RM) -r gcovr testing
124+
$(RM) -r out/$(BUILDTYPE)/.coverage
125+
$(RM) -r .cov_tmp coverage
126+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
127+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
128+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcno
129+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing*.gcno
130130

131131
# Build and test with code coverage reporting. Leave the lib directory
132132
# instrumented for any additional runs the user may want to make.
@@ -147,16 +147,16 @@ coverage-build: all
147147
if [ ! -f gcovr/scripts/gcovr.orig ]; then \
148148
(cd gcovr && patch -N -p1 < \
149149
"$(CURDIR)/testing/coverage/gcovr-patches.diff"); fi
150-
if [ -d lib_ ]; then rm -rf lib; mv lib_ lib; fi
150+
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
151151
mv lib lib_
152152
$(NODE) ./node_modules/.bin/nyc instrument lib_/ lib/
153153
$(MAKE)
154154

155155
coverage-test: coverage-build
156-
-rm -rf out/$(BUILDTYPE)/.coverage
157-
-rm -rf .cov_tmp
158-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/*.gcda
159-
-rm -f out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
156+
$(RM) -r out/$(BUILDTYPE)/.coverage
157+
$(RM) -r .cov_tmp
158+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
159+
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
160160
-$(MAKE) $(COVTESTS)
161161
mv lib lib__
162162
mv lib_ lib
@@ -456,7 +456,7 @@ docopen: $(apidocs_html)
456456
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
457457

458458
docclean:
459-
-rm -rf out/doc
459+
$(RM) -r out/doc
460460

461461
build-ci:
462462
$(PYTHON) ./configure $(CONFIG_FLAGS)
@@ -631,8 +631,8 @@ release-only:
631631
fi
632632

633633
$(PKG): release-only
634-
rm -rf $(PKGDIR)
635-
rm -rf out/deps out/Release
634+
$(RM) -r $(PKGDIR)
635+
$(RM) -r out/deps out/Release
636636
$(PYTHON) ./configure \
637637
--dest-cpu=x64 \
638638
--tag=$(TAG) \
@@ -663,24 +663,24 @@ $(TARBALL): release-only $(NODE_EXE) doc
663663
mkdir -p $(TARNAME)/doc/api
664664
cp doc/node.1 $(TARNAME)/doc/node.1
665665
cp -r out/doc/api/* $(TARNAME)/doc/api/
666-
rm -rf $(TARNAME)/deps/v8/{test,samples,tools/profviz,tools/run-tests.py}
667-
rm -rf $(TARNAME)/doc/images # too big
668-
rm -rf $(TARNAME)/deps/uv/{docs,samples,test}
669-
rm -rf $(TARNAME)/deps/openssl/openssl/{doc,demos,test}
670-
rm -rf $(TARNAME)/deps/zlib/contrib # too big, unused
671-
rm -rf $(TARNAME)/.{editorconfig,git*,mailmap}
672-
rm -rf $(TARNAME)/tools/{eslint,eslint-rules,osx-pkg.pmdoc,pkgsrc}
673-
rm -rf $(TARNAME)/tools/{osx-*,license-builder.sh,cpplint.py}
674-
rm -rf $(TARNAME)/test*.tap
675-
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs rm
676-
find $(TARNAME)/ -type l | xargs rm # annoying on windows
666+
$(RM) -r $(TARNAME)/deps/v8/{test,samples,tools/profviz,tools/run-tests.py}
667+
$(RM) -r $(TARNAME)/doc/images # too big
668+
$(RM) -r $(TARNAME)/deps/uv/{docs,samples,test}
669+
$(RM) -r $(TARNAME)/deps/openssl/openssl/{doc,demos,test}
670+
$(RM) -r $(TARNAME)/deps/zlib/contrib # too big, unused
671+
$(RM) -r $(TARNAME)/.{editorconfig,git*,mailmap}
672+
$(RM) -r $(TARNAME)/tools/{eslint,eslint-rules,osx-pkg.pmdoc,pkgsrc}
673+
$(RM) -r $(TARNAME)/tools/{osx-*,license-builder.sh,cpplint.py}
674+
$(RM) -r $(TARNAME)/test*.tap
675+
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs $(RM)
676+
find $(TARNAME)/ -type l | xargs $(RM) # annoying on windows
677677
tar -cf $(TARNAME).tar $(TARNAME)
678-
rm -rf $(TARNAME)
678+
$(RM) -r $(TARNAME)
679679
gzip -c -f -9 $(TARNAME).tar > $(TARNAME).tar.gz
680680
ifeq ($(XZ), 0)
681681
xz -c -f -$(XZ_COMPRESSION) $(TARNAME).tar > $(TARNAME).tar.xz
682682
endif
683-
rm $(TARNAME).tar
683+
$(RM) $(TARNAME).tar
684684

685685
tar: $(TARBALL)
686686

@@ -709,14 +709,14 @@ $(TARBALL)-headers: release-only
709709
--release-urlbase=$(RELEASE_URLBASE) \
710710
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
711711
HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
712-
find $(TARNAME)/ -type l | xargs rm -f
712+
find $(TARNAME)/ -type l | xargs $(RM)
713713
tar -cf $(TARNAME)-headers.tar $(TARNAME)
714-
rm -rf $(TARNAME)
714+
$(RM) -r $(TARNAME)
715715
gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
716716
ifeq ($(XZ), 0)
717717
xz -c -f -$(XZ_COMPRESSION) $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.xz
718718
endif
719-
rm $(TARNAME)-headers.tar
719+
$(RM) $(TARNAME)-headers.tar
720720

721721
tar-headers: $(TARBALL)-headers
722722

@@ -732,8 +732,8 @@ ifeq ($(XZ), 0)
732732
endif
733733

734734
$(BINARYTAR): release-only
735-
rm -rf $(BINARYNAME)
736-
rm -rf out/deps out/Release
735+
$(RM) -r $(BINARYNAME)
736+
$(RM) -r out/deps out/Release
737737
$(PYTHON) ./configure \
738738
--prefix=/ \
739739
--dest-cpu=$(DESTCPU) \
@@ -745,12 +745,12 @@ $(BINARYTAR): release-only
745745
cp LICENSE $(BINARYNAME)
746746
cp CHANGELOG.md $(BINARYNAME)
747747
tar -cf $(BINARYNAME).tar $(BINARYNAME)
748-
rm -rf $(BINARYNAME)
748+
$(RM) -r $(BINARYNAME)
749749
gzip -c -f -9 $(BINARYNAME).tar > $(BINARYNAME).tar.gz
750750
ifeq ($(XZ), 0)
751751
xz -c -f -$(XZ_COMPRESSION) $(BINARYNAME).tar > $(BINARYNAME).tar.xz
752752
endif
753-
rm $(BINARYNAME).tar
753+
$(RM) $(BINARYNAME).tar
754754

755755
binary: $(BINARYTAR)
756756

0 commit comments

Comments
 (0)