From 568903e4f3f070839b202a249f19b22c327570ae Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sat, 24 Oct 2009 17:53:52 -0700 Subject: makefile: generate dependencies using GCC by default This also automatically regenerates dependencies when needed. Signed-off-by: Steven Noonan --- crawl-ref/source/makefile | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'crawl-ref/source/makefile') diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index 8fe258f5d9..498384cb29 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -564,24 +564,29 @@ test: ########################################################################## # Dependencies -DEPENDENCY_MKF := makefile.dep - ifeq ($(shell which fastdep 2> /dev/null),) -depend: $(OBJECTS:.o=.cc) - rm -f $(DEPENDENCY_MKF).tmp - @for i in $^; do \ - echo ' ' DEP $$i; \ - $(CXX) -MM $(CFLAGS) $(CFLAGS_L) $$i >>$(DEPENDENCY_MKF).tmp 2>/dev/null; \ - done - mv -f $(DEPENDENCY_MKF).tmp $(DEPENDENCY_MKF) + +%.d: %.cc + $(QUIET_DEPEND)$(CXX) -MM $(CFLAGS) $(CFLAGS_L) $< > $@ + +depend: $(OBJECTS:.o=.d) + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),distclean) +-include $(OBJECTS:.o=.d) +endif +endif + else + +DEPENDENCY_MKF := makefile.dep + depend: $(DEPENDENCY_MKF) makefile.dep: .contrib-ok %.dep: $(OBJECTS:.o=.cc) $(QUIET_DEPEND)fastdep $(DEFINES) $(INCLUDES) $(OBJECTS:.o=.cc) > $@ -endif ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) @@ -589,6 +594,9 @@ ifneq ($(MAKECMDGOALS),distclean) endif endif +endif + + .PHONY: compflag.h build.h version.cc # This information is included in crash reports, and is printed with @@ -668,7 +676,7 @@ endif clean: +$(MAKE) -C $(UTIL) clean - $(RM) *.o *.ixx build.h compflag.h .contrib-libs .contrib-ok + $(RM) $(OBJECTS) $(OBJECTS:.o=.d) *.ixx build.h compflag.h .contrib-libs .contrib-ok clean-contrib: +$(MAKE) -C contrib clean -- cgit v1.2.3-54-g00ecf