]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
Makefile: Reduce wildcard usage
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 6 Dec 2010 09:31:54 +0000 (11:31 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 6 Dec 2010 09:41:18 +0000 (11:41 +0200)
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 <kaapeli@itanic.dy.fi>
Makefile

index 5c14b207455f0847002ff7030396b1af83a010e5..a097dc0cf340322b4d3a79253dc7b2074392491d 100644 (file)
--- 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)