[PATCH v1 1/2] Makefile.sh use macros for 'rm' consistently #2

From: Philip Prindeville <philipp@cpan.org>

From: Philip Prindeville <philipp@cpan.org>

Reduce noise from failed-but-ignored 'rm' invocations.

Signed-off-by: Philip Prindeville <philipp@cpan.org>
---
 Makefile.SH | 115 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 58 insertions(+), 57 deletions(-)

diff --git a/Makefile.SH b/Makefile.SH
index 85f9171b5fe3e819d9541b1d70529175304c12d2..f1ab764ed491cf35bd1b151746f57645ee09aaeb 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -275,6 +275,7 @@ LNS = $lns
 # NOTE: some systems don't grok "cp -f". XXX Configure test needed?
 CPS = $cp
 RMS = rm -f
+RMS_R = rm -rf
 ranlib = $ranlib
 
 # The following are mentioned only to make metaconfig include the
@@ -747,7 +748,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EXT)
 	./generate_uudmap$(HOST_EXE_EXT) $(generated_headers)
 
 generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
-	-@rm generate_uudmap$(HOST_EXE_EXT)
+	@$(RMS) generate_uudmap$(HOST_EXE_EXT)
 	$(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
 
 !NO!SUBS!
@@ -887,26 +888,26 @@ mydtrace.h: $(DTRACE_H)
 	define)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 $(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
-	-rm -rf mpdtrace
+	$(RMS_R) mpdtrace
 	mkdir mpdtrace
 	cp $(miniperl_objs_nodt) mpdtrace/
 	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_dtrace_objs)
 
 $(DTRACE_PERLLIB_O): perldtrace.d $(perllib_objs_nodt)
-	-rm -rf libpdtrace
+	$(RMS_R) libpdtrace
 	mkdir libpdtrace
 	cp $(perllib_objs_nodt) libpdtrace/
 	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_dtrace_objs)
 
 $(DTRACE_MAIN_O): perldtrace.d perlmain$(OBJ_EXT)
-	-rm -rf maindtrace
+	$(RMS_R) maindtrace
 	mkdir maindtrace
 	cp perlmain$(OBJ_EXT) maindtrace/
 	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) $(perlmain_dtrace_objs) ||	      \
 	  ( $(ECHO) "No probes in perlmain$(OBJ_EXT), generating a dummy $(DTRACE_MAIN_O)" && \
 	    $(ECHO) >dtrace_main.c &&							      \
 	    `$(CCCMD)` $(PLDLFLAGS) dtrace_main.c &&					      \
-	     rm -f dtrace_main.c )
+	     $(RMS) dtrace_main.c )
 
 !NO!SUBS!
 		;;
@@ -917,13 +918,13 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT)
 	case "$useshrplib" in
 	true)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
-	rm -f $@
+	$(RMS) $@
 	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
 !NO!SUBS!
 		case "$osname" in
 		aix)
 			$spitshell >>$Makefile <<'!NO!SUBS!'
-	rm -f libperl$(OBJ_EXT)
+	$(RMS) libperl$(OBJ_EXT)
 	mv $@ libperl$(OBJ_EXT)
 	$(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
 !NO!SUBS!
@@ -932,7 +933,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT)
 		;;
 	*)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
-	rm -f $(LIBPERL)
+	$(RMS) $(LIBPERL)
 	$(AR) rc $(LIBPERL) $(perllib_objs) $(DYNALOADER)
 	@$(ranlib) $(LIBPERL)
 !NO!SUBS!
@@ -965,7 +966,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl
 	amigaos*)
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
-	-@rm -f miniperl.xok
+	@$(RMS) miniperl.xok
 	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
 	    $(miniperl_objs) $(libs)
 #	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
@@ -1003,7 +1004,7 @@ NAMESPACEFLAGS = -force_flat_namespace
 		esac
 		$spitshell >>$Makefile <<'!NO!SUBS!'
 lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
-	-@rm -f miniperl.xok
+	@$(RMS) miniperl.xok
 	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
 	    $(miniperl_objs) $(libs)
 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
