diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-03-06 11:34:26 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-03-06 11:34:26 +0000 |
commit | 4fb5e74381515c01e164880e6023b08c40bb650a (patch) | |
tree | a0b8a3449d211bd4ca7f8139e68fcb5e6a6f5fa0 /makefiles/Makefile.gcc | |
parent | 4077b8b9e7940b515c054c5c22565e5b98c5df37 (diff) | |
download | buildsystem-4fb5e74381515c01e164880e6023b08c40bb650a.tar.gz buildsystem-4fb5e74381515c01e164880e6023b08c40bb650a.tar.bz2 |
Beginnings of support for multiple toolchains
svn path=/trunk/tools/buildsystem/; revision=10104
Diffstat (limited to 'makefiles/Makefile.gcc')
-rw-r--r-- | makefiles/Makefile.gcc | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc new file mode 100644 index 0000000..fa2660b --- /dev/null +++ b/makefiles/Makefile.gcc @@ -0,0 +1,81 @@ +# GCC specific toolchain setup +# We assume that we're using a standard GCC/binutils environment + +CCDEF := -D +CCOPT := -O2 +CCNOOPT := -O0 +CCDBG := -g +CCINC := -I +CCLIB := -L +CCAS := -xassembler-with-cpp +CCSHR := -fPIC + +CXXDEF := -D +CXXOPT := -O2 +CXXNOOPT := -O0 +CXXDBG := -g +CXXINC := -I +CXXLIB := -L +CXXSHR := -fPIC + +LDDBG := -g +# Reevaluation is required here +LDSHR = -shared -Wl,-soname,$(SONAME) + +ARFLG := cru + +# Extensions for coverage target +ifeq ($(MAKECMDGOALS),coverage) + COVCFLAGS ?= -fprofile-arcs -ftest-coverage + COVCXXFLAGS ?= -fprofile-arcs -ftest-coverage + COVLDFLAGS ?= -lgcov + + CFLAGS := $(CFLAGS) $(COVCFLAGS) + CXXFLAGS := $(CXXFLAGS) $(COVCXXFLAGS) + LDFLAGS := $(LDFLAGS) $(COVLDFLAGS) +endif + +# Extensions for profile target +ifeq ($(MAKECMDGOALS),profile) + PROFCFLAGS ?= -pg + PROFCXXFLAGS ?= -pg + PROFLDFLAGS ?= -pg + + CFLAGS := $(CFLAGS) $(PROFCFLAGS) + CXXFLAGS := $(CXXFLAGS) $(PROFCXXFLAGS) + LDFLAGS := $(LDFLAGS) $(PROFLDFLAGS) +endif + +# RISC OS module extensions +ifeq ($(COMPONENT_TYPE),riscos-module) + ifneq ($(TARGET),riscos) + $(error Attempting to build a RISC OS module for a non-RISC OS target) + endif + + CFLAGS := $(CFLAGS) -mmodule + CXXFLAGS := $(CXXFLAGS) -mmodule + LDFLAGS := $(LDFLAGS) -mmodule +endif + +############################################################################### +# Other settings +############################################################################### + +# Determine if the compiler supports simultaneous build & dep. +ccvsn := $(shell $(CC) --version) +# "<binary name> (GCC) x.y.z (foo bar baz)" +ifeq ($(word 2,$(ccvsn)),(GCC)) + # 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 + # Older versions of GCC just output the version number + GCCVER := $(word 1,$(subst ., ,$(ccvsn))) + ifneq ($(GCCVER),2) + CC_CAN_BUILD_AND_DEP ?= yes + endif +endif + |