diff options
Diffstat (limited to 'makefiles/Makefile.gcc')
-rw-r--r-- | makefiles/Makefile.gcc | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc index 5f2bd4d..0ce0d9b 100644 --- a/makefiles/Makefile.gcc +++ b/makefiles/Makefile.gcc @@ -20,12 +20,16 @@ CXXSHR := -fPIC LDDBG := -g # Reevaluation is required here -LDSHR = -shared -Wl,-soname,$(SONAME) +ifeq ($(findstring darwin,$(HOST)),darwin) + LDSHR = -dynamiclib -install_name $(SONAME) +else + LDSHR = -shared -Wl,-soname,$(SONAME) +endif ARFLG := cru # Definitions for various attributes -CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))" +CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))" -DSTMTEXPR=1 # Extensions for coverage target ifeq ($(MAKECMDGOALS),coverage) @@ -49,10 +53,24 @@ ifeq ($(MAKECMDGOALS),profile) LDFLAGS := $(LDFLAGS) $(PROFLDFLAGS) endif +# Extensions for sanitize target +ifeq ($(MAKECMDGOALS),sanitize) + SANCFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover + SANCXXFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover + SANLDFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover + + CFLAGS := $(CFLAGS) $(SANCFLAGS) + CXXFLAGS := $(CXXFLAGS) $(SANCXXFLAGS) + LDFLAGS := $(LDFLAGS) $(SANLDFLAGS) +endif + # RISC OS module extensions ifeq ($(COMPONENT_TYPE),riscos-module) ifneq ($(HOST),arm-unknown-riscos) - $(error Attempting to build a RISC OS module for a non-RISC OS target) + # Note: this also rejects the gnueabi(hf) RISC OS hosts, too, as the + # tooling for those is not able to generate code compatible with RISC OS + # module environments. + $(error Attempting to build a RISC OS module for a non-RISC OS host) endif CFLAGS := $(CFLAGS) -mmodule @@ -60,6 +78,17 @@ ifeq ($(COMPONENT_TYPE),riscos-module) LDFLAGS := $(LDFLAGS) -mmodule endif +# RISC OS backtrace extensions +ifneq ($(findstring -riscos,$(HOST)),) + CFLAGS := $(CFLAGS) -mpoke-function-name + CXXFLAGS := $(CXXFLAGS) -mpoke-function-name + ifneq ($(findstring -gnueabi,$(HOST)),) + # Note: this assumes we're not generating RISC OS module code (see above) + CFLAGS := $(CFLAGS) -funwind-tables + CXXFLAGS := $(CXXFLAGS) -funwind-tables + endif +endif + ############################################################################### # Mac OS X Universal Binaries ############################################################################### @@ -82,7 +111,7 @@ endif ############################################################################### # Determine if the compiler supports simultaneous build & dep. -ccvsn := $(shell $(CC) -dumpversion) +ccvsn := $(shell $(CC) -dumpversion -dumpfullversion) # ccvsn = x.y.z GCCVER := $(word 1,$(subst ., ,$(ccvsn))) # GCCVER = x |