summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/Makefile
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-06-24 14:05:14 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-06-24 14:05:14 +0200
commite19fa701fad8b44cc1e67a56c6402855838d758b (patch)
tree7e8b597947af69dcbbf5ba4e66297820a584b765 /crawl-ref/source/Makefile
parentdc940a1eb3af48d8da4e292a728aed93c53cb369 (diff)
downloadcrawl-ref-e19fa701fad8b44cc1e67a56c6402855838d758b.tar.gz
crawl-ref-e19fa701fad8b44cc1e67a56c6402855838d758b.zip
Let LTO=y support clang.
Beware, I haven't seen a single successful build yet. Versions of clang prior to 3.3, including 3.3 without a recent patch, fail early, while current 3.3 swapped for hours before OOMing (8GB ram + 6GB swap). In comparison, gcc-4.7 on 256MB raspi swaps for 124 minutes before succeeding. But hey, it's still a step forward.
Diffstat (limited to 'crawl-ref/source/Makefile')
-rw-r--r--crawl-ref/source/Makefile14
1 files changed, 10 insertions, 4 deletions
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index 3a11feb772..fd0d812e99 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -534,10 +534,16 @@ else
endif
ifdef LTO
-CFOPTIMIZE += -flto=jobserver -fwhole-program
- # FIXME: this check is fragile, and should be done via a full compile test.
- ifeq ($(shell $(GXX) -x c++ /dev/null -fno-fat-lto-objects 2>&1 | grep 'unrecognized command line option'),)
- CFOPTIMIZE += -fno-fat-lto-objects
+ ifeq ($(shell $(GXX) -v 2>&1|grep clang),)
+ CFOPTIMIZE += -flto=jobserver -fwhole-program
+ # FIXME: this check is fragile, and should be done via a full compile test.
+ ifeq ($(shell $(GXX) -x c++ /dev/null -fno-fat-lto-objects 2>&1 | grep 'unrecognized command line option'),)
+ CFOPTIMIZE += -fno-fat-lto-objects
+ endif
+ else
+ # Clang uses a different syntax than gcc, using -O4 instead. This means
+ # you can't select a different level of optimization to go with LTO.
+ CFOPTIMIZE := $(patsubst -O%,,$(CFOPTIMIZE)) -O4
endif
endif