From 51f761a1c8c740433e8eb6ca8c531645c590e507 Mon Sep 17 00:00:00 2001 From: Ben Avison <bavison@riscosopen.org> Date: Mon, 3 Jun 2019 21:42:39 +0100 Subject: [PATCH] Allow components using CLibrary shared Makefile to specify additional exports Occasionally, a library needs to export additional files that don't live in either an h or hdr directory and (when cross compiling) shouldn't have a .h suffix added to their exported version. A typical example would be where the licence conditions of the library require a licence header to be attached to all copies. To achieve this, CLibrary now uses EXPORTS in a similar manner to how AAsmModule does, simply as a dependency of export_hdrs, which can expand to any additional targets you need to define. By default, it overrides the internal targets EXPORTING_HDRS and EXPORTING_ASMHDRS (derived from HDRS and ASMHDRS supplied by the master makefile), but you can always include them in your definition of EXPORTS if desired. --- GNUmakefiles/CLibrary | 4 +++- Makefiles/CLibrary | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/GNUmakefiles/CLibrary b/GNUmakefiles/CLibrary index 50364c5..f76d968 100644 --- a/GNUmakefiles/CLibrary +++ b/GNUmakefiles/CLibrary @@ -25,6 +25,7 @@ INCLUDED_CLIBRARY = YES # DIRS (opt) (stamp object for directory creation - otherwise _dirs) # HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET}) # ASMHDRS (opt) (assembly header files to export, no Hdr. prefix - otherwise none) +# EXPORTS (opt) (dependencies for export_hdrs phase - otherwise deduced from ${HDRS} and ${ASMHDRS}) # OBJS (object files, no o. or oz. prefixes) # DBG_OBJS (opt) (debug build object files, no o. or oz. prefixes - otherwise ${OBJS}) # APP_OBJS (opt) (release application object files, no o. or oz. prefixes - otherwise ${OBJS}) @@ -96,6 +97,7 @@ MOD_DBG_OBJS_ = $(addsuffix .odz,${MOD_DBG_OBJS}) EXPORTING_HDRS = $(addsuffix .exphdr,${HDRS}) EXPORTING_ASMHDRS = $(addsuffix .expasm,${ASMHDRS}) +EXPORTS ?= ${EXPORTING_HDRS} ${EXPORTING_ASMHDRS} EXPORTING_LIBS = $(addsuffix .explib,${LIBRARIES}) TARGET_LIBS = $(addsuffix .${LIBEXT},${LIBRARIES}) @@ -185,7 +187,7 @@ create_exp_lib_dir: .Hdr.expasm:; ${CP} $< ${EXPDIR}/$* ${CPFLAGS} .${LIBEXT}.explib:; ${CP} $< ${EXPDIR}/$< ${CPFLAGS} -export_hdrs: create_exp_hdr_dirs ${DIRS} ${EXPORTING_ASMHDRS} ${EXPORTING_HDRS} +export_hdrs: create_exp_hdr_dirs ${DIRS} ${EXPORTS} [ ! -f ../VersionNum ] || ${CP} ../VersionNum ${EXPDIR}/LibVersion ${CPFLAGS} @${ECHO} ${COMPONENT}: header export complete diff --git a/Makefiles/CLibrary b/Makefiles/CLibrary index 3b164c2..0adbafc 100644 --- a/Makefiles/CLibrary +++ b/Makefiles/CLibrary @@ -41,6 +41,7 @@ INCLUDED_CLIBRARY = YES # DIRS (opt) (stamp object for directory creation - otherwise o._dirs) # HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET}) # ASMHDRS (opt) (assembly header files to export, no Hdr. prefix - otherwise none) +# EXPORTS (opt) (dependencies for export_hdrs phase - otherwise deduced from ${HDRS} and ${ASMHDRS}) # OBJS (object files, no o. or oz. prefixes) # DBG_OBJS (opt) (debug build object files, no o. or oz. prefixes - otherwise ${OBJS}) # APP_OBJS (opt) (release application object files, no o. or oz. prefixes - otherwise ${OBJS}) @@ -111,6 +112,7 @@ MOD_DBG_OBJS_ = $(addprefix odz.,${MOD_DBG_OBJS}) EXPORTING_HDRS = $(addprefix exphdr.,${HDRS}) EXPORTING_ASMHDRS = $(addprefix expasm.,${ASMHDRS}) +EXPORTS ?= ${EXPORTING_ASMHDRS} ${EXPORTING_HDRS} EXPORTING_LIBS = $(addprefix explib.,${LIBRARIES}) TARGET_LIBS = $(addprefix ${LIBEXT}.,${LIBRARIES}) @@ -173,7 +175,7 @@ create_exp_lib_dir: .Hdr.expasm:; ${CP} $< ${EXPDIR}.$< ${CPFLAGS} .${LIBEXT}.explib:; ${CP} $< ${EXPDIR}.$< ${CPFLAGS} -export_hdrs: ${EXPORTING_ASMHDRS} ${EXPORTING_HDRS} ${DIRS} create_exp_hdr_dirs +export_hdrs: ${EXPORTS} ${DIRS} create_exp_hdr_dirs @IfThere VersionNum then ${ECHO} ${CP} VersionNum ${EXPDIR}.LibVersion ${CPFLAGS} @IfThere VersionNum then ${CP} VersionNum ${EXPDIR}.LibVersion ${CPFLAGS} @IfThere ${EXPDIR}.h.* then else ${RM} ${EXPDIR}.h -- GitLab