Commit f1f32a2f authored by David Gibson's avatar David Gibson

Clean up use of 'rm' in Makefiles

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: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 0e46d8c0
...@@ -64,9 +64,9 @@ ccan/%/info: ccan/%/_info ...@@ -64,9 +64,9 @@ ccan/%/info: ccan/%/_info
$(CC) $(CCAN_CFLAGS) -o $@ -x c $< $(CC) $(CCAN_CFLAGS) -o $@ -x c $<
clean: tools-clean clean: tools-clean
$(RM) `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'` rm -f `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
$(RM) config.h rm -f config.h
$(RM) inter-depends lib-depends test-depends rm -f inter-depends lib-depends test-depends
# Creates a dependency from the tests to the object files which it needs. # Creates a dependency from the tests to the object files which it needs.
inter-depends: $(ALL_DEPENDS) Makefile inter-depends: $(ALL_DEPENDS) Makefile
......
...@@ -5,7 +5,7 @@ CFLAGS := -I$(CCANDIR) -Wall ...@@ -5,7 +5,7 @@ CFLAGS := -I$(CCANDIR) -Wall
cdump-enumstr: cdump-enumstr.o $(CCAN_OBJS) cdump-enumstr: cdump-enumstr.o $(CCAN_OBJS)
clean: clean:
$(RM) cdump-enumstr.o $(CCAN_OBJS) rm -f cdump-enumstr.o $(CCAN_OBJS)
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
......
...@@ -12,7 +12,7 @@ $(INTEL_OBJS): %.o : %.asm ...@@ -12,7 +12,7 @@ $(INTEL_OBJS): %.o : %.asm
yasm -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX -o $@ $< yasm -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX -o $@ $<
clean: clean:
$(RM) -f *.o rm -f *.o
ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
......
...@@ -26,4 +26,4 @@ err.o: $(CCANDIR)/ccan/err/err.c ...@@ -26,4 +26,4 @@ err.o: $(CCANDIR)/ccan/err/err.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
clean: clean:
$(RM) -f *.o $(ALL) rm -f *.o $(ALL)
...@@ -32,4 +32,4 @@ list.o: $(CCANDIR)/ccan/list/list.c ...@@ -32,4 +32,4 @@ list.o: $(CCANDIR)/ccan/list/list.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
clean: clean:
$(RM) *.o $(ALL) rm -f *.o $(ALL)
...@@ -45,6 +45,6 @@ tools/configurator/configurator: tools/configurator/configurator.c ...@@ -45,6 +45,6 @@ tools/configurator/configurator: tools/configurator/configurator.c
tools/modfiles: tools/modfiles.o tools/manifest.o $(DEP_OBJS) tools/modfiles: tools/modfiles.o tools/manifest.o $(DEP_OBJS)
tools-clean: ccanlint-clean tools-clean: ccanlint-clean
$(RM) $(ALL_TOOLS) rm -f $(ALL_TOOLS)
include tools/ccanlint/Makefile include tools/ccanlint/Makefile
...@@ -47,4 +47,4 @@ $(CORE_OBJS): config.h ...@@ -47,4 +47,4 @@ $(CORE_OBJS): config.h
tools/ccanlint/ccanlint: $(OBJS) tools/ccanlint/ccanlint: $(OBJS)
ccanlint-clean: ccanlint-clean:
$(RM) tools/ccanlint/ccanlint rm -f tools/ccanlint/ccanlint
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment