From e232445b8157b09e53b3897acbf9e47183d98a96 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sat, 31 Oct 2009 06:17:14 -0700 Subject: 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 --- crawl-ref/.gitignore | 1 + crawl-ref/source/makefile | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/.gitignore b/crawl-ref/.gitignore index 35709bb4b2..2908075b5f 100644 --- a/crawl-ref/.gitignore +++ b/crawl-ref/.gitignore @@ -40,6 +40,7 @@ mapgen.log makefile.dep /source/*.d /source/rltiles/*.d +/source/.cflags /source/.contrib-ok /source/.contrib-libs /source/compflag.h 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 $@ # -- cgit v1.2.3-54-g00ecf