summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-18 16:09:51 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-18 16:09:51 -0700
commitdee470bf63c25c3d99ea89e9d9f5979ab01d53bb (patch)
tree0b8a3a91c89e0ad6713e62702dfc23bf875ec9b7 /crawl-ref/source/makefile
parentb3475474824eb75feb901ed9fa3b5826626a185b (diff)
downloadcrawl-ref-dee470bf63c25c3d99ea89e9d9f5979ab01d53bb.tar.gz
crawl-ref-dee470bf63c25c3d99ea89e9d9f5979ab01d53bb.zip
Add compilation information to Version namespace
The Version namespace now provides the compiler which was used, the OS, machine type and processor type the compilation was done on, and the CFLAGS, CFLAGS_L and LDFLAGS which were used. If GCC was the compiler, it also provides the compiler version. This information is included in crash reports, and can be dumped using the new command line option "-version".
Diffstat (limited to 'crawl-ref/source/makefile')
-rw-r--r--crawl-ref/source/makefile35
1 files changed, 31 insertions, 4 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index e9d5421bc0..0d30dddc9d 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -34,7 +34,6 @@ CFOTHERS_L := -fsigned-char
CFWARN := -Wall
MAKEFLAGS := --no-print-directory
-
#
# The GCC and GXX variables are set later.
#
@@ -591,12 +590,12 @@ ifneq ($(MAKECMDGOALS),distclean)
endif
endif
-.INTERMEDIATE: build.h
+.INTERMEDIATE: build.h compflag.h
build.h:
$(QUIET_GEN)util/gen_ver.pl $@
-version.cc: build.h
+version.cc: build.h compflag.h
##########################################################################
# The level compiler
@@ -682,7 +681,35 @@ distclean: clean clean-contrib clean-rltiles
done
@touch .contrib-ok
-$(GAME): $(GAME_DEPENDS)
+# This information is included in crash reports, and is printed with
+# "crawl -version"
+compile-flags:
+ @echo "// Automatically generated by makefile" > .compflag.h
+ @echo "#ifndef __included_crawl_compiler_flags_h" >> .compflag.h
+ @echo "#define __included_crawl_compiler_flags_h" >> .compflag.h
+
+ @echo -n "#define CRAWL_CFLAGS \"" >> .compflag.h
+ @echo -n $(CFLAGS) | sed s/\"/\\\"/g >> .compflag.h
+ @echo "\"" >> .compflag.h
+
+ @echo -n "#define CRAWL_CFLAGS_L \"" >> .compflag.h
+ @echo -n $(CFLAGS_L) | sed s/\"/\\\"/g >> .compflag.h
+ @echo "\"" >> .compflag.h
+
+ @echo -n "#define CRAWL_LDFLAGS \"" >> .compflag.h
+ @echo -n $(LDFLAGS) | sed s/\"/\\\"/g >> .compflag.h
+ @echo "\"" >> .compflag.h
+
+ @echo "#endif" >> .compflag.h
+
+ @if [ "`diff -N -q .compflag.h compflag.h`" ]; then \
+ echo Updating compflag.h; \
+ mv .compflag.h compflag.h; \
+ fi
+
+compflag.h: compile-flags
+
+$(GAME): $(GAME_DEPENDS) compile-flags
$(QUIET_LINK)$(CXX) $(LDFLAGS) $(EXTRA_OBJECTS) $(OBJECTS) -o $(GAME) $(LIB)
debug: $(GAME)