summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-10-31 06:17:14 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-10-31 06:29:17 -0700
commite232445b8157b09e53b3897acbf9e47183d98a96 (patch)
tree700035d0c3e9e9e95b9e998c19fbfbb975258d38 /crawl-ref/source/makefile
parentb57dddb1a14cf0a7abb1b4cd2f01f3dd6cb84509 (diff)
downloadcrawl-ref-e232445b8157b09e53b3897acbf9e47183d98a96.tar.gz
crawl-ref-e232445b8157b09e53b3897acbf9e47183d98a96.zip
makefile: add cflag difference check
This should eliminate occasional inconsisten builds caused by switching between 'make wizard TILES=y' and 'make wizard', and other such bad combination switches. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/makefile')
-rw-r--r--crawl-ref/source/makefile27
1 files changed, 23 insertions, 4 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index f9bf3e20f5..ab0bff9586 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -583,13 +583,32 @@ PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
.PHONY: all test install clean clean-contrib distclean debug profile wizard
-##########################################################################
-
all: $(GAME)
test:
./$(GAME) -test > /dev/null
+#
+# CFLAGS difference check
+#
+# Check for flag changes between the previous build and the current one,
+# because any CFLAGS change could result in an inconsistent build if the
+# person building it isn't careful.
+#
+# This should eliminate an annoying need to use 'make clean' every time.
+#
+
+TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS))
+
+.cflags: .force-cflags
+ @FLAGS='$(TRACK_CFLAGS)'; \
+ if test x"$$FLAGS" != x"`cat .cflags 2>/dev/null`" ; then \
+ echo " * new build flags or prefix"; \
+ echo "$$FLAGS" > .cflags; \
+ fi
+
+.PHONY: .force-cflags
+
##########################################################################
# Dependencies
@@ -738,10 +757,10 @@ endif
$(OBJECTS:%.o=%.cc): $(CC_DEP) $(TILEDEFHDRS) $(CONTRIB_LIBS)
-%.o: %.m
+%.o: %.m .cflags
$(QUIET_CXX)$(CC) $(ALL_CFLAGS) -c $< -o $@
-%.o: %.cc
+%.o: %.cc .cflags
$(QUIET_CXX)$(CXX) $(ALL_CFLAGS) -c $< -o $@
#