[PATCH 02/21] build: use libtool for linking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 15113dd... e73a80d... M	Makefile.am
:100755 100755 83770a1... 35f44b3... M	autogen.sh
:100644 100644 663eef1... fe325de... M	common_lib/Makefile.am
:100644 100644 9578633... 5b9971f... M	configure.ac
:100644 100644 6e8bb6a... 0edc478... M	cts/agents/Makefile.am
:100644 100644 2f0adef... b9e077c... M	exec/Makefile.am
:100644 100644 9aabd0b... a9151cf... M	lib/Makefile.am
:100644 100644 7010c50... a7c3c63... M	test/Makefile.am
:100644 100644 6e689f6... 6abc972... M	tools/Makefile.am
 Makefile.am            |    8 +++-
 autogen.sh             |    2 +-
 common_lib/Makefile.am |   70 +++-----------------------------
 configure.ac           |   18 ++++-----
 cts/agents/Makefile.am |   61 +++++++++++++++++-----------
 exec/Makefile.am       |   84 ++++++++++----------------------------
 lib/Makefile.am        |  105 +++++++++++++++---------------------------------
 test/Makefile.am       |   59 ++++++++++----------------
 tools/Makefile.am      |   47 ++++++++++-----------
 9 files changed, 161 insertions(+), 293 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 15113dd..e73a80d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,9 +42,12 @@ EXTRA_DIST		= autogen.sh $(SPEC).in \
 
 AUTOMAKE_OPTIONS	= foreign
 
+ACLOCAL_AMFLAGS		= -I m4
+
 MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 configure depcomp \
 			  config.guess config.sub missing install-sh \
-			  autoheader automake autoconf test_lense.sh
+			  autoheader automake autoconf test_lense.sh \
+			  autoscan.log configure.scan ltmain.sh
 
 dist_doc_DATA		= LICENSE INSTALL README.recovery SECURITY TODO AUTHORS
 
@@ -188,3 +191,6 @@ gen-ChangeLog:
 _version:
 	cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i
 	$(MAKE) $(AM_MAKEFLAGS) Makefile
+
+maintainer-clean-local:
+	rm -rf m4
diff --git a/autogen.sh b/autogen.sh
index 83770a1..35f44b3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
-
+mkdir -p m4
 echo Building configuration system...
 autoreconf -i && echo Now run ./configure and make
diff --git a/common_lib/Makefile.am b/common_lib/Makefile.am
index 663eef1..fe325de 100644
--- a/common_lib/Makefile.am
+++ b/common_lib/Makefile.am
@@ -29,70 +29,14 @@
 # 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
 
-MAINTAINERCLEANFILES    = Makefile.in
+AM_CFLAGS			= -fPIC \
+				  -I$(top_builddir)/include \
+				  -I$(top_srcdir)/include
 
-AM_CFLAGS		= -fPIC
+lib_LTLIBRARIES			= libcorosync_common.la
 
-INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include
+libcorosync_common_la_SOURCES	= error_conversion.c
 
-lib_LIBRARIES		= libcorosync_common.a
-SHARED_LIBS_SO		= $(lib_LIBRARIES:%.a=%.so)
-
-libcorosync_common_a_SOURCES	= error_conversion.c
-
-SOMAJOR=4
-SOMINOR=0
-SOMICRO=0
-SONAME=${SOMAJOR}.${SOMINOR}.${SOMICRO}
-
-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 *.so* *.da *.bb *.bbg
+libcorosync_common_la_LDFLAGS	= -version-number 4:0:0
diff --git a/configure.ac b/configure.ac
index 9578633..5b9971f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,10 +9,15 @@ AC_INIT(,
 	[discuss@xxxxxxxxxxxxxxxxxx])
 
 AM_INIT_AUTOMAKE([-Wno-portability])
+
+LT_PREREQ([2.2.6])
+LT_INIT
+
 AM_SILENT_RULES([yes])
 
 AC_CONFIG_SRCDIR([lib/cpg.c])
 AC_CONFIG_HEADER([include/corosync/config.h])
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_CANONICAL_HOST
 
@@ -57,11 +62,13 @@ fi
 sinclude(coroysync-default.m4)
 
 AC_PROG_CC
