Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx>
---
common_lib/Makefile.am | 54 ++++++++++++++++++++++++++++++++++++++++++++++-
corosync.spec.in | 2 +
cts/agents/Makefile.am | 12 +++++-----
exec/Makefile.am | 6 ++--
lib/Makefile.am | 4 +-
pkgconfig/Makefile.am | 2 +-
test/Makefile.am | 5 ++-
tools/Makefile.am | 4 +-
8 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/common_lib/Makefile.am b/common_lib/Makefile.am
index 1732019..42fad27 100644
--- a/common_lib/Makefile.am
+++ b/common_lib/Makefile.am
@@ -29,15 +29,65 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
+# Functions
+uc=$(shell echo $1 | tr a-z A-Z)
+get_soname=$(if $($(call uc,$1)_SONAME),$($(call uc,$1)_SONAME),$(SONAME))
+get_major=$(firstword $(subst ., ,$(call get_soname,$1)))
+get_sharedlibs=$(foreach lib,$(SHARED_LIBS_SO:lib%.so=%),lib$(lib).so.$(call get_soname,$(lib)))
+get_sharedlibs_two=$(foreach lib,$(SHARED_LIBS_SO:lib%.so=%),lib$(lib).so.$(call get_major,$(lib)))
+get_linker_add=$(if $($(call uc,$1)_LINKER_ADD),$($(call uc,$1)_LINKER_ADD))
+
MAINTAINERCLEANFILES = Makefile.in
AM_CFLAGS = -fPIC
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-noinst_LIBRARIES = libcorosync_common.a
+lib_LIBRARIES = libcorosync_common.a
+SHARED_LIBS_SO = $(lib_LIBRARIES:%.a=%.so)
libcorosync_common_a_SOURCES = error_conversion.c
+if BUILD_DARWIN
+
+lib%.so: lib%.a $(LIBQB_LIBS)
+ $(CC) $(DARWIN_OPTS) $(call get_linker_add,$*) -Wl,-whole-archive $^ -Wl,-no-whole-archive -o $@
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
+
+else
+
+if BUILD_SOLARIS
+
+lib%.so.$(SONAME): lib%.a
+ $(LD) $(SOLARIS_OPTS) $(call get_linker_add,$*) -G -whole-archive $^ -no-whole-archive -o $@
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
+
+else
+
+lib%.so: lib%.a
+ $(CC) -shared -o $@.$(call get_soname,$*) \
+ -Wl,-soname=lib$*.so.$(call get_major,$*) \
+ -Wl,-whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS) $(LIBQB_LIBS) $(AM_LDFLAGS) $(call get_linker_add,$*)
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
+ ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
+
+endif
+
+endif
+
+all-local: $(get_explicit_sharedlibs) $(SHARED_LIBS_SO)
+ @echo Built shared libs
+
+install-exec-local:
+ $(INSTALL) -d $(DESTDIR)/$(libdir)
+ $(INSTALL) -m 755 $(get_sharedlibs) $(DESTDIR)/$(libdir)
+ $(CP) -a $(SHARED_LIBS_SO) $(get_sharedlibs_two) $(DESTDIR)/$(libdir)
+
+uninstall-local:
+ cd $(DESTDIR)/$(libdir)/ && \
+ rm -f $(get_sharedlibs) $(SHARED_LIBS_SO) $(get_sharedlibs_two)
+
clean-local:
- rm -f *.o *.a
+ rm -f *.o *.a *.so* *.da *.bb *.bbg
diff --git a/corosync.spec.in b/corosync.spec.in
index e944f2f..6757c3b 100644
--- a/corosync.spec.in
+++ b/corosync.spec.in
@@ -241,6 +241,7 @@ This package contains corosync libraries.
%{_libdir}/libvotequorum.so.*
%{_libdir}/libpload.so.*
%{_libdir}/libsam.so.*
+%{_libdir}/libcorosync_common.so.*
%post -n corosynclib -p /sbin/ldconfig
@@ -285,6 +286,7 @@ The Corosync Cluster Engine APIs.
%{_libdir}/libvotequorum.so
%{_libdir}/libpload.so
%{_libdir}/libsam.so
+%{_libdir}/libcorosync_common.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/cpg_*3*
%{_mandir}/man3/evs_*3*
diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am
index 5848b02..d9aaa84 100644
--- a/cts/agents/Makefile.am
+++ b/cts/agents/Makefile.am
@@ -49,16 +49,16 @@ endif
noinst_HEADERS = common_test_agent.h
cpg_test_agent_SOURCES = cpg_test_agent.c common_test_agent.c
-cpg_test_agent_LDADD = -lcpg -lcfg ../../exec/crypto.o $(LIBQB_LIBS)
-cpg_test_agent_LDFLAGS = -L../../lib -L.
+cpg_test_agent_LDADD = -lcpg -lcfg ../../exec/crypto.o -lcorosync_common $(LIBQB_LIBS)
+cpg_test_agent_LDFLAGS = -L../../lib -L. -L../../common_lib
sam_test_agent_SOURCES = sam_test_agent.c common_test_agent.c
-sam_test_agent_LDADD = -lsam -lquorum -lcmap $(LIBQB_LIBS)
-sam_test_agent_LDFLAGS = -L../../lib
+sam_test_agent_LDADD = -lsam -lquorum -lcmap -lcorosync_common $(LIBQB_LIBS)
+sam_test_agent_LDFLAGS = -L../../lib -L../../common_lib
votequorum_test_agent_SOURCES = votequorum_test_agent.c common_test_agent.c
-votequorum_test_agent_LDADD = -lvotequorum -lquorum $(LIBQB_LIBS)
-votequorum_test_agent_LDFLAGS = -L../../lib
+votequorum_test_agent_LDADD = -lvotequorum -lquorum -lcorosync_common $(LIBQB_LIBS)
+votequorum_test_agent_LDFLAGS = -L../../lib -L../../common_lib
clean-local:
rm -f *.o *.a *.so* *.da *.bb *.bbg
diff --git a/exec/Makefile.am b/exec/Makefile.am
index d4d83eb..07a77c5 100644
--- a/exec/Makefile.am
+++ b/exec/Makefile.am
@@ -52,9 +52,9 @@ corosync_SOURCES = evil.c vsf_ykd.c coroparse.c vsf_quorum.c syncv2.c \
votequorum.c wd.c util.c schedwrk.c main.c \
apidef.c quorum.c sync.c icmap.c timer.c \
ipc_glue.c service.c mainconfig.c totemconfig.c
-corosync_LDADD = -ltotem_pg ../common_lib/libcorosync_common.a $(LIBQB_LIBS) $(statgrab_LIBS)
-corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME) ../common_lib/libcorosync_common.a
-corosync_LDFLAGS = $(OS_DYFLAGS) -L./
+corosync_LDADD = -ltotem_pg -lcorosync_common $(LIBQB_LIBS) $(statgrab_LIBS)
+corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME) ../common_lib/libcorosync_common.so
+corosync_LDFLAGS = $(OS_DYFLAGS) -L./ -L../common_lib
TOTEM_OBJS = $(TOTEM_SRC:%.c=%.o)
LOGSYS_OBJS = $(LOGSYS_SRC:%.c=%.o)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 6744233..6ded330 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -42,7 +42,7 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CFLAGS = -fPIC
-AM_LDFLAGS = -lpthread
+AM_LDFLAGS = -lpthread -L../common_lib -lcorosync_common
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
@@ -89,7 +89,7 @@ lib%.so: lib%.a
$(CC) -shared -o $@.$(call get_soname,$*) \
-Wl,-soname=lib$*.so.$(call get_major,$*) \
-Wl,-version-script=$(srcdir)/lib$*.versions \
- -Wl,-whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS) $(LIBQB_LIBS) ../common_lib/libcorosync_common.a $(AM_LDFLAGS) $(call get_linker_add,$*)
+ -Wl,-whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS) $(LIBQB_LIBS) $(AM_LDFLAGS) $(call get_linker_add,$*)
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
index 238fd0d..50691ba 100644
--- a/pkgconfig/Makefile.am
+++ b/pkgconfig/Makefile.am
@@ -33,7 +33,7 @@ MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = libtemplate.pc.in corosync.pc.in
LIBS = cfg cpg evs pload quorum \
- totem_pg votequorum sam cmap
+ totem_pg votequorum sam cmap corosync_common
target_LIBS = $(LIBS:%=lib%.pc)
diff --git a/test/Makefile.am b/test/Makefile.am
index 178e711..ee64b9e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -38,6 +38,7 @@ noinst_PROGRAMS = testevs evsbench evsverify cpgverify testcpg testcpg2 cpgbenc
stress_cpgfdget stress_cpgcontext cpgbound testsam \
testcpgzc cpgbenchzc testzcgc stress_cpgzc
+
testevs_LDADD = -levs $(LIBQB_LIBS)
testevs_LDFLAGS = -L../lib
testcpg_LDADD = -lcpg $(LIBQB_LIBS)
@@ -70,8 +71,8 @@ evsbench_LDADD = -levs $(LIBQB_LIBS)
evsbench_LDFLAGS = -L../lib
cpgbench_LDADD = -lcpg $(LIBQB_LIBS)
cpgbench_LDFLAGS = -L../lib
-cpgbenchzc_LDADD = -lcpg $(LIBQB_LIBS)
-cpgbenchzc_LDFLAGS = -L../lib
+cpgbenchzc_LDADD = -lcpg -lcorosync_common $(LIBQB_LIBS)
+cpgbenchzc_LDFLAGS = -L../lib -L../common_lib
testsam_LDADD = -lsam -lcmap -lquorum $(LIBQB_LIBS)
testsam_LDFLAGS = -L../lib
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 921cd26..7021845 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -49,11 +49,11 @@ corosync-xmlproc: corosync-xmlproc.sh
EXTRA_DIST = $(bin_SCRIPTS) corosync-xmlproc.sh corosync-notifyd.sysconfig.example
+corosync_cmapctl_LDADD = -lcorosync_common -lcmap $(LIBQB_LIBS)
+corosync_cmapctl_LDFLAGS= -L../lib -L../common_lib
corosync_fplay_LDADD = $(LIBQB_LIBS)
corosync_pload_LDADD = -lpload $(LIBQB_LIBS)
corosync_pload_LDFLAGS = -L../lib
-corosync_cmapctl_LDADD = -lcmap $(LIBQB_LIBS)
-corosync_cmapctl_LDFLAGS= -L../lib
corosync_cfgtool_LDADD = -lcfg $(LIBQB_LIBS)
corosync_cfgtool_LDFLAGS= -L../lib
corosync_cpgtool_LDADD = -lcfg -lcpg $(LIBQB_LIBS)
--
1.7.7.6
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss
[Corosync Project]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]