diff options
author | Steven Noonan <steven@uplinklabs.net> | 2009-10-19 13:21:13 -0700 |
---|---|---|
committer | Steven Noonan <steven@uplinklabs.net> | 2009-10-19 13:21:13 -0700 |
commit | c0aa07cd0d0b527f9f37a48737880d9cf0bbf566 (patch) | |
tree | 6fe129532f706df925e9bdddd4918ac8b451df74 /crawl-ref/source/makefile | |
parent | 272242196ea118997e330f4f578171e3ec8df2aa (diff) | |
download | crawl-ref-c0aa07cd0d0b527f9f37a48737880d9cf0bbf566.tar.gz crawl-ref-c0aa07cd0d0b527f9f37a48737880d9cf0bbf566.zip |
makefile: try to use full gcc compiler name when possible
This assists both distcc and ccache in doing their jobs properly.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/makefile')
-rw-r--r-- | crawl-ref/source/makefile | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index 31895d9add..e4ea453a0a 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -183,18 +183,35 @@ CXX = $(GXX) $(ARCHS) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER) endif # MacOS ifndef CROSSHOST + ifneq ($(GCC_VER),) -GCC := gcc-$(GCC_VER) -GXX := g++-$(GCC_VER) -else -GCC := gcc -GXX := g++ +# We do this in a separate variable because if we +# specify GCC_VER on the make command-line, the +# variable is immutable, and we can't add the dash. +GCC_VER_SUFFIX:=-$(GCC_VER) +endif + +# Attempt to use a full compiler name, to make +# distcc builds work nicely. +LMACH := $(shell gcc -dumpmachine)- +ifeq ($(LMACH),-) +LMACH := +endif +ifeq ($(shell which $(LMACH)gcc$(GCC_VER_SUFFIX) 2> /dev/null),) +LMACH := endif + +GCC := $(LMACH)gcc$(GCC_VER_SUFFIX) +GXX := $(LMACH)g++$(GCC_VER_SUFFIX) + else + +# Cross-compiling is a weird case. GCC := $(CROSSHOST)-gcc GXX := $(CROSSHOST)-g++ AR := $(CROSSHOST)-ar RANLIB := $(CROSSHOST)-ranlib + endif GCC_GTE_4_0_0 := $(shell util/gcc-gte.pl $(GCC) 4.0.0) GCC_GTE_4_3_0 := $(shell util/gcc-gte.pl $(GCC) 4.3.0) |