+AC_PROG_CXX
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
 AC_PROG_SED
+AC_PROG_LIBTOOL
 
 AC_CHECK_PROGS([GROFF], [groff])
 AC_CHECK_PROGS([PKGCONFIG], [pkg-config])
@@ -318,14 +325,12 @@ AM_CONDITIONAL(BUILD_QDEVICES, test x$enable_qdevices = xyes)
 
 # OS detection
 # THIS SECTION MUST DIE!
-CP=cp
 OS_LDL="-ldl"
 have_linux="no"
 case "$host_os" in
 	*linux*)
 		AC_DEFINE_UNQUOTED([COROSYNC_LINUX], [1],
 				   [Compiling for Linux platform])
-		OS_CFLAGS=""
 		OS_CPPFLAGS="-D_GNU_SOURCE"
 		OS_LDFLAGS=""
 		OS_DYFLAGS="-rdynamic"
@@ -335,8 +340,6 @@ case "$host_os" in
 	darwin*)
 		AC_DEFINE_UNQUOTED([COROSYNC_DARWIN], [1],
 				   [Compiling for Darwin platform])
-		CP=rsync
-		OS_CFLAGS=""
 		OS_CPPFLAGS=""
 		OS_LDFLAGS=""
 		OS_DYFLAGS=""
@@ -355,7 +358,6 @@ case "$host_os" in
 				   [Compiling for BSD platform])
 		AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON],
 				   [Shared memory define for Darwin platform])
-		OS_CFLAGS=""
 		OS_CPPFLAGS="-I/usr/local/include"
 		OS_LDFLAGS="-L/usr/local/lib"
 		OS_DYFLAGS="-export-dynamic"
@@ -377,8 +379,6 @@ case "$host_os" in
 				   [Prevent being scheduled RR])
 		AC_DEFINE_UNQUOTED([_SEM_SEMUN_UNDEFINED], [1],
 				   [The semun structure is undefined])
-		CP=rsync
-		OS_CFLAGS=""
 		OS_CPPFLAGS="-D_REENTRANT"
 		OS_LDFLAGS=""
 		OS_DYFLAGS="-Wl,-z,lazyload"
@@ -390,7 +390,6 @@ case "$host_os" in
 	;;
 esac
 
-AC_SUBST(CP)
 # *FLAGS handling goes here
 
 ENV_CFLAGS="$CFLAGS"
@@ -596,7 +595,7 @@ if test "x${enable_user_flags}" = xyes; then
 fi
 
 # final build of *FLAGS
-CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
+CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS \
 	$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS"
 CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS"
 LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
@@ -666,7 +665,6 @@ AC_MSG_RESULT([  Extra compiler warnings  = ${EXTRA_WARNING}])
 AC_MSG_RESULT([  Env. defined CFLAG       = ${ENV_CFLAGS}])
 AC_MSG_RESULT([  Env. defined CPPFLAGS    = ${ENV_CPPFLAGS}])
 AC_MSG_RESULT([  Env. defined LDFLAGS     = ${ENV_LDFLAGS}])
-AC_MSG_RESULT([  OS   defined CFLAGS      = ${OS_CFLAGS}])
 AC_MSG_RESULT([  OS   defined CPPFLAGS    = ${OS_CPPFLAGS}])
 AC_MSG_RESULT([  OS   defined LDFLAGS     = ${OS_LDFLAGS}])
 AC_MSG_RESULT([  OS   defined LDL         = ${OS_LDL}])
diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am
index 6e8bb6a..0edc478 100644
--- a/cts/agents/Makefile.am
+++ b/cts/agents/Makefile.am
@@ -29,40 +29,53 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
-MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
-		-I$(top_builddir)/include/corosync
+MAINTAINERCLEANFILES		= Makefile.in
 
-SOURCES =
-TEST_AGENTS = cpg_test_agent sam_test_agent votequorum_test_agent
+TEST_AGENTS			= cpg_test_agent \
+				  sam_test_agent \
+				  votequorum_test_agent
+
+SHELL_TESTS			= mem_leak_test.sh \
+				  net_breaker.sh \
+				  cmap-dispatch-deadlock.sh \
+				  shm_leak_audit.sh
+
+noinst_HEADERS			= common_test_agent.h
 
 if INSTALL_TESTAGENTS
-agentdir = $(datadir)/$(PACKAGE)/tests
-bin_PROGRAMS = $(TEST_AGENTS)
-dist_agent_SCRIPTS = mem_leak_test.sh net_breaker.sh cmap-dispatch-deadlock.sh shm_leak_audit.sh
-AM_CFLAGS		= -fPIC
+agentdir			= $(datadir)/$(PACKAGE)/tests
+bin_PROGRAMS			= $(TEST_AGENTS)
+dist_agent_SCRIPTS		= $(SHELL_TESTS)
 else
-noinst_PROGRAMS = $(TEST_AGENTS)
-noinst_SCRIPTS = mem_leak_test.sh net_breaker.sh cmap-dispatch-deadlock.sh shm_leak_audit.sh
+noinst_PROGRAMS			= $(TEST_AGENTS)
+noinst_SCRIPTS			= $(SHELL_TESTS)
 endif
 
-noinst_HEADERS          = common_test_agent.h
+AM_CPPFLAGS			= -I$(top_builddir)/include \
+				  -I$(top_srcdir)/include \
+				  -I$(top_builddir)/include/corosync
 
-cpg_test_agent_SOURCES = cpg_test_agent.c common_test_agent.c
-cpg_test_agent_CFLAGS =  $(nss_CFLAGS)
-cpg_test_agent_LDADD =  -lcpg -lcfg -lcorosync_common $(LIBQB_LIBS) $(nss_LIBS)
-cpg_test_agent_LDFLAGS =  -L../../lib -L. -L../../common_lib
+AM_CFLAGS			= -fPIC
 
-sam_test_agent_SOURCES = sam_test_agent.c common_test_agent.c
-sam_test_agent_LDADD =  -lsam -lquorum -lcmap -lcorosync_common $(LIBQB_LIBS)
-sam_test_agent_LDFLAGS =  -L../../lib -L../../common_lib
+cpg_test_agent_SOURCES		= cpg_test_agent.c common_test_agent.c
+cpg_test_agent_CFLAGS		= $(nss_CFLAGS)
+cpg_test_agent_LDADD		= $(LIBQB_LIBS) $(nss_LIBS) \
+				  $(top_builddir)/lib/libcfg.la \
+				  $(top_builddir)/lib/libcpg.la \
+				  $(top_builddir)/common_lib/libcorosync_common.la
 
-votequorum_test_agent_SOURCES = votequorum_test_agent.c common_test_agent.c
-votequorum_test_agent_LDADD =  -lvotequorum -lquorum -lcorosync_common $(LIBQB_LIBS)
-votequorum_test_agent_LDFLAGS =  -L../../lib -L../../common_lib
+sam_test_agent_SOURCES		= sam_test_agent.c common_test_agent.c
+sam_test_agent_LDADD		= $(LIBQB_LIBS) \
+				  $(top_builddir)/lib/libsam.la \
+				  $(top_builddir)/lib/libcmap.la \
+				  $(top_builddir)/lib/libquorum.la \
+				  $(top_builddir)/common_lib/libcorosync_common.la
 
-clean-local:
-	rm -f *.o *.a *.so* *.da *.bb *.bbg
+votequorum_test_agent_SOURCES	= votequorum_test_agent.c common_test_agent.c
+votequorum_test_agent_LDADD	= $(LIBQB_LIBS) \
+				  $(top_builddir)/lib/libquorum.la \
+				  $(top_builddir)/lib/libvotequorum.la \
+				  $(top_builddir)/common_lib/libcorosync_common.la
 
 lint:
 	-splint $(LINT_FLAGS) $(CFLAGS) *.c
diff --git a/exec/Makefile.am b/exec/Makefile.am
index 2f0adef..b9e077c 100644
--- a/exec/Makefile.am
+++ b/exec/Makefile.am
@@ -31,83 +31,45 @@
 
 MAINTAINERCLEANFILES	= Makefile.in
 
-AM_CFLAGS		= -fPIC -DLOGCONFIG_USE_ICMAP=1
+AM_CFLAGS		= -fPIC 
 
-INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include $(nss_CFLAGS) $(rdmacm_CFLAGS) $(ibverbs_CFLAGS)
+AM_CPPFLAGS		= -DLOGCONFIG_USE_ICMAP=1 \
+			  -I$(top_builddir)/include \
+			  -I$(top_srcdir)/include \
+			  $(nss_CFLAGS) $(rdmacm_CFLAGS) $(ibverbs_CFLAGS)
+
+noinst_HEADERS		= apidef.h cs_queue.h logconfig.h main.h \
+			  quorum.h service.h timer.h totemconfig.h \
+			  totemmrp.h totemnet.h totemudp.h totemiba.h \
+			  totemrrp.h totemudpu.h totemsrp.h util.h vsf.h \
+			  schedwrk.h sync.h fsm.h votequorum.h vsf_ykd.h \
+			  totemcrypto.h
 
 TOTEM_SRC		= totemip.c totemnet.c totemudp.c \
 			  totemudpu.c totemrrp.c totemsrp.c totemmrp.c \
-			  totempg.c cs_queue.h totemcrypto.c
+			  totempg.c totemcrypto.c
+
 if BUILD_RDMA
 TOTEM_SRC		+= totemiba.c
 endif
 
-lib_LIBRARIES		= libtotem_pg.a
-sbin_PROGRAMS		= corosync
+lib_LTLIBRARIES		= libtotem_pg.la
+libtotem_pg_la_SOURCES	= $(TOTEM_SRC)
+libtotem_pg_la_LDFLAGS	= -version-number $(subst .,:,$(SONAME))
+libtotem_pg_la_LIBADD	= -lpthread $(nss_LIBS) $(rdmacm_LIBS) $(ibverbs_LIBS)
 
-libtotem_pg_a_SOURCES	= $(TOTEM_SRC)
+sbin_PROGRAMS		= corosync
 
 corosync_SOURCES	= vsf_ykd.c coroparse.c vsf_quorum.c sync.c \
 			  logsys.c cfg.c cmap.c cpg.c mon.c pload.c \
 			  votequorum.c wd.c util.c schedwrk.c main.c \
 			  apidef.c quorum.c icmap.c timer.c \
 			  ipc_glue.c service.c logconfig.c totemconfig.c
-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)
-
-SHARED_LIBS		= $(lib_LIBRARIES:%.a=%.so.$(SONAME))
-SHARED_LIBS_SO		= $(SHARED_LIBS:%.so.$(SONAME)=%.so)
-SHARED_LIBS_SO_TWO	= $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))
-
-noinst_HEADERS		= apidef.h logconfig.h main.h \
-			  quorum.h service.h timer.h totemconfig.h \
-			  totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
-			  totemudpu.h totemsrp.h util.h vsf.h schedwrk.h \
-			  sync.h fsm.h votequorum.h vsf_ykd.h totemcrypto.h
-
-if BUILD_DARWIN
-libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
-	$(CC) $(LDFLAGS) $(DARWIN_OPTS) $(TOTEM_OBJS) -o $@ -lpthread
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
 
-else
 
-if BUILD_SOLARIS
-libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
-	$(LD) $(LDFLAGS) -G $(TOTEM_OBJS) -o $@ -lpthread
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
-
-else
-libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
-	$(CC) -shared -o $@ \
-		-Wl,-soname=libtotem_pg.so.$(SOMAJOR) \
-		$(LDFLAGS) $^ $(nss_LIBS) $(rdmacm_LIBS) $(ibverbs_LIBS) -lpthread
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
-	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
-
-endif
-
-endif
+corosync_LDADD		= libtotem_pg.la ../common_lib/libcorosync_common.la \
+			  $(LIBQB_LIBS) $(statgrab_LIBS)
+corosync_DEPENDENCIES	= libtotem_pg.la ../common_lib/libcorosync_common.la
 
 lint:
-	-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
-
-all-local: $(SHARED_LIBS)
-	@echo Built corosync Executive
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)/$(libdir)
-	$(INSTALL) -m 755 $(SHARED_LIBS) $(DESTDIR)/$(libdir)
-	$(CP) -a $(SHARED_LIBS_SO) $(SHARED_LIBS_SO_TWO) $(DESTDIR)/$(libdir)
-
-uninstall-local:
-	cd $(DESTDIR)/$(libdir) && \
-		rm -f $(SHARED_LIBS) $(SHARED_LIBS_SO) $(SHARED_LIBS_SO_TWO)
-
-clean-local:
-	rm -f corosync *.o gmon.out *.da *.bb *.bbg *.so*
+	-splint $(AM_CPPFLAGS) $(LINT_FLAGS) $(CFLAGS) *.c
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9aabd0b..a9151cf 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -30,83 +30,42 @@
 # 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))
+# Functions to be used at link time (target.lo)
+get_libname=$(shell echo $1 | sed -e "s/\.lo//")
+uc=$(shell echo $(call get_libname,$1) | tr a-z A-Z)
+get_soname=$(subst .,:,$(if $($(call uc,$1)_SONAME),$($(call uc,$1)_SONAME),$(SONAME)))
+get_major=$(firstword $(subst :, ,$(call get_soname,$1)))
 
 MAINTAINERCLEANFILES    = Makefile.in
 
-AM_CFLAGS		= -fPIC
-
-AM_LDFLAGS		= -lpthread -L../common_lib -lcorosync_common
-
-INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include
-
-lib_LIBRARIES		= libcpg.a libquorum.a libcfg.a \
-			  libvotequorum.a libsam.a libcmap.a
-SHARED_LIBS_SO		= $(lib_LIBRARIES:%.a=%.so)
-
-libcpg_a_SOURCES	= cpg.c
-libcfg_a_SOURCES	= cfg.c
-libquorum_a_SOURCES	= quorum.c
-libvotequorum_a_SOURCES	= votequorum.c
-libcmap_a_SOURCES	= cmap.c
-SAM_LINKER_ADD		= -L. -lquorum -lcmap
-libsam_a_SOURCES	= sam.c
-
-noinst_HEADERS		= util.h \
-			  libcfg.versions \
-			  libcpg.versions \
-			  libquorum.versions libvotequorum.versions \
-			  libsam.versions libcmap.versions
-
-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,$*)
+EXTRA_DIST		= libcfg.versions	 libcfg.verso		\
+			  libcmap.versions	 libcmap.verso		\
+			  libcpg.versions	 libcpg.verso    	\
+			  libquorum.versions	 libquorum.verso 	\
+			  libsam.versions	 libsam.verso    	\
+			  libvotequorum.versions libvotequorum.verso
 
-else
+noinst_HEADERS		= util.h
 
-if BUILD_SOLARIS
+AM_CPPFLAGS		= -I$(top_builddir)/include \
+			  -I$(top_srcdir)/include
 
-libsam.so.$(SONAME): libcmap.so libquorum.a
-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
-
-libsam.so: libcmap.so libquorum.so
-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) $(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)
+AM_CFLAGS		= -fPIC
 
-clean-local:
-	rm -f *.o *.a *.so* *.da *.bb *.bbg
+# override global LIBS that pulls in lots of craft we don't need here
+LIBS			= -version-number $(call get_soname,$<) \
+			  -version-script=$(srcdir)/lib$(call get_libname,$<).versions \
+			  -lpthread \
+			  $(top_builddir)/common_lib/libcorosync_common.la \
+			  $(LIBQB_LIBS)
+
+lib_LTLIBRARIES		= libcpg.la libquorum.la libcfg.la \
+			  libvotequorum.la libsam.la libcmap.la
+
+libcpg_la_SOURCES	= cpg.c
+libcfg_la_SOURCES	= cfg.c
+libquorum_la_SOURCES	= quorum.c
+libvotequorum_la_SOURCES= votequorum.c
+libcmap_la_SOURCES	= cmap.c
+libsam_la_SOURCES	= sam.c
+libsam_la_LIBADD	= libquorum.la libcmap.la
diff --git a/test/Makefile.am b/test/Makefile.am
index 7010c50..a7c3c63 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -30,8 +30,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
-MAINTAINERCLEANFILES    = Makefile.in
-INCLUDES       		= -I$(top_builddir)/include/corosync -I$(top_srcdir)/include
+MAINTAINERCLEANFILES	= Makefile.in
 
 EXTRA_DIST		= ploadstart.sh
 
@@ -42,39 +41,27 @@ noinst_PROGRAMS		= cpgverify testcpg testcpg2 cpgbench \
 
 noinst_SCRIPTS		= ploadstart
 
-COMMON_OPTS		= -L../lib -L../common_lib -Wl,-rpath,../common_lib
+AM_CPPFLAGS		= -I$(top_builddir)/include/corosync \
+			  -I$(top_srcdir)/include \
+			  $(nss_CFLAGS)
 
-testcpg_LDADD		= -lcpg $(LIBQB_LIBS)
-testcpg_LDFLAGS		= $(COMMON_OPTS)
-testcpg2_LDADD		= -lcpg $(LIBQB_LIBS)
-testcpg2_LDFLAGS	= $(COMMON_OPTS)
-testcpgzc_LDADD		= -lcpg $(LIBQB_LIBS)
-testcpgzc_LDFLAGS	= $(COMMON_OPTS)
-testzcgc_LDADD		= -lcpg $(LIBQB_LIBS)
-testzcgc_LDFLAGS	= $(COMMON_OPTS)
-stress_cpgzc_LDADD	= -lcpg $(LIBQB_LIBS)
-stress_cpgzc_LDFLAGS	= $(COMMON_OPTS)
-stress_cpgfdget_LDADD	= -lcpg $(LIBQB_LIBS)
-stress_cpgfdget_LDFLAGS	= $(COMMON_OPTS)
-stress_cpgcontext_LDADD	= -lcpg $(LIBQB_LIBS)
-stress_cpgcontext_LDFLAGS	= $(COMMON_OPTS)
-testquorum_LDADD	= -lquorum $(LIBQB_LIBS)
-testquorum_LDFLAGS	= $(COMMON_OPTS)
-testvotequorum1_LDADD	= -lvotequorum $(LIBQB_LIBS)
-testvotequorum1_LDFLAGS	= $(COMMON_OPTS)
-testvotequorum2_LDADD	= -lvotequorum $(LIBQB_LIBS)
-testvotequorum2_LDFLAGS	= $(COMMON_OPTS)
-cpgverify_CFLAGS	= $(nss_CFLAGS)
-cpgverify_LDADD		= -lcpg -ltotem_pg $(LIBQB_LIBS) $(nss_LIBS)
-cpgverify_LDFLAGS	= $(COMMON_OPTS) -L../exec
-cpgbound_LDADD		= -lcpg $(LIBQB_LIBS)
-cpgbound_LDFLAGS	= $(COMMON_OPTS)
-cpgbench_LDADD		= -lcpg $(LIBQB_LIBS)
-cpgbench_LDFLAGS	= $(COMMON_OPTS)
-cpgbenchzc_LDADD	= -lcpg -lcorosync_common $(LIBQB_LIBS)
-cpgbenchzc_LDFLAGS	= $(COMMON_OPTS)
-testsam_LDADD		= -lsam -lcmap -lquorum $(LIBQB_LIBS)
-testsam_LDFLAGS		= $(COMMON_OPTS)
+AM_CFLAGS		= -fPIC
+
+testcpg_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+testcpg2_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+testcpgzc_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+testzcgc_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+stress_cpgzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+stress_cpgfdget_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+stress_cpgcontext_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+testquorum_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libquorum.la
+testvotequorum1_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
+testvotequorum2_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
+cpgverify_LDADD		= $(LIBQB_LIBS) $(nss_LIBS) $(top_builddir)/lib/libcpg.la
+cpgbound_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+cpgbench_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+cpgbenchzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
+testsam_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la
 
 ploadstart: ploadstart.sh
 	cp $^ $@
@@ -84,7 +71,7 @@ LINT_FILES1:=$(filter-out sa_error.c, $(wildcard *.c))
 LINT_FILES:=$(filter-out testparse.c, $(LINT_FILES1))
 
 lint:
-	-for f in $(LINT_FILES) ; do echo Splint $$f ; splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) $$f ; done
+	-for f in $(LINT_FILES) ; do echo Splint $$f ; splint $(AM_CPPFLAGS) $(LINT_FLAGS) $(CFLAGS) $$f ; done
 
 clean-local:
-	rm -f fdata ploadstart
+	rm -f ploadstart
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 6e689f6..6abc972 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -29,9 +29,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
-MAINTAINERCLEANFILES    = Makefile.in
-INCLUDES       		= -I$(top_builddir)/include  -I$(top_srcdir)/include \
-                          -I$(top_builddir)/include/corosync
+MAINTAINERCLEANFILES	= Makefile.in
 
 sbin_PROGRAMS		= corosync-cfgtool \
 			  corosync-keygen \
@@ -44,40 +42,41 @@ if INSTALL_XMLCONF
 bin_SCRIPTS		+= corosync-xmlproc
 endif
 
+EXTRA_DIST		= $(bin_SCRIPTS) corosync-xmlproc.sh \
+			  corosync-notifyd.sysconfig.example \
+                          corosync-blackbox.sh
+
 corosync-xmlproc: corosync-xmlproc.sh
 	sed -e 's#@''DATADIR@#${datadir}#g' $< > $@
 
 corosync-blackbox: corosync-blackbox.sh
 	sed -e 's#@''LOCALSTATEDIR@#${localstatedir}#g' $< > $@
 
+AM_CPPFLAGS		= -I$(top_builddir)/include \
+			  -I$(top_srcdir)/include \
+                          -I$(top_builddir)/include/corosync \
+			  $(DBUS_CFLAGS)
 
-EXTRA_DIST		= $(bin_SCRIPTS) corosync-xmlproc.sh corosync-notifyd.sysconfig.example \
-                          corosync-blackbox.sh
-
-COMMON_OPTS		= -L../lib -L../common_lib -Wl,-rpath,../common_lib
-
-corosync_cmapctl_LDFLAGS= $(COMMON_OPTS)
-corosync_cmapctl_LDADD	= -lcorosync_common -lcmap $(LIBQB_LIBS)
+corosync_cmapctl_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcmap.la
 
-corosync_cfgtool_LDFLAGS= $(COMMON_OPTS)
-corosync_cfgtool_LDADD	= -lcfg $(LIBQB_LIBS)
+corosync_cfgtool_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcfg.la
 
-corosync_cpgtool_LDFLAGS= $(COMMON_OPTS)
-corosync_cpgtool_LDADD	= -lcfg -lcpg $(LIBQB_LIBS)
+corosync_cpgtool_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcfg.la \
+			  $(top_builddir)/lib/libcpg.la
 
-corosync_quorumtool_LDFLAGS = $(COMMON_OPTS)
-corosync_quorumtool_LDADD   = -lcmap -lcfg -lquorum -lcorosync_common \
-			      -lvotequorum $(LIBQB_LIBS)
+corosync_quorumtool_LDADD = $(LIBQB_LIBS) \
+			    $(top_builddir)/lib/libcmap.la \
+			    $(top_builddir)/lib/libcfg.la \
+			    $(top_builddir)/lib/libquorum.la \
+			    $(top_builddir)/lib/libvotequorum.la
 
-corosync_notifyd_CPPFLAGS = $(DBUS_CFLAGS)
-corosync_notifyd_LDFLAGS  = $(COMMON_OPTS)
-corosync_notifyd_LDADD    = -lcfg -lcmap \
-			    $(LIBQB_LIBS) $(DBUS_LIBS) $(SNMPLIBS) \
-			    -lquorum
+corosync_notifyd_LDADD    = $(LIBQB_LIBS) $(DBUS_LIBS) $(SNMPLIBS) \
+			    $(top_builddir)/lib/libcmap.la \
+			    $(top_builddir)/lib/libcfg.la \
+			    $(top_builddir)/lib/libquorum.la
 
 lint:
-	-splint $(LINT_FLAGS) $(DBUS_CFLAGS) $(INCLUDES) $(CFLAGS) *.c
+	-splint $(LINT_FLAGS) $(DBUS_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) *.c
 
 clean-local:
 	rm -f corosync-xmlproc corosync-blackbox
-
-- 
1.7.7.6

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux