summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/Makefile
diff options
context:
space:
mode:
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