summaryrefslogtreecommitdiff
path: root/makefiles/Makefile.tools
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-06-20 11:11:53 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-06-20 11:11:53 +0000
commitcd1c230244b6beb1e36f6471a89efc50ce5f6308 (patch)
tree97c6aae1ed3a59c69363077f64b5f3009ab28e91 /makefiles/Makefile.tools
parentbd06b34383c2ffab55b3ad7a3ccf136b9f0596ee (diff)
downloadbuildsystem-cd1c230244b6beb1e36f6471a89efc50ce5f6308.tar.gz
buildsystem-cd1c230244b6beb1e36f6471a89efc50ce5f6308.tar.bz2
Auto-detect whether C compiler is GCC and, if it is, whether it supports simultaneous compilation and dependency generation.
Add canned rules for compilers that cannot calculate dependency information. svn path=/trunk/tools/buildsystem/; revision=7890
Diffstat (limited to 'makefiles/Makefile.tools')
-rw-r--r--makefiles/Makefile.tools45
1 files changed, 32 insertions, 13 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index 4244163..a758970 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -125,14 +125,11 @@ ifeq ($(TARGET),beos)
# No pkg-config
PKGCONFIG ?=
- GCCVER := 2
-
# Default prefix
PREFIX ?= /boot/home/config
else
ifeq ($(HOST),haiku)
# Building on Haiku
- GCCVER := 2
# Default prefix
PREFIX ?= /boot/common
@@ -249,16 +246,7 @@ ifeq ($(COMPONENT_TYPE),riscos-module)
endif
###############################################################################
-# Other settings
-###############################################################################
-
-# If GCC can cope with simultaneous build & dep, do that as it's faster
-ifneq ($(GCCVER),2)
- CC_CAN_BUILD_AND_DEP ?= yes
-endif
-
-###############################################################################
-# Finally, override defaulted tools
+# Override defaulted tools
###############################################################################
# CC
@@ -289,3 +277,34 @@ ifeq ($(origin AR),default)
endif
endif
+###############################################################################
+# Other settings
+###############################################################################
+
+# Determine if the compiler is GCC and if it supports simultaneous build & dep.
+ccvsn := $(shell $(CC) --version)
+ifeq ($(ccvsn),)
+ # Version string is blank
+ ifeq ($(HOST),riscos)
+ # For some reason we never see the output of SCL apps, so assume Norcroft.
+ ccvsn := Norcroft
+ else
+ # Give up
+ $(error Failed to determine compiler and version)
+ endif
+endif
+
+# "<binary name> (GCC) x.y.z (foo bar baz)"
+ifeq ($(word 2,$(ccvsn)),(GCC))
+ # Looks like GCC, look for version
+ # If the major version (x, above) is not 2, then assume build & dep.
+ # This will break if using a version of GCC < 2, but that's unlikely.
+ GCCVER := $(word 1,$(subst ., ,$(word 3, $(ccvsn))))
+ ifneq ($(GCCVER),2)
+ CC_CAN_BUILD_AND_DEP ?= yes
+ endif
+else
+ # Not GCC -- assume inability to dep
+ CC_CANNOT_DEP ?= yes
+endif
+