Skip to content

Commit e7e83f6

Browse files
gibfahnMylesBorins
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. Backport-PR-URL: #12515 PR-URL: #12157 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
1 parent d15188f commit e7e83f6

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

Makefile

+38-38
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,24 @@ uninstall:
9090
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
9191

9292
clean:
93-
-rm -rf out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
93+
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
9494
out/$(BUILDTYPE)/node.exp
95-
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs rm -rf; fi
96-
-rm -rf node_modules
97-
@if [ -d deps/icu ]; then echo deleting deps/icu; rm -rf deps/icu; fi
98-
-rm -f test.tap
95+
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
96+
$(RM) -r node_modules
97+
@if [ -d deps/icu ]; then echo deleting deps/icu; $(RM) -r deps/icu; fi
98+
$(RM) test.tap
9999

100100
distclean:
101-
-rm -rf out
102-
-rm -f config.gypi icu_config.gypi config_fips.gypi
103-
-rm -f config.mk
104-
-rm -rf $(NODE_EXE) $(NODE_G_EXE)
105-
-rm -rf node_modules
106-
-rm -rf deps/icu
107-
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
108-
-rm -f $(BINARYTAR).* $(TARBALL).*
109-
-rm -rf deps/v8/testing/gmock
110-
-rm -rf deps/v8/testing/gtest
101+
$(RM) -r out
102+
$(RM) config.gypi icu_config.gypi config_fips.gypi
103+
$(RM) config.mk
104+
$(RM) -r $(NODE_EXE) $(NODE_G_EXE)
105+
$(RM) -r node_modules
106+
$(RM) -r deps/icu
107+
$(RM) -r deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
108+
$(RM) $(BINARYTAR).* $(TARBALL).*
109+
$(RM) -r deps/v8/testing/gmock
110+
$(RM) -r deps/v8/testing/gtest
111111

112112
check: test
113113

@@ -367,7 +367,7 @@ docopen: $(apidocs_html)
367367
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
368368

369369
docclean:
370-
-rm -rf out/doc
370+
$(RM) -r out/doc
371371

372372
build-ci:
373373
$(PYTHON) ./configure $(CONFIG_FLAGS)
@@ -542,8 +542,8 @@ release-only:
542542
fi
543543

544544
$(PKG): release-only
545-
rm -rf $(PKGDIR)
546-
rm -rf out/deps out/Release
545+
$(RM) -r $(PKGDIR)
546+
$(RM) -r out/deps out/Release
547547
$(PYTHON) ./configure \
548548
--dest-cpu=x64 \
549549
--tag=$(TAG) \
@@ -574,24 +574,24 @@ $(TARBALL): release-only $(NODE_EXE) doc
574574
mkdir -p $(TARNAME)/doc/api
575575
cp doc/node.1 $(TARNAME)/doc/node.1
576576
cp -r out/doc/api/* $(TARNAME)/doc/api/
577-
rm -rf $(TARNAME)/deps/v8/{test,samples,tools/profviz,tools/run-tests.py}
578-
rm -rf $(TARNAME)/doc/images # too big
579-
rm -rf $(TARNAME)/deps/uv/{docs,samples,test}
580-
rm -rf $(TARNAME)/deps/openssl/openssl/{doc,demos,test}
581-
rm -rf $(TARNAME)/deps/zlib/contrib # too big, unused
582-
rm -rf $(TARNAME)/.{editorconfig,git*,mailmap}
583-
rm -rf $(TARNAME)/tools/{eslint,eslint-rules,osx-pkg.pmdoc,pkgsrc}
584-
rm -rf $(TARNAME)/tools/{osx-*,license-builder.sh,cpplint.py}
585-
rm -rf $(TARNAME)/test*.tap
586-
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs rm
587-
find $(TARNAME)/ -type l | xargs rm # annoying on windows
577+
$(RM) -r $(TARNAME)/deps/v8/{test,samples,tools/profviz,tools/run-tests.py}
578+
$(RM) -r $(TARNAME)/doc/images # too big
579+
$(RM) -r $(TARNAME)/deps/uv/{docs,samples,test}
580+
$(RM) -r $(TARNAME)/deps/openssl/openssl/{doc,demos,test}
581+
$(RM) -r $(TARNAME)/deps/zlib/contrib # too big, unused
582+
$(RM) -r $(TARNAME)/.{editorconfig,git*,mailmap}
583+
$(RM) -r $(TARNAME)/tools/{eslint,eslint-rules,osx-pkg.pmdoc,pkgsrc}
584+
$(RM) -r $(TARNAME)/tools/{osx-*,license-builder.sh,cpplint.py}
585+
$(RM) -r $(TARNAME)/test*.tap
586+
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs $(RM)
587+
find $(TARNAME)/ -type l | xargs $(RM) # annoying on windows
588588
tar -cf $(TARNAME).tar $(TARNAME)
589-
rm -rf $(TARNAME)
589+
$(RM) -r $(TARNAME)
590590
gzip -c -f -9 $(TARNAME).tar > $(TARNAME).tar.gz
591591
ifeq ($(XZ), 0)
592592
xz -c -f -$(XZ_COMPRESSION) $(TARNAME).tar > $(TARNAME).tar.xz
593593
endif
594-
rm $(TARNAME).tar
594+
$(RM) $(TARNAME).tar
595595

596596
tar: $(TARBALL)
597597

@@ -620,14 +620,14 @@ $(TARBALL)-headers: release-only
620620
--release-urlbase=$(RELEASE_URLBASE) \
621621
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
622622
HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
623-
find $(TARNAME)/ -type l | xargs rm -f
623+
find $(TARNAME)/ -type l | xargs $(RM)
624624
tar -cf $(TARNAME)-headers.tar $(TARNAME)
625-
rm -rf $(TARNAME)
625+
$(RM) -r $(TARNAME)
626626
gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
627627
ifeq ($(XZ), 0)
628628
xz -c -f -$(XZ_COMPRESSION) $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.xz
629629
endif
630-
rm $(TARNAME)-headers.tar
630+
$(RM) $(TARNAME)-headers.tar
631631

632632
tar-headers: $(TARBALL)-headers
633633

@@ -643,8 +643,8 @@ ifeq ($(XZ), 0)
643643
endif
644644

645645
$(BINARYTAR): release-only
646-
rm -rf $(BINARYNAME)
647-
rm -rf out/deps out/Release
646+
$(RM) -r $(BINARYNAME)
647+
$(RM) -r out/deps out/Release
648648
$(PYTHON) ./configure \
649649
--prefix=/ \
650650
--dest-cpu=$(DESTCPU) \
@@ -656,12 +656,12 @@ $(BINARYTAR): release-only
656656
cp LICENSE $(BINARYNAME)
657657
cp CHANGELOG.md $(BINARYNAME)
658658
tar -cf $(BINARYNAME).tar $(BINARYNAME)
659-
rm -rf $(BINARYNAME)
659+
$(RM) -r $(BINARYNAME)
660660
gzip -c -f -9 $(BINARYNAME).tar > $(BINARYNAME).tar.gz
661661
ifeq ($(XZ), 0)
662662
xz -c -f -$(XZ_COMPRESSION) $(BINARYNAME).tar > $(BINARYNAME).tar.xz
663663
endif
664-
rm $(BINARYNAME).tar
664+
$(RM) $(BINARYNAME).tar
665665

666666
binary: $(BINARYTAR)
667667

0 commit comments

Comments
 (0)