From 38a7deaf31060cdffdf395d0c3f69d9566d671cf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 27 Jul 2010 17:19:49 +0100 Subject: [PATCH 3/3] Consolidate LDADD variables in tests/examples and make them more complete This fixes compilation with LDFLAGS=-Wl,--no-add-needed, which is the default behaviour of GNU gold, and of Fedora's patched GNU ld. See: http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking --- dbus/examples/Makefile.am | 8 ++++---- dbus/examples/statemachine/Makefile.am | 6 ++++-- test/core/Makefile.am | 31 +++++++++++++------------------ test/interfaces/Makefile.am | 8 ++++---- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/dbus/examples/Makefile.am b/dbus/examples/Makefile.am index 9178804..45dc502 100644 --- a/dbus/examples/Makefile.am +++ b/dbus/examples/Makefile.am @@ -8,15 +8,17 @@ INCLUDES = \ $(DBUS_GLIB_CFLAGS) \ -DDBUS_COMPILATION +LDADD = \ + $(DBUS_GLIB_LIBS) \ + $(top_builddir)/dbus/libdbus-glib-1.la + ## Makefile.am bits for sample client/server pair noinst_PROGRAMS= example-client example-service example_client_SOURCES= example-client.c -example_client_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la example_service_SOURCES= example-service.c -example_service_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la BUILT_SOURCES = example-service-glue.h @@ -29,10 +31,8 @@ example-service-glue.h: example-service.xml noinst_PROGRAMS += example-signal-recipient example-signal-emitter example_signal_recipient_SOURCES= example-signal-recipient.c -example_signal_recipient_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la example_signal_emitter_SOURCES= example-signal-emitter.c -example_signal_emitter_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la BUILT_SOURCES += example-signal-emitter-glue.h diff --git a/dbus/examples/statemachine/Makefile.am b/dbus/examples/statemachine/Makefile.am index 37f0b30..2377621 100644 --- a/dbus/examples/statemachine/Makefile.am +++ b/dbus/examples/statemachine/Makefile.am @@ -7,6 +7,9 @@ INCLUDES = \ $(DBUS_GTK_THREADS_CFLAGS) \ -DDBUS_COMPILATION +LDADD = $(top_builddir)/dbus/libdbus-glib-1.la \ + $(DBUS_GLIB_LIBS) + ## Makefile.am bits for sample client/server pair noinst_PROGRAMS= statemachine-server @@ -18,10 +21,9 @@ noinst_PROGRAMS= statemachine-server EXTRA_DIST = statemachine.h statemachine-server.h sm-marshal.list statemachine-server.xml statemachine.xml statemachine_server_SOURCES= statemachine-server.c sm-marshal.c statemachine.c -statemachine_server_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la #statemachine_client_SOURCES= statemachine-client.c sm-marshal.c statemachine.h -#statemachine_client_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GTK_THREADS_LIBS) +#statemachine_client_LDADD= $(LDADD) $(DBUS_GTK_THREADS_LIBS) BUILT_SOURCES = statemachine-server-glue.h statemachine-glue.h diff --git a/test/core/Makefile.am b/test/core/Makefile.am index 6ecd30a..ac61529 100644 --- a/test/core/Makefile.am +++ b/test/core/Makefile.am @@ -7,6 +7,17 @@ INCLUDES = \ $(DBUS_GLIB_CFLAGS) \ -DDBUS_COMPILATION +LDADD = \ + $(DBUS_GLIB_THREADS_LIBS) \ + $(DBUS_GLIB_LIBS) \ + $(DBUS_LIBS) \ + $(top_builddir)/dbus/libdbus-glib-1.la + +tool_ldadd = \ + $(LDADD) \ + $(DBUS_GLIB_TOOL_LIBS) \ + $(top_builddir)/dbus/libdbus-gtool.la + ## note that TESTS has special meaning (stuff to use in make check) ## so if adding tests not to be run in make check, don't add them to ## TESTS @@ -28,13 +39,9 @@ test_thread_server_SOURCES= \ test-thread-server.c \ test-thread.h -test_thread_server_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la - test_thread_client_SOURCES= \ test-thread-client.c \ test-thread.h - -test_thread_client_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la endif ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we @@ -57,9 +64,6 @@ test_5688_SOURCES = \ my-object-subclass.h \ my-object-marshal.c \ 5688.c -test_5688_LDADD = \ - $(top_builddir)/dbus/libdbus-glib-1.la \ - $(DBUS_GLIB_THREADS_LIBS) test_unregister_SOURCES = \ my-object.c \ @@ -68,19 +72,16 @@ test_unregister_SOURCES = \ my-object-subclass.h \ my-object-marshal.c \ unregister.c -test_unregister_LDADD = \ - $(top_builddir)/dbus/libdbus-glib-1.la \ - $(DBUS_GLIB_THREADS_LIBS) test_dbus_glib_SOURCES= \ my-object-marshal.c \ test-dbus-glib.c -test_dbus_glib_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/dbus/libdbus-gtool.la $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GLIB_LIBS) +test_dbus_glib_LDADD= $(tool_ldadd) test_variant_recursion_SOURCES=test-variant-recursion.c -test_variant_recursion_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la $(top_builddir)/dbus/libdbus-gtool.la +test_variant_recursion_LDADD= $(tool_ldadd) BUILT_SOURCES = test-service-glib-glue.h test-service-glib-subclass-glue.h test-service-glib-bindings.h my-object-marshal.c my-object-marshal.h @@ -91,7 +92,6 @@ test_service_glib_SOURCES= \ my-object-subclass.h \ my-object-marshal.c \ test-service-glib.c -test_service_glib_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GLIB_THREADS_LIBS) test-service-glib-glue.h: test-service-glib.xml $(top_builddir)/dbus/dbus-binding-tool$(EXEEXT) $(DEBUG) $(DBUS_BINDING_TOOL) --prefix=my_object --mode=glib-server --output=test-service-glib-glue.h $(srcdir)/test-service-glib.xml @@ -116,15 +116,12 @@ peer_server_SOURCES = \ my-object-subclass.h \ my-object-marshal.c \ peer-server.c -peer_server_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GLIB_THREADS_LIBS) peer_client_SOURCES = \ peer-client.c -peer_client_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GLIB_THREADS_LIBS) test_types_SOURCES = \ test-types.c -test_types_LDADD= $(top_builddir)/dbus/libdbus-glib-1.la CLEANFILES = \ $(BUILT_SOURCES) \ @@ -142,6 +139,4 @@ endif if HAVE_GLIB_THREADS test_profile_SOURCES= \ test-profile.c - -test_profile_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la endif diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am index f52a6e9..ed5bc16 100644 --- a/test/interfaces/Makefile.am +++ b/test/interfaces/Makefile.am @@ -6,6 +6,10 @@ INCLUDES = \ $(DBUS_GLIB_CFLAGS) \ -DDBUS_COMPILATION +LDADD = $(DBUS_GLIB_LIBS) \ + $(top_builddir)/dbus/libdbus-glib-1.la \ + $(top_builddir)/dbus/libdbus-gtool.la + ## note that TESTS has special meaning (stuff to use in make check) ## so if adding tests not to be run in make check, don't add them to ## TESTS @@ -33,13 +37,9 @@ test_service_SOURCES = \ test-objects.h \ test-server.c -test_service_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la $(top_builddir)/dbus/libdbus-gtool.la - test_client_SOURCES = \ test-client.c -test_client_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/dbus/libdbus-gtool.la $(top_builddir)/dbus/libdbus-glib-1.la $(DBUS_GLIB_LIBS) - BUILT_SOURCES = \ test-song-glue.h \ test-hello-glue.h \ -- 1.7.1