summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-10-24 17:53:52 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-10-24 17:53:52 -0700
commit568903e4f3f070839b202a249f19b22c327570ae (patch)
tree36300eba26dcba4c7687381aafec7cd44a49691a /crawl-ref/source/makefile
parent8137d9e8ff0796d70765fffc41c3ab9582b4838d (diff)
downloadcrawl-ref-568903e4f3f070839b202a249f19b22c327570ae.tar.gz
crawl-ref-568903e4f3f070839b202a249f19b22c327570ae.zip
makefile: generate dependencies using GCC by default
This also automatically regenerates dependencies when needed. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/makefile')
-rw-r--r--crawl-ref/source/makefile30
1 files changed, 19 insertions, 11 deletions
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