From 96944cb324ba858b8fd89175edf14c5a26bd58d6 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Fri, 6 Nov 2009 23:25:34 -0800 Subject: makefile: cleanup, simplify, and optimize dependency generation Signed-off-by: Steven Noonan --- crawl-ref/source/makefile | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'crawl-ref/source/makefile') diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index b879ef6005..6aa60a5627 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -623,34 +623,23 @@ TRACK_CFLAGS = $(subst ','\'',$(CC) $(CXX) $(ALL_CFLAGS)) ########################################################################## # Dependencies -ifeq ($(shell which fastdep 2> /dev/null),) - -%.d: %.cc .cflags - $(QUIET_DEPEND)$(CXX) -MM $(ALL_CFLAGS) $< > $@ - -depend: $(OBJECTS:.o=.d) - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),distclean) --include $(OBJECTS:.o=.d) -endif -endif +DEPS := $(OBJECTS:.o=.d) +ifeq ($(shell which fastdep 2> /dev/null),) +DEPEND := $(CXX) -MM $(ALL_CFLAGS) else +DEPEND := fastdep $(DEFINES) $(INCLUDES) +endif -DEPENDENCY_MKF := makefile.dep - -depend: $(DEPENDENCY_MKF) +%.d: %.cc .cflags + $(QUIET_DEPEND)$(DEPEND) $< > $@ -%.dep: $(OBJECTS:.o=.cc) - $(QUIET_DEPEND)fastdep $(DEFINES) $(INCLUDES) $(OBJECTS:.o=.cc) > $@ +depend: $(DEPS) ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) --include $(DEPENDENCY_MKF) -endif +-include $(DEPS) endif - endif -- cgit v1.2.3-54-g00ecf