From: Timo Kokkonen Date: Mon, 6 Dec 2010 09:31:54 +0000 (+0200) Subject: Makefile: Reduce wildcard usage X-Git-Url: http://git.itanic.dy.fi/?p=scan-pagemap;a=commitdiff_plain;h=113561ad3639a1b504eb65370863cbdd5853ce68 Makefile: Reduce wildcard usage Having wildcards in the Makefile is error prone in situations where there are unrelated files in the source tree that are not related to the actual project. For example, if some source files have been renamed and there are leftover .*.o.d files that still contain the old source files. Then make will incorrectly determine that some old files would still be needed even though they are not part of the project any more. Signed-off-by: Timo Kokkonen --- diff --git a/Makefile b/Makefile index 5c14b20..a097dc0 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ CHECKPATCH=/usr/src/linux/scripts/checkpatch.pl SCAN_PAGEMAP_OBJS=main.o parse.o bintree.o analyze.o pidlib.o SCAN_PAGEMAP_DEBUG_OBJS= $(patsubst %.o,%-debug.o,$(SCAN_PAGEMAP_OBJS)) +ALL_OBJS = $(SCAN_PAGEMAP_OBJS) $(SCAN_PAGEMAP_DEBUG_OBJS) +ALL_DEBS = $(patsubst %.o,.%.o.d,$(ALL_OBJS)) scan-pagemap: $(SCAN_PAGEMAP_OBJS) gcc $(CFLAGS) -o $@ $(SCAN_PAGEMAP_OBJS) @@ -32,9 +34,8 @@ TAGS: @etags *.[ch] clean: - rm -rfv $(SCAN_PAGEMAP_OBJS) $(SCAN_PAGEMAP_DEBUG_OBJS) \ - *~ scan-pagemap TAGS .*.d debug-pagemap + rm -rfv $(ALL_OBJS) *~ scan-pagemap TAGS $(ALL_DEBS) debug-pagemap .PHONY: all clean TAGS --include .*.d +-include $(ALL_DEBS)