Link subproject dynamic libraries correctly
This commit is contained in:
parent
5371ad5f99
commit
7568a58391
20
Makefile.in
20
Makefile.in
|
@ -99,7 +99,7 @@ comma := ,
|
|||
LD := $(CXX)
|
||||
LDFLAGS := @LDFLAGS@
|
||||
LIBS := @LIBS@
|
||||
LINK := $(LD) $(LDFLAGS) -Wl,-rpath,$(install_libs_dir) $(patsubst -L%,-Wl$(comma)-rpath$(comma),$(filter -L%,$(LDFLAGS)))
|
||||
LINK := $(LD) $(LDFLAGS) -Wl,-rpath,$(install_libs_dir) $(patsubst -L%,-Wl$(comma)-rpath$(comma)%,$(filter -L%,$(LDFLAGS)))
|
||||
|
||||
# Library creation
|
||||
|
||||
|
@ -195,19 +195,23 @@ $$($(2)_c_objs) : %.o : %.c $$($(2)_gen_hdrs)
|
|||
|
||||
$(2)_junk += $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs)
|
||||
|
||||
# Build a library for this subproject
|
||||
|
||||
lib$(1).so : $$($(2)_objs) $$($(2)_c_objs)
|
||||
$(CXX) -shared -o $$@ $(if $(filter Darwin,$(shell uname -s)),-install_name $(install_libs_dir)/$$@) $$^
|
||||
|
||||
$(2)_junk += lib$(1).so
|
||||
|
||||
# Reverse the dependency list so that a given subproject only depends on
|
||||
# subprojects listed to its right. This is the correct order for linking
|
||||
# the list of subproject libraries.
|
||||
|
||||
$(2)_reverse_deps := $$(call reverse_list,$$($(2)_subproject_deps))
|
||||
|
||||
# Build a library for this subproject
|
||||
|
||||
$(2)_lib_libs := $$($(2)_reverse_deps)
|
||||
$(2)_lib_libnames := $$(patsubst %, lib%.so, $$($(2)_lib_libs))
|
||||
$(2)_lib_libarg := -L. $$(patsubst %, -l%, $$($(2)_lib_libs))
|
||||
|
||||
lib$(1).so : $$($(2)_objs) $$($(2)_c_objs) $$($(2)_lib_libnames)
|
||||
$(LINK) -shared -o $$@ $(if $(filter Darwin,$(shell uname -s)),-install_name $(install_libs_dir)/$$@) $$^ $$($(2)_lib_libarg) $(LIBS)
|
||||
|
||||
$(2)_junk += lib$(1).so
|
||||
|
||||
# Build unit tests
|
||||
|
||||
$(2)_test_objs := $$(patsubst %.cc, %.o, $$($(2)_test_srcs))
|
||||
|
|
Loading…
Reference in New Issue