diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | citools/jenkins-build.sh | 4 | ||||
-rw-r--r-- | makefiles/Makefile.clang | 9 | ||||
-rw-r--r-- | makefiles/Makefile.gcc | 26 | ||||
-rw-r--r-- | makefiles/Makefile.open64 | 2 | ||||
-rw-r--r-- | makefiles/Makefile.tools | 61 | ||||
-rw-r--r-- | makefiles/Makefile.top | 32 |
7 files changed, 104 insertions, 32 deletions
@@ -6,7 +6,7 @@ # Component settings COMPONENT := buildsystem -COMPONENT_VERSION := 1.6 +COMPONENT_VERSION := 1.10 .PHONY:all usage install dist clean distclean test diff --git a/citools/jenkins-build.sh b/citools/jenkins-build.sh index 8a5fed3..2da910e 100755 --- a/citools/jenkins-build.sh +++ b/citools/jenkins-build.sh @@ -137,6 +137,10 @@ case ${BUILD} in MAKE=gmake ;; + x86_64-unknown-openbsd*) + MAKE=gmake + ;; + x86_64-unknown-freebsd*) MAKE=gmake ;; diff --git a/makefiles/Makefile.clang b/makefiles/Makefile.clang index 2a11a5b..bcd14e3 100644 --- a/makefiles/Makefile.clang +++ b/makefiles/Makefile.clang @@ -21,12 +21,17 @@ 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 of various attributes -CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))" +CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))" -DSTMTEXPR=1 # Extensions for sanitize target ifeq ($(MAKECMDGOALS),sanitize) diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc index 6ca7ba1..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) @@ -63,7 +67,10 @@ 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 @@ -71,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 ############################################################################### @@ -93,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 diff --git a/makefiles/Makefile.open64 b/makefiles/Makefile.open64 index b58569c..142474a 100644 --- a/makefiles/Makefile.open64 +++ b/makefiles/Makefile.open64 @@ -27,7 +27,7 @@ LDFLAGS := $(LDFLAGS) -ipa 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) diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools index 33d6add..40e4d10 100644 --- a/makefiles/Makefile.tools +++ b/makefiles/Makefile.tools @@ -121,12 +121,17 @@ ifeq ($(BUILD),$(HOST)) else # Cross compiling - # Make first-stab at identity of CC - CC__ := $(CC) - # Improve our guess at the identity of CC - # (only if CC was not specified by the user) - ifeq ($(origin CC),default) - CC__ := $(HOST)-gcc + ifneq ($(NS_ENV_CC),) + # If we have a CC specified by env.sh, start with that + CC__ := $(NS_ENV_CC) + else + # Make first-stab at identity of CC + CC__ := $(CC) + # Improve our guess at the identity of CC + # (only if CC was not specified by the user) + ifeq ($(origin CC),default) + CC__ := $(HOST)-gcc + endif endif # Search the path for the compiler @@ -139,7 +144,7 @@ else else CC__ := $(realpath $(toolpath_)) toolpath_ := $(dir $(CC__)) - toolprefix_ := $(subst :,/,$(dir $(subst -,/,$(subst /,:,$(CC__))))) + toolprefix_ := $(subst :,/,$(subst /,-,$(patsubst %/,%,$(dir $(subst -,/,$(subst /,:,$(CC__))))))) ifeq ($(origin AR),default) AR__ := $(toolprefix_)-ar endif @@ -153,26 +158,35 @@ else GCCSDK_INSTALL_ENV := $(realpath $(toolpath_)../../env) endif - ifeq ($(HOST),arm-unknown-riscos) + ifeq ($(findstring -riscos,$(HOST)),-riscos) # Cross compiling for RISC OS - CMHG ?= PATH="$(GCCSDK_INSTALL_CROSSBIN):$(PATH)" $(GCCSDK_INSTALL_CROSSBIN)/cmunge + ifeq ($(findstring gnueabi,$(HOST)),gnueabi) + # Can't build modules with this [arm-riscos-gnueabi(hf)] toolchain + CMHG ?= echo + else + CMHG ?= PATH="$(GCCSDK_INSTALL_CROSSBIN):$(PATH)" $(GCCSDK_INSTALL_CROSSBIN)/cmunge + endif GENHTML ?= echo LCOV ?= echo PKGCONFIG ?= PKG_CONFIG_LIBDIR="$(PREFIX)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/lib/pkgconfig:$(GCCSDK_INSTALL_ENV)/share/pkgconfig" pkg-config ifneq ($(COMPONENT_TYPE),riscos-module) + EXEEXT := ,ff8 ifneq ($(findstring arm-unknown-riscos-gcc,$(CC__)),) EXEEXT := ,e1f - else - EXEEXT := ,ff8 + endif + ifneq ($(findstring arm-riscos-gnueabi-gcc,$(CC__)),) + EXEEXT := ,e1f + endif + ifneq ($(findstring arm-riscos-gnueabihf-gcc,$(CC__)),) + EXEEXT := ,e1f endif else EXEEXT := ,ffa endif - # TODO: this assumes GCC - CFLAGS := $(CFLAGS) -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include - CXXFLAGS := $(CXXFLAGS) -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include + CFLAGS := $(CFLAGS) -I$(GCCSDK_INSTALL_ENV)/include + CXXFLAGS := $(CXXFLAGS) -I$(GCCSDK_INSTALL_ENV)/include LDFLAGS := $(LDFLAGS) -L$(GCCSDK_INSTALL_ENV)/lib CMHGFLAGS := -p -tgcc -32bit -apcs 3/32/nonreent/fpe2/noswst/nofpr/nofp @@ -206,6 +220,10 @@ else CXXFLAGS := $(CXXFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include LDFLAGS := $(LDFLAGS) -L$(GCCSDK_INSTALL_ENV)/lib + ifeq ($(HOST),m68k-unknown-amigaos) + CFLAGS += -fomit-frame-pointer -m68020 + endif + PREFIX ?= $(GCCSDK_INSTALL_ENV) endif @@ -267,7 +285,7 @@ GENHTML ?= genhtml BUILD_CXX ?= c++ -INSTALL ?= install +INSTALL ?= install -C LCOV ?= lcov @@ -369,6 +387,11 @@ else endif endif + ifeq ($(findstring lcc:,$(ccvsn)),lcc:) + # MCST LCC pretends to be gcc + toolchain := gcc + endif + # "Norcroft ..." ifeq ($(word 1,$(ccvsn)),Norcroft) toolchain := norcroft @@ -402,7 +425,7 @@ endif # Detect if the toolchain ought to support sanitizers SANITIZE_OK=no ifeq ($(toolchain),gcc) - GCC_VERSION := $(shell $(CC) -dumpversion) + GCC_VERSION := $(shell $(CC) -dumpversion -dumpfullversion) GCC_MAJOR := $(word 1,$(subst ., ,$(GCC_VERSION))) ifeq ($(shell expr $(GCC_MAJOR) \>= 6),1) SANITIZE_OK=yes @@ -454,7 +477,11 @@ LDFLAGS := $(LDFLAGS) $(OPTLDFLAGS) ifeq ($(COMPONENT_TYPE),lib-static) LIBEXT ?= .a else - LIBEXT ?= .so + ifeq ($(findstring darwin,$(HOST)),darwin) + LIBEXT ?= .dylib + else + LIBEXT ?= .so + endif endif # If we're building a shared library, modify the flags appropriately diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top index caac166..c1a8490 100644 --- a/makefiles/Makefile.top +++ b/makefiles/Makefile.top @@ -189,9 +189,17 @@ endif # Determine the output filename ifeq ($(findstring lib,$(COMPONENT_TYPE)),lib) ifeq ($(findstring lib-shared,$(COMPONENT_TYPE)),lib-shared) - SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) - SONAME := $(SHAREDLIBNAME).$(major-version) - OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION) + ifeq ($(findstring darwin,$(HOST)),darwin) + # In macOS, shared lib filenames are of the form libfoo.dylib, + # libfoo.1.dylib, or libfoo.1.2.3.dylib + SONAME := lib$(COMPONENT).$(major-version)$(LIBEXT) + SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) + OUTPUT := $(BUILDDIR)/lib$(COMPONENT).$(COMPONENT_VERSION)$(LIBEXT) + else + SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) + SONAME := $(SHAREDLIBNAME).$(major-version) + OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION) + endif else OUTPUT := $(BUILDDIR)/lib$(COMPONENT)$(LIBEXT) endif @@ -208,10 +216,6 @@ endif ifeq ($(COMPONENT_TYPE),lib-shared) POST_TARGETS := __postshared $(POST_TARGETS) - -__postshared: - $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SONAME) - $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SHAREDLIBNAME) endif # Default target @@ -221,6 +225,10 @@ all: $(PRE_TARGETS) $(OUTPUT) $(POST_TARGETS) test: all $(TEST_PREREQS) $(TEST_BINARIES) $(TEST_TARGETS) $(VQ)$(ECHO) $(ECHOFLAGS) " TEST: Testing complete" +__postshared: + $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SONAME) + $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SHAREDLIBNAME) + # Compute coverage __precov: __partial_clean $(Q)$(LCOV) --directory . --zerocounters @@ -414,6 +422,16 @@ else endif endif +ifneq ($(PRE_TARGETS),) +# Ensure that PRE_TARGETS are built before OBJECTS. +$(OBJECTS): $(PRE_TARGETS) +endif + +ifneq ($(POST_TARGETS),) +# Ensure that POST_TARGETS are built after OBJECTS. +$(POST_TARGETS): $(OBJECTS) +endif + ############################################################################### # Autogenerated, implied rules ############################################################################### |