Clean up use of 'rm' in Makefiles
authorDavid Gibson <david@gibson.dropbear.id.au>
Tue, 16 Feb 2016 12:24:05 +0000 (23:24 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 29 Apr 2016 23:18:28 +0000 (09:18 +1000)
Most of the ccan Makefiles use $(RM) to remove files.  However, 'rm' is
traditionally considered one of the few shell tools which can be used in
Makefiles without indirecting via a variable.

rm is also typically invoked with -f in Makefiles, so that it doesn't cause
errors if the files don't exist (because they haven't been built).  A
number of instances in ccan were missing this.

This corrects these warts.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Makefile
ccan/cdump/tools/Makefile
ccan/crypto/sha256/benchmarks/Makefile
ccan/io/benchmarks/Makefile
ccan/timer/benchmarks/Makefile
tools/Makefile
tools/ccanlint/Makefile

index 856baa90f483bea02f2ddcabfbfa407922c3ed45..5d4b701c868bdfc62ae9ea8c325c4a958611d681 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -64,9 +64,9 @@ ccan/%/info: ccan/%/_info
        $(CC) $(CCAN_CFLAGS) -o $@ -x c $<
 
 clean: tools-clean
-       $(RM) `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'`  `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
-       $(RM) config.h
-       $(RM) inter-depends lib-depends test-depends
+       rm -f `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'`  `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
+       rm -f config.h
+       rm -f inter-depends lib-depends test-depends
 
 # Creates a dependency from the tests to the object files which it needs.
 inter-depends: $(ALL_DEPENDS) Makefile
index 3b30d6619a714a9847719f56245b4ce9353decd2..8b012845e2fab4103805faf9db8fef961d1914a2 100644 (file)
@@ -5,7 +5,7 @@ CFLAGS := -I$(CCANDIR) -Wall
 cdump-enumstr: cdump-enumstr.o $(CCAN_OBJS)
 
 clean:
-       $(RM) cdump-enumstr.o $(CCAN_OBJS)
+       rm -f cdump-enumstr.o $(CCAN_OBJS)
 
 ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
        $(CC) $(CFLAGS) -c -o $@ $<
index a9f1b29fc7dbd821cd3a4f7e5c16536813bec4dc..f1749ab5e7eb11cb8123235bae012e9d127a4619 100644 (file)
@@ -12,7 +12,7 @@ $(INTEL_OBJS): %.o : %.asm
        yasm -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX -o $@ $<
 
 clean:
-       $(RM) -f *.o
+       rm -f *.o
 
 ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
        $(CC) $(CFLAGS) -c -o $@ $<
index 0068400de51c047c6cc994a0f71deec5990e3d66..7dcf9bebcb7133aeb389f974a0e89a8d4818d2d3 100644 (file)
@@ -26,4 +26,4 @@ err.o: $(CCANDIR)/ccan/err/err.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
 clean:
-       $(RM) -f *.o $(ALL)
+       rm -f *.o $(ALL)
index 7e0653ab4bb09f68b745a0e21a3b7d19324045ae..a3cbbd12d48857772e216be829cdf40678e9b008 100644 (file)
@@ -32,4 +32,4 @@ list.o: $(CCANDIR)/ccan/list/list.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
 clean:
-       $(RM) *.o $(ALL)
+       rm -f *.o $(ALL)
index 338befc46de51326b8fe0c707165dce1caa67d9b..6e4833a3b8a23d0eef9912ff00e93192f58bd992 100644 (file)
@@ -45,6 +45,6 @@ tools/configurator/configurator: tools/configurator/configurator.c
 tools/modfiles: tools/modfiles.o tools/manifest.o $(DEP_OBJS)
 
 tools-clean: ccanlint-clean
-       $(RM) $(ALL_TOOLS)
+       rm -f $(ALL_TOOLS)
 
 include tools/ccanlint/Makefile
index 691f270890e0f352edc3f2815c97a01ab59428ad..5a266796e3206b4da6e367a2719f14165afcaef4 100644 (file)
@@ -47,4 +47,4 @@ $(CORE_OBJS): config.h
 tools/ccanlint/ccanlint: $(OBJS)
 
 ccanlint-clean:
-       $(RM) tools/ccanlint/ccanlint
+       rm -f tools/ccanlint/ccanlint