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>
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)
@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)