forked from lix-project/lix
Allow libraries to set an actual name different from the symbolic name
This commit is contained in:
parent
abb5bd66de
commit
f267ff16b4
13
Makefile.lib
13
Makefile.lib
|
@ -51,6 +51,7 @@ endif
|
||||||
libs_list :=
|
libs_list :=
|
||||||
|
|
||||||
define LIBS_template =
|
define LIBS_template =
|
||||||
|
$(1)_NAME ?= $(1)
|
||||||
_d := $$(strip $$($(1)_DIR))
|
_d := $$(strip $$($(1)_DIR))
|
||||||
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
|
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
|
||||||
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
||||||
|
@ -65,16 +66,16 @@ define LIBS_template =
|
||||||
$(1)_LDFLAGS += -z defs
|
$(1)_LDFLAGS += -z defs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(1)_PATH := $$(_d)/$(1).so
|
$(1)_PATH := $$(_d)/$$($(1)_NAME).so
|
||||||
|
|
||||||
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
|
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
|
||||||
$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
|
$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
|
||||||
|
|
||||||
$(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $(1)))
|
$(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
|
||||||
|
|
||||||
$(1)_INSTALL_DIR := $$(pkglibdir)
|
$(1)_INSTALL_DIR := $$(pkglibdir)
|
||||||
|
|
||||||
$(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$(1).so
|
$(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME).so
|
||||||
|
|
||||||
_libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
|
_libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
|
||||||
|
|
||||||
|
@ -82,18 +83,18 @@ define LIBS_template =
|
||||||
install -d $$($(1)_INSTALL_DIR)
|
install -d $$($(1)_INSTALL_DIR)
|
||||||
$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
||||||
|
|
||||||
$(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $(1)))
|
$(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
$(1)_PATH := $$(_d)/$(1).a
|
$(1)_PATH := $$(_d)/$$($(1)_NAME).a
|
||||||
|
|
||||||
$$($(1)_PATH): $$($(1)_OBJS)
|
$$($(1)_PATH): $$($(1)_OBJS)
|
||||||
$(QUIET) ar crs $$@ $$?
|
$(QUIET) ar crs $$@ $$?
|
||||||
|
|
||||||
$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
|
$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
|
||||||
|
|
||||||
$(1)_INSTALL_PATH := $$(pkglibdir)/$(1).a
|
$(1)_INSTALL_PATH := $$(pkglibdir)/$$($(1)_NAME).a
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue