Commit 51f761a1 authored by Ben Avison's avatar Ben Avison Committed by ROOL
Browse files

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.
parent bc6cf22d
...@@ -25,6 +25,7 @@ INCLUDED_CLIBRARY = YES ...@@ -25,6 +25,7 @@ INCLUDED_CLIBRARY = YES
# DIRS (opt) (stamp object for directory creation - otherwise _dirs) # DIRS (opt) (stamp object for directory creation - otherwise _dirs)
# HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET}) # HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET})
# ASMHDRS (opt) (assembly header files to export, no Hdr. prefix - otherwise none) # 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) # OBJS (object files, no o. or oz. prefixes)
# DBG_OBJS (opt) (debug build object files, no o. or oz. prefixes - otherwise ${OBJS}) # 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}) # 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}) ...@@ -96,6 +97,7 @@ MOD_DBG_OBJS_ = $(addsuffix .odz,${MOD_DBG_OBJS})
EXPORTING_HDRS = $(addsuffix .exphdr,${HDRS}) EXPORTING_HDRS = $(addsuffix .exphdr,${HDRS})
EXPORTING_ASMHDRS = $(addsuffix .expasm,${ASMHDRS}) EXPORTING_ASMHDRS = $(addsuffix .expasm,${ASMHDRS})
EXPORTS ?= ${EXPORTING_HDRS} ${EXPORTING_ASMHDRS}
EXPORTING_LIBS = $(addsuffix .explib,${LIBRARIES}) EXPORTING_LIBS = $(addsuffix .explib,${LIBRARIES})
TARGET_LIBS = $(addsuffix .${LIBEXT},${LIBRARIES}) TARGET_LIBS = $(addsuffix .${LIBEXT},${LIBRARIES})
...@@ -185,7 +187,7 @@ create_exp_lib_dir: ...@@ -185,7 +187,7 @@ create_exp_lib_dir:
.Hdr.expasm:; ${CP} $< ${EXPDIR}/$* ${CPFLAGS} .Hdr.expasm:; ${CP} $< ${EXPDIR}/$* ${CPFLAGS}
.${LIBEXT}.explib:; ${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} [ ! -f ../VersionNum ] || ${CP} ../VersionNum ${EXPDIR}/LibVersion ${CPFLAGS}
@${ECHO} ${COMPONENT}: header export complete @${ECHO} ${COMPONENT}: header export complete
......
...@@ -41,6 +41,7 @@ INCLUDED_CLIBRARY = YES ...@@ -41,6 +41,7 @@ INCLUDED_CLIBRARY = YES
# DIRS (opt) (stamp object for directory creation - otherwise o._dirs) # DIRS (opt) (stamp object for directory creation - otherwise o._dirs)
# HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET}) # HDRS (opt) (header files to export, no h. prefix - otherwise ${TARGET})
# ASMHDRS (opt) (assembly header files to export, no Hdr. prefix - otherwise none) # 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) # OBJS (object files, no o. or oz. prefixes)
# DBG_OBJS (opt) (debug build object files, no o. or oz. prefixes - otherwise ${OBJS}) # 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}) # 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}) ...@@ -111,6 +112,7 @@ MOD_DBG_OBJS_ = $(addprefix odz.,${MOD_DBG_OBJS})
EXPORTING_HDRS = $(addprefix exphdr.,${HDRS}) EXPORTING_HDRS = $(addprefix exphdr.,${HDRS})
EXPORTING_ASMHDRS = $(addprefix expasm.,${ASMHDRS}) EXPORTING_ASMHDRS = $(addprefix expasm.,${ASMHDRS})
EXPORTS ?= ${EXPORTING_ASMHDRS} ${EXPORTING_HDRS}
EXPORTING_LIBS = $(addprefix explib.,${LIBRARIES}) EXPORTING_LIBS = $(addprefix explib.,${LIBRARIES})
TARGET_LIBS = $(addprefix ${LIBEXT}.,${LIBRARIES}) TARGET_LIBS = $(addprefix ${LIBEXT}.,${LIBRARIES})
...@@ -173,7 +175,7 @@ create_exp_lib_dir: ...@@ -173,7 +175,7 @@ create_exp_lib_dir:
.Hdr.expasm:; ${CP} $< ${EXPDIR}.$< ${CPFLAGS} .Hdr.expasm:; ${CP} $< ${EXPDIR}.$< ${CPFLAGS}
.${LIBEXT}.explib:; ${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 ${ECHO} ${CP} VersionNum ${EXPDIR}.LibVersion ${CPFLAGS}
@IfThere VersionNum then ${CP} VersionNum ${EXPDIR}.LibVersion ${CPFLAGS} @IfThere VersionNum then ${CP} VersionNum ${EXPDIR}.LibVersion ${CPFLAGS}
@IfThere ${EXPDIR}.h.* then else ${RM} ${EXPDIR}.h @IfThere ${EXPDIR}.h.* then else ${RM} ${EXPDIR}.h
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment