From 503609ba38413e93650ad0d520b710421fec2884 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 17 Jan 2007 15:03:13 +0000 Subject: 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 --- crawl-ref/source/makefile | 3 +++ crawl-ref/source/makefile.unix | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source') 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 @@ -89,6 +89,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) -- cgit v1.2.3-54-g00ecf