From c0aa07cd0d0b527f9f37a48737880d9cf0bbf566 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Mon, 19 Oct 2009 13:21:13 -0700 Subject: 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 --- crawl-ref/source/makefile | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/makefile') 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) -- cgit v1.2.3-54-g00ecf