From 9e2aae8e87ed53f3c845ff943e35e7f5b61cafac Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Fri, 1 Jan 2010 13:46:05 -0800 Subject: makefile: greatly simplify dependency generation I feel ashamed to have overlooked this awesome trick. Signed-off-by: Steven Noonan --- crawl-ref/source/makefile | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) (limited to 'crawl-ref/source/makefile') diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index 5b18afe4fe..188359e245 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -456,28 +456,9 @@ endif # Figure out the build settings for this type of build # -# All -# Default target. -ifneq (,$(findstring all,$(MAKECMDGOALS))) - USE_DEPGEN=YesPlease -endif - -# All -# Default target. -ifeq (,$(MAKECMDGOALS)) - USE_DEPGEN=YesPlease -endif - -# $(GAME) -# Another default target. -ifneq (,$(findstring $(GAME),$(MAKECMDGOALS))) - USE_DEPGEN=YesPlease -endif - # Debug # No optimization, full debugging. ifneq (,$(findstring debug,$(MAKECMDGOALS))) - USE_DEPGEN=YesPlease FULLDEBUG=YesPlease WIZARD=YesPlease DEBUG=YesPlease @@ -487,7 +468,6 @@ endif # Wizard # Optimized, with wizard mode. ifneq (,$(findstring wizard,$(MAKECMDGOALS))) - USE_DEPGEN=YesPlease WIZARD=YesPlease DEBUG=YesPlease endif @@ -495,7 +475,6 @@ endif # Profile # Optimized, with full debugging. ifneq (,$(findstring profile,$(MAKECMDGOALS))) - USE_DEPGEN=YesPlease FULLDEBUG=YesPlease WIZARD=YesPlease DEBUG=YesPlease @@ -767,20 +746,7 @@ TRACK_CFLAGS = $(subst ','\'',$(CC) $(CXX) $(ALL_CFLAGS)) # (stray ' f DEPS := $(OBJECTS:.o=.d) -ifeq ($(shell which fastdep 2> /dev/null),) -DEPEND := $(CXX) -MM $(ALL_CFLAGS) -else -DEPEND := fastdep $(DEFINES) $(DEFINES_L) $(INCLUDES) $(INCLUDES_L) -endif - -%.d: %.cc .cflags - $(QUIET_DEPEND)$(DEPEND) $< > $@ - -depend: $(DEPS) - -ifdef USE_DEPGEN -include $(DEPS) -endif # This information is included in crash reports, and is printed with # "crawl -version" @@ -899,11 +865,11 @@ wizard: $(GAME) # test. $(UTIL)%.o: $(UTIL)%.cc .cflags - $(QUIET_CXX)$(CXX) $(YACC_CFLAGS) -o $@ -c $< + $(QUIET_CXX)$(CXX) $(YACC_CFLAGS) -Wp,-MD,$(subst .o,.d,$@) -c $< -o $@ ifdef PCH %.h.gch: %.h - $(QUIET_PCH)$(CXX) $(ALL_CFLAGS) -c $< -o $@ + $(QUIET_PCH)$(CXX) $(ALL_CFLAGS) -Wp,-MD,$(subst .o,.d,$@) -c $< -o $@ CC_DEP := AppHdr.h.gch endif @@ -911,10 +877,10 @@ endif $(OBJECTS:%.o=%.cc): $(CC_DEP) $(TILEDEFHDRS) $(CONTRIB_LIBS) %.o: %.m .cflags - $(QUIET_CXX)$(CC) $(ALL_CFLAGS) -c $< -o $@ + $(QUIET_CXX)$(CC) $(ALL_CFLAGS) -Wp,-MD,$(subst .o,.d,$@) -c $< -o $@ %.o: %.cc .cflags - $(QUIET_CXX)$(CXX) $(ALL_CFLAGS) -c $< -o $@ + $(QUIET_CXX)$(CXX) $(ALL_CFLAGS) -Wp,-MD,$(subst .o,.d,$@) -c $< -o $@ icon.o: util/crawl.rc util/crawl.ico $(QUIET_WINDRES)$(WINDRES) util/crawl.rc icon.o -- cgit v1.2.3-54-g00ecf