diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-17 20:22:24 -0700 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-17 20:22:24 -0700 |
commit | 43873ef0ff403a6bc0242f8cc8510060127abde3 (patch) | |
tree | 8718f8c5a614efbba8722e7efb0696a76b7d40b7 /crawl-ref/source/makefile | |
parent | f923d3b75a2d9dc0e5b8953b0021832b76c65081 (diff) | |
download | crawl-ref-43873ef0ff403a6bc0242f8cc8510060127abde3.tar.gz crawl-ref-43873ef0ff403a6bc0242f8cc8510060127abde3.zip |
makefile: Automatically optimize for your machine
Setting the makefile variable AUTO_OPT_GCC will give GCC a list of
optimization flags suited for the machine make is run on. It does this
using util/auto-opt.sh. "-march=native -mtune=native" are always
outputted, which causes GCC to detect the CPU type you use and generate
code for that. On Linux systems it also looks at the flags line of
/proc/cpuinfo to pick x86 optimization flags.
Diffstat (limited to 'crawl-ref/source/makefile')
-rw-r--r-- | crawl-ref/source/makefile | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index f3bcd0b51b..03557f4a4f 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -24,16 +24,35 @@ GAME = crawl # CFWARN(_L) - Warning flags # CFOTHERS(_L) - Anything else # -# These are good optimizations for a Pentium M or better: -#CFOPTIMIZE := -O2 -march=i686 -mtune=i686 -mmmx -msse -msse2 -mfpmath=sse -funroll-all-loops + # These are really good options for the Intel C++ compiler: #CFOPTIMIZE := -O2 -parallel -CFOPTIMIZE := -O2 + +# Define this to automatically generate code optimized for your machine +# (GCC only as of now). +# +# NOTE: Don't use this with a release build, since the generated code +# won't work for all machines. +ifdef AUTO_OPT_GCC + +ifdef CROSSHOST +error Can not do AUTO_OPT_GCC with CROSSHOST +endif + +ifdef HURRY +error Can not do AUTO_OPT_GCC with HURRY +endif + +AUTO_OPT_FLAGS := $(shell util/auto-opt.sh) +endif + +CFOPTIMIZE := -O2 $(AUTO_OPT_FLAGS) CFOTHERS := -fno-strict-aliasing -pipe CFOTHERS_L := -fsigned-char CFWARN := -Wall MAKEFLAGS := --no-print-directory + # # The GCC and GXX variables are set later. # |