add target_extlibs variable to build system

This commit is contained in:
Günter Obiltschnig 2018-02-21 12:40:44 +01:00
parent bdc1e81833
commit db1ee417ab
4 changed files with 49 additions and 10 deletions

View File

@ -27,6 +27,7 @@ DYLIB_S_RELEASE = $(BINPATH)/static/$(target)$(SHL_EXT)
TARGET_LIBS_DEBUG = $(foreach l,$(target_libs),-l$(l)d)
TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l))
TARGET_LIBS_EXT = $(foreach l,$(target_extlibs),-l$(l))
#
# Include the compile rules
@ -51,22 +52,22 @@ shared_release: bindirs $(DYLIB_RELEASE)
$(DYLIB_DEBUG): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o)
@echo "** Building dynamic library (debug, shared)" $@
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(postbuild)
$(DYLIB_RELEASE): $(foreach o,$(objects),$(OBJPATH_RELEASE_SHARED)/$(o).o)
@echo "** Building dynamic library (release, shared)" $@
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(postbuild)
$(DYLIB_S_DEBUG): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o)
@echo "** Building dynamic library (debug, static)" $@
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(postbuild)
$(DYLIB_S_RELEASE): $(foreach o,$(objects),$(OBJPATH_RELEASE_SHARED)/$(o).o)
@echo "** Building dynamic library (release, static)" $@
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(DYLIB) $(DYLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(postbuild)
#

View File

@ -14,6 +14,7 @@ EXEC_DEBUG_SHARED = $(BINPATH)/$(target)d$(BINEXT)
TARGET_LIBS_DEBUG = $(foreach l,$(target_libs),-l$(l)d)
TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l))
TARGET_LIBS_EXT = $(foreach l,$(target_extlibs),-l$(l))
#
# Include the compile rules
@ -39,23 +40,23 @@ shared_release: bindirs $(EXEC_RELEASE_SHARED)
$(EXEC_DEBUG_STATIC): $(foreach o,$(objects),$(OBJPATH_DEBUG_STATIC)/$(o).o)
@echo "** Building executable (debug)" $@
$(LINK) $(LINKFLAGS) $(DEBUGOPT_LINK) $(STATICOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(LINK) $(LINKFLAGS) $(DEBUGOPT_LINK) $(STATICOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_EXT) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(postbuild)
$(EXEC_RELEASE_STATIC): $(foreach o,$(objects),$(OBJPATH_RELEASE_STATIC)/$(o).o)
@echo "** Building executable (release)" $@
$(LINK) $(LINKFLAGS) $(RELEASEOPT_LINK) $(STATICOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(LINK) $(LINKFLAGS) $(RELEASEOPT_LINK) $(STATICOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_EXT) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(STRIPCMD)
$(postbuild)
$(EXEC_DEBUG_SHARED): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o)
@echo "** Building shared executable (debug)" $@
$(LINK) $(LINKFLAGS) $(DEBUGOPT_LINK) $(SHAREDOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(LINK) $(LINKFLAGS) $(DEBUGOPT_LINK) $(SHAREDOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(postbuild)
$(EXEC_RELEASE_SHARED): $(foreach o,$(objects),$(OBJPATH_RELEASE_SHARED)/$(o).o)
@echo "** Building shared executable (release)" $@
$(LINK) $(LINKFLAGS) $(RELEASEOPT_LINK) $(SHAREDOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(LINK) $(LINKFLAGS) $(RELEASEOPT_LINK) $(SHAREDOPT_LINK) -o $@ $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(TARGET_LIBS_EXT) $(SYSLIBS)
$(STRIPCMD)
$(postbuild)

View File

@ -31,6 +31,7 @@ endif
TARGET_LIBS_DEBUG = $(foreach l,$(target_libs),-l$(l)d)
TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l))
TARGET_LIBS_EXT = $(foreach l,$(target_extlibs),-l$(l))
#
# Include the compile rules
@ -68,7 +69,7 @@ $(LIB_RELEASE_STATIC): $(foreach o,$(objects),$(OBJPATH_RELEASE_STATIC)/$(o).o)
$(LIB_DEBUG_SHARED): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o)
@echo "** Building shared library (debug)" $@
$(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS)
$(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(TARGET_LIBS_EXT) $(SYSLIBS)
ifeq ($(OSNAME), Cygwin)
$(SHLIBLN) $(IMP_DEBUG_SHARED) $(IMP_DEBUG_SHARED_LINK)
endif
@ -77,7 +78,7 @@ endif
$(LIB_RELEASE_SHARED): $(foreach o,$(objects),$(OBJPATH_RELEASE_SHARED)/$(o).o)
@echo "** Building shared library (release)" $@
$(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS)
$(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(TARGET_LIBS_EXT) $(SYSLIBS)
ifeq ($(OSNAME), Cygwin)
$(SHLIBLN) $(IMP_RELEASE_SHARED) $(IMP_RELEASE_SHARED_LINK)
endif

View File

@ -302,6 +302,42 @@ The difference is the file that is included at the end of the Makefile:
!!!Build System Reference
!!Target Variables
!target
The <*target*> variable specifies the name of the resulting library or executable,
excluding the suffix.
!target_version
The <*target_version*> variable specifies the shared library version of the resulting
shared library.
!target_libs
The <*target_libs*> variable specifies all libraries that must be linked to the
target. These libraries must have been built with this build system and they
must follow the build system conventions, specifically, the names for debug
and release builds.
!target_extlibs
The <*target_extlibs*> variables specifies additional libraries that must be
linked to the target. No assumptions are made regarding debug or release builds.
The names given here are simply passed to the linker by prepending the <[-l]> flag.
!target_includes
The <*target_includes*> variable specifies a list of directories used for searching
header files.
!!Postbuild Command
A Makefile can contain a so-called postbuild command -- a shell command