diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | makefiles/Makefile.clang | 7 | ||||
-rw-r--r-- | makefiles/Makefile.gcc | 22 | ||||
-rw-r--r-- | makefiles/Makefile.tools | 31 | ||||
-rw-r--r-- | makefiles/Makefile.top | 32 |
5 files changed, 74 insertions, 20 deletions
@@ -6,7 +6,7 @@ # Component settings COMPONENT := buildsystem -COMPONENT_VERSION := 1.8 +COMPONENT_VERSION := 1.10 .PHONY:all usage install dist clean distclean test diff --git a/makefiles/Makefile.clang b/makefiles/Makefile.clang index 50f8a82..bcd14e3 100644 --- a/makefiles/Makefile.clang +++ b/makefiles/Makefile.clang @@ -21,7 +21,12 @@ 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 diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc index b5119ac..0ce0d9b 100644 --- a/makefiles/Makefile.gcc +++ b/makefiles/Makefile.gcc @@ -20,7 +20,11 @@ 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 @@ -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 ############################################################################### diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools index d998953..40e4d10 100644 --- a/makefiles/Makefile.tools +++ b/makefiles/Makefile.tools @@ -158,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 @@ -276,7 +285,7 @@ GENHTML ?= genhtml BUILD_CXX ?= c++ -INSTALL ?= install +INSTALL ?= install -C LCOV ?= lcov @@ -468,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 ############################################################################### |