[Telepathy-commits] [telepathy-glib/master] Simplify makefiles and avoid using $(TP_GLIB_LIBS)
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Dec 3 04:57:34 PST 2008
Autoconf substitutions in *_LDADD do not generate Makefile dependencies,
so using $(TP_GLIB_LIBS) meant that the tests were not automatically
rebuilt when telepathy-glib changed.
Also, we overlooked the existence of LDADD, which has an effect analogous
to AM_CFLAGS and allows a lot of simplification.
---
configure.ac | 7 ++--
examples/client/Makefile.am | 15 +++------
examples/cm/channelspecific/Makefile.am | 6 +++-
examples/cm/echo/Makefile.am | 6 +++-
examples/cm/extended/Makefile.am | 8 ++++-
examples/cm/no-protocols/Makefile.am | 8 +++--
examples/extensions/Makefile.am | 6 +++-
tests/Makefile.am | 13 ++------
tests/dbus/Makefile.am | 48 +++---------------------------
9 files changed, 42 insertions(+), 75 deletions(-)
diff --git a/configure.ac b/configure.ac
index 160b7b0..b16ee86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,12 +172,11 @@ PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.95, dbus-glib-1 >= 0.73])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
-dnl We want the examples to be able to use TP_GLIB_CFLAGS, TP_GLIB_LIBS
-dnl as though they were independent programs
+dnl We want the examples to be able to use TP_GLIB_CFLAGS as though they were
+dnl independent programs, but subst'ing TP_GLIB_LIBS interferes with
+dnl dependency tracking
TP_GLIB_CFLAGS='-I${top_builddir} -I${top_srcdir}'
-TP_GLIB_LIBS='${top_builddir}/telepathy-glib/libtelepathy-glib.la'
AC_SUBST(TP_GLIB_CFLAGS)
-AC_SUBST(TP_GLIB_LIBS)
dnl Check for code generation tools
XSLTPROC=
diff --git a/examples/client/Makefile.am b/examples/client/Makefile.am
index 6dbf5a3..288cd3d 100644
--- a/examples/client/Makefile.am
+++ b/examples/client/Makefile.am
@@ -2,39 +2,34 @@ noinst_PROGRAMS =
noinst_PROGRAMS += telepathy-example-inspect-channel
telepathy_example_inspect_channel_SOURCES = inspect-channel.c
-telepathy_example_inspect_channel_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-inspect-connection
telepathy_example_inspect_connection_SOURCES = inspect-connection.c
-telepathy_example_inspect_connection_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-inspect-contact
telepathy_example_inspect_contact_SOURCES = inspect-contact.c
-telepathy_example_inspect_contact_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-inspect-cm
telepathy_example_inspect_cm_SOURCES = inspect-cm.c
-telepathy_example_inspect_cm_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-list-connections
telepathy_example_list_connections_SOURCES = list-connections.c
-telepathy_example_list_connections_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-list-managers
telepathy_example_list_managers_SOURCES = list-managers.c
-telepathy_example_list_managers_LDADD = $(ALL_LIBS)
noinst_PROGRAMS += telepathy-example-extended-client
telepathy_example_extended_client_SOURCES = extended-client.c
telepathy_example_extended_client_LDADD = \
$(top_builddir)/examples/extensions/libexample-extensions.la \
- $(ALL_LIBS)
+ $(LDADD)
-# Sadly there is no AM_LDADD
-ALL_LIBS = \
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the .la path
+LDADD = \
@DBUS_LIBS@ \
@GLIB_LIBS@ \
- @TP_GLIB_LIBS@
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
AM_CFLAGS = \
$(ERROR_CFLAGS) \
diff --git a/examples/cm/channelspecific/Makefile.am b/examples/cm/channelspecific/Makefile.am
index 21d3a2a..855050d 100644
--- a/examples/cm/channelspecific/Makefile.am
+++ b/examples/cm/channelspecific/Makefile.am
@@ -14,8 +14,12 @@ libexample_cm_csh_la_SOURCES = \
manager.c \
manager.h
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the .la path
libexample_cm_csh_la_LIBADD = \
- $(TP_GLIB_LIBS)
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
telepathy_example_cm_csh_SOURCES = \
main.c
diff --git a/examples/cm/echo/Makefile.am b/examples/cm/echo/Makefile.am
index fc83674..353f0df 100644
--- a/examples/cm/echo/Makefile.am
+++ b/examples/cm/echo/Makefile.am
@@ -11,8 +11,12 @@ libexample_cm_echo_la_SOURCES = \
manager.c \
manager.h
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the .la path
libexample_cm_echo_la_LIBADD = \
- $(TP_GLIB_LIBS)
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
telepathy_example_cm_echo_SOURCES = \
main.c
diff --git a/examples/cm/extended/Makefile.am b/examples/cm/extended/Makefile.am
index 827807c..2739f33 100644
--- a/examples/cm/extended/Makefile.am
+++ b/examples/cm/extended/Makefile.am
@@ -7,9 +7,13 @@ telepathy_example_cm_extended_SOURCES = \
manager.c \
manager.h
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the path to libtelepathy-glib.la
telepathy_example_cm_extended_LDADD = \
- $(top_builddir)/examples/extensions/libexample-extensions.la \
- $(TP_GLIB_LIBS)
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la \
+ $(top_builddir)/examples/extensions/libexample-extensions.la
AM_CFLAGS = \
$(ERROR_CFLAGS) \
diff --git a/examples/cm/no-protocols/Makefile.am b/examples/cm/no-protocols/Makefile.am
index fbe99c6..839098d 100644
--- a/examples/cm/no-protocols/Makefile.am
+++ b/examples/cm/no-protocols/Makefile.am
@@ -5,10 +5,12 @@ telepathy_example_no_protocols_SOURCES = \
manager.c \
manager.h
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the .la path
telepathy_example_no_protocols_LDADD = \
- @DBUS_LIBS@ \
- @GLIB_LIBS@ \
- @TP_GLIB_LIBS@
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
AM_CFLAGS = \
$(ERROR_CFLAGS) \
diff --git a/examples/extensions/Makefile.am b/examples/extensions/Makefile.am
index 3f909b4..c206640 100644
--- a/examples/extensions/Makefile.am
+++ b/examples/extensions/Makefile.am
@@ -22,8 +22,12 @@ EXTRA_DIST = \
noinst_LTLIBRARIES = libexample-extensions.la
+# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
+# pkg-config via autoconf) instead of the .la path
libexample_extensions_la_LIBADD = \
- $(TP_GLIB_LIBS)
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
# The client-specific parts are built into a separate .o file, so the linker
# can discard them when linking services. The service-specific parts are
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 70d78df..4e5c17e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -38,28 +38,18 @@ EXTRA_DIST = README
test_asv_SOURCES = \
asv.c
-test_asv_LDADD = \
- $(top_builddir)/telepathy-glib/libtelepathy-glib.la
test_heap_SOURCES = \
test-heap.c
-test_heap_LDADD = \
- $(top_builddir)/telepathy-glib/libtelepathy-glib.la
test_util_SOURCES = \
test-util.c
-test_util_LDADD = \
- $(top_builddir)/telepathy-glib/libtelepathy-glib.la
test_intset_SOURCES = \
test-intset.c
-test_intset_LDADD = \
- $(top_builddir)/telepathy-glib/libtelepathy-glib.la
test_availability_cmp_SOURCES = \
test-availability-cmp.c
-test_availability_cmp_LDADD = \
- $(top_builddir)/telepathy-glib/libtelepathy-glib.la
# this needs to link against the static convenience library so that
# _tp_debug is still visible
@@ -72,6 +62,9 @@ check_c_sources = *.c
include $(top_srcdir)/tools/check-coding-style.mk
check-local: check-coding-style
+LDADD = \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la
+
AM_CFLAGS = \
$(ERROR_CFLAGS) \
$(DBUS_CFLAGS) \
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index ce4799a..de2d725 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -20,86 +20,48 @@ noinst_PROGRAMS = \
TESTS = $(noinst_PROGRAMS)
-test_call_cancellation_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
+LDADD = \
+ $(top_builddir)/telepathy-glib/libtelepathy-glib.la \
+ $(top_builddir)/tests/lib/libtp-glib-tests.la
-test_channel_introspect_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_channel_introspect_SOURCES = channel-introspect.c
-test_connection_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_connection_SOURCES = connection.c
-test_connection_handles_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_connection_handles_SOURCES = connection-handles.c
-test_connection_inject_bug16307_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_connection_inject_bug16307_SOURCES = connection-inject-bug16307.c
-test_connection_getinterfaces_failure_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_connection_getinterfaces_failure_SOURCES = \
connection-getinterfaces-failure.c
-test_contacts_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_contacts_SOURCES = contacts.c
-test_contacts_mixin_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_contacts_mixin_SOURCES = contacts-mixin.c
-test_dbus_LDADD = $(TP_GLIB_LIBS)
-test_disconnection_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
-test_example_no_protocols_LDADD = $(TP_GLIB_LIBS)
-
test_finalized_in_invalidated_handler_SOURCES = \
finalized-in-invalidated-handler.c
-test_finalized_in_invalidated_handler_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_handle_set_SOURCES = handle-set.c
-test_handle_set_LDADD = $(TP_GLIB_LIBS)
-test_invalidated_while_invoking_signals_LDADD = \
- $(TP_GLIB_LIBS) \
- ../lib/libtp-glib-tests.la
test_invalidated_while_invoking_signals_SOURCES = \
invalidated-while-invoking-signals.c
-test_properties_LDADD = $(TP_GLIB_LIBS)
test_properties_SOURCES = properties.c
nodist_test_properties_SOURCES = \
_gen/svc.h \
_gen/svc.c
test_text_mixin_LDADD = \
- $(TP_GLIB_LIBS) \
- $(top_builddir)/tests/lib/libtp-glib-tests.la \
+ $(LDADD) \
$(top_builddir)/examples/cm/echo/libexample-cm-echo.la
test_text_mixin_SOURCES = text-mixin.c
test_text_respawn_LDADD = \
- $(TP_GLIB_LIBS) \
- $(top_builddir)/tests/lib/libtp-glib-tests.la \
+ $(LDADD) \
$(top_builddir)/examples/cm/echo/libexample-cm-echo.la
test_text_respawn_SOURCES = text-respawn.c
-test_unsupported_interface_LDADD = $(TP_GLIB_LIBS)
test_unsupported_interface_SOURCES = unsupported-interface.c
check_c_sources = *.c
--
1.5.6.5
More information about the Telepathy-commits
mailing list