@@ -1014,8 +1015,8 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
 		if test "X$hostperl" != X; then
 			$spitshell >>$Makefile <<!GROK!THIS!
 lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
-	-@rm -f miniperl.xok
-	-@rm \$(MINIPERL_EXE)
+	@\$(RMS) miniperl.xok
+	@\$(RMS) \$(MINIPERL_EXE)
 	\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
 	\$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
 	\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
@@ -1023,7 +1024,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
 		else
 			$spitshell >>$Makefile <<'!NO!SUBS!'
 lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
-	-@rm -f miniperl.xok
+	@$(RMS) miniperl.xok
 	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
 	    $(miniperl_objs) $(libs)
 	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
@@ -1036,7 +1037,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
 	$spitshell >>$Makefile <<'!NO!SUBS!'
 
 $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
-	-@rm -f miniperl.xok
+	@$(RMS) miniperl.xok
 !NO!SUBS!
 
         case $osname in
@@ -1130,8 +1131,8 @@ pod/perl5291delta.pod: pod/perldelta.pod
 	$(LNS) perldelta.pod pod/perl5291delta.pod
 
 extra.pods: $(MINIPERL_EXE)
-	-@test ! -f extra.pods || rm -f `cat extra.pods`
-	-@rm -f extra.pods
+	-@test ! -f extra.pods || $(RMS) `cat extra.pods`
+	@$(RMS) extra.pods
 	-@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
 	    nx=`echo $$x | sed -e "s/README\.//"`; \
 	    $(LNS) ../$$x "pod/perl"$$nx".pod" ; \
@@ -1351,11 +1352,11 @@ realclean:	_realcleaner _mopup
 	@echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
 
 _clobber:
-	-@rm -f Cross/run-* Cross/to-* Cross/from-* Cross/mkdir
-	-rm -rf host
-	rm -f t/test_state
-	rm -f config.sh cppstdin Policy.sh extras.lst
-	rm -f $(MANIFEST_SRT)
+	@$(RMS) Cross/run-* Cross/to-* Cross/from-* Cross/mkdir
+	$(RMS_R) host
+	$(RMS) t/test_state
+	$(RMS) config.sh cppstdin Policy.sh extras.lst
+	$(RMS) $(MANIFEST_SRT)
 
 clobber:	_realcleaner _mopup _clobber
 
@@ -1363,23 +1364,23 @@ distclean:	clobber
 
 # Like distclean but also removes emacs backups and *.orig.
 veryclean:	_verycleaner _mopup _clobber
-	-@rm -f Obsolete Wanted
+	$(RMS) Obsolete Wanted
 
 # Do not 'make _mopup' directly.
 _mopup:
-	rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c perlmini.c generate_uudmap$(EXE_EXT) $(generated_headers)
+	$(RMS) *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c perlmini.c generate_uudmap$(EXE_EXT) $(generated_headers)
 	-rmdir .depending
-	-@test -f extra.pods && rm -f `cat extra.pods`
-	-@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
-	-rm -f perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall
-	-rm -f perl.export perl.dll perl.libexp perl.map perl.def
-	-rm -f *perl.xok
-	-rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
-	-rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
-	-rm -f config.arch config.over $(DTRACE_H)
+	-@test -f extra.pods && $(RMS) `cat extra.pods`
+	-@test -f vms/README_vms.pod && $(RMS) vms/README_vms.pod
+	$(RMS) perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall
+	$(RMS) perl.export perl.dll perl.libexp perl.map perl.def
+	$(RMS) *perl.xok
+	$(RMS) cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
+	$(RMS) $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
+	$(RMS) config.arch config.over $(DTRACE_H)
 
 _cleaner1:
-	-cd os2; rm -f Makefile
+	-cd os2; $(RMS) Makefile
 	-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
 	-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
 	-@if test -f $(MINIPERL_EXE) ; then \
@@ -1389,8 +1390,8 @@ _cleaner1:
 	else \
 	sh $(CLEAN).sh ; \
 	fi
-	rm -f realclean.sh veryclean.sh
-	-rm -f `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'`
+	$(RMS) realclean.sh veryclean.sh
+	$(RMS) `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'`
 
 # Dear POSIX, thanks for making the default to xargs to be
 # run once if nothhing is passed in. It is such a great help.
@@ -1405,24 +1406,24 @@ _cleaner1:
 # Add new rules before that line - the next line (rm -f so_locations ...) is
 # used as a placeholder by a regen script.
 _cleaner2:
-	-rm -f core.*perl.*.? t/core.perl.*.? .?*.c
-	rm -f core *perl.core t/core t/*perl.core core.* t/core.*
-	rm -f t/$(PERL_EXE) t/rantests
-	rm -rf t/tmp*
-	rm -rf $(addedbyconf)
-	rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old utils/Makefile
-	rm -f $(private)
-	rm -rf $(unidatafiles) $(unidatadirs)
-	rm -rf lib/auto
-	rm -f lib/.exists lib/*/.exists lib/*/*/.exists
-	rm -f h2ph.man
-	rm -rf .config
-	rm -f preload
-	rm -f pod2htmd.tmp
-	rm -rf pod/perlfunc pod/perlipc
+	$(RMS) core.*perl.*.? t/core.perl.*.? .?*.c
+	$(RMS) core *perl.core t/core t/*perl.core core.* t/core.*
+	$(RMS) t/$(PERL_EXE) t/rantests
+	$(RMS_R) t/tmp*
+	$(RMS_R) $(addedbyconf)
+	$(RMS) $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old utils/Makefile
+	$(RMS) $(private)
+	$(RMS_R) $(unidatafiles) $(unidatadirs)
+	$(RMS_R) lib/auto
+	$(RMS) lib/.exists lib/*/.exists lib/*/*/.exists
+	$(RMS) h2ph.man
+	$(RMS_R) .config
+	$(RMS) preload
+	$(RMS) pod2htmd.tmp
+	$(RMS_R) pod/perlfunc pod/perlipc
 	-rmdir ext/B/lib
-	-rm -f dist/Time-HiRes/xdefine
-	rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
+	$(RMS) dist/Time-HiRes/xdefine
+	$(RMS) so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
 	-rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
 	-rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
 	-rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
@@ -1472,11 +1473,11 @@ _realcleaner:
 _verycleaner:
 	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
 	@$(LDLIBPTH) $(MAKE) _cleaner2
-	-rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
+	$(RMS) *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
 
 .PHONY: lint
 lint: $(c)
-	rm -f *.ln
+	$(RMS) *.ln
 	lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
 
 cscopeflags = -Rb  # Recursive, build-only.
@@ -1534,7 +1535,7 @@ case "$targethost" in
 '') $spitshell >>$Makefile <<'!NO!SUBS!'
 test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
 	$(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
-	cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
+	cd t && ($(RMS) $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 
 !NO!SUBS!
 ;;
@@ -1584,7 +1585,7 @@ test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE
 	$to config.sh
 # --- For lib/diagnostics.t with -Duseshrplib
 	$to \$(PERL_EXE)
-	cd t && (rm -f \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd ..
+	cd t && (\$(RMS) \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd ..
 	$to t/\$(PERL_EXE)
 
 !GROK!THIS!
@@ -1594,7 +1595,7 @@ esac
 $spitshell >>$Makefile <<'!NO!SUBS!'
 test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
 	$(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
-	cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
+	cd t && ($(RMS) $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 !NO!SUBS!
 
 case "$targethost" in
@@ -1649,7 +1650,7 @@ minitest_prep:
 	@echo "You may see some irrelevant test failures if you have been unable"
 	@echo "to build lib/Config.pm, or the Unicode data files."
 	@echo " "
-	- cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
+	- cd t && ($(RMS) $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
 
 MINITEST_TESTS = base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t
 
-- 
2.7.4
0
philipp
7/1/2018 7:56:58 PM
perl.perl5.porters 47434 articles. 0 followers. Follow

0 Replies
53 Views

Similar Articles

[PageSpeed] 57

Reply: