summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-17 15:03:13 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-17 15:03:13 +0000
commit503609ba38413e93650ad0d520b710421fec2884 (patch)
tree2e34d81587eeb73e007effbc90326f9ec6e74c84 /crawl-ref/source
parent0cb37ef9c9aa55e1a24816666080b54b554843cb (diff)
downloadcrawl-ref-503609ba38413e93650ad0d520b710421fec2884.tar.gz
crawl-ref-503609ba38413e93650ad0d520b710421fec2884.zip
Added a basic depend target. Maybe we should do full autodependency building?
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@860 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/makefile3
-rw-r--r--crawl-ref/source/makefile.unix17
2 files changed, 19 insertions, 1 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index 74adf5d88c..495076e0c0 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -31,6 +31,9 @@ clean:
distclean:
$(MAKE) $(OTHER) -f $(MAKEFILE) distclean
+depend:
+ $(MAKE) $(OTHER) -f $(MAKEFILE) depend
+
# WIZARD mode currently includes asserts, bounds checking, and item checking
wizard:
$(MAKE) $(OTHER) -f $(MAKEFILE) debug EXTRA_FLAGS='-g -DWIZARD -DDEBUG -DDEBUG_ITEM_SCAN'
diff --git a/crawl-ref/source/makefile.unix b/crawl-ref/source/makefile.unix
index fdac1526ae..2e1f2a88ff 100644
--- a/crawl-ref/source/makefile.unix
+++ b/crawl-ref/source/makefile.unix
@@ -90,6 +90,20 @@ PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
all: $(GAME)
##########################################################################
+# Dependencies
+
+DEPENDENCY_MKF := makefile.dependencies
+
+depend: $(OBJECTS:.o=.cc)
+ rm -f $(DEPENDENCY_MKF)
+ @for i in $^; do \
+ echo "Updating dependencies for $$i"; \
+ $(CXX) -MM $(CFLAGS) $$i >>$(DEPENDENCY_MKF) 2>/dev/null; \
+ done
+
+-include $(DEPENDENCY_MKF)
+
+##########################################################################
# The level compiler
#
@@ -157,6 +171,7 @@ distclean: clean
$(DELETE) core
$(DELETE) *.0*
$(DELETE) *.lab
+ [ -f $(DEPENDENCY_MKF) ] && $(DELETE) $(DEPENDENCY_MKF)
$(GAME): $(GAME_DEPENDS)
${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
@@ -186,7 +201,7 @@ $(UTIL)%.o: $(UTIL)%.cc
# To package, you *must* have lex and yacc to generate the intermediates.
ifeq ($(DOYACC),y)
-package-source: distclean prebuildyacc pkgtidy removeold vlink pkgtarbz2 pkgzip
+package-source: distclean prebuildyacc pkgtidy depend removeold vlink pkgtarbz2 pkgzip
pkgtidy:
$(DELETE) $(PKG_TIDY_LIST)