[folks] build: Factor common test build rules into test.mk



commit 75943c1062d0af4abc60bf2d1969f4f0a4d8fb17
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Nov 11 10:29:55 2013 +0000

    build: Factor common test build rules into test.mk
    
    Simplify the build system a little.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712274

 tests/Makefile.am              |    4 ++
 tests/eds/Makefile.am          |   53 +++++++++++--------------------
 tests/folks/Makefile.am        |   67 ++++++++++++++-------------------------
 tests/key-file/Makefile.am     |   41 +++++++----------------
 tests/libsocialweb/Makefile.am |   49 +++++++++-------------------
 tests/telepathy/Makefile.am    |   68 ++++++++++++++--------------------------
 tests/test.mk                  |   59 ++++++++++++++++++++++++++++++++++
 tests/tracker/Makefile.am      |   47 +++++++++------------------
 8 files changed, 175 insertions(+), 213 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 10c0f56..fc3011e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,4 +37,8 @@ DIST_SUBDIRS = \
        tracker \
        $(NULL)
 
+EXTRA_DIST = \
+       test.mk \
+       $(NULL)
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/eds/Makefile.am b/tests/eds/Makefile.am
index bb8779a..687ebe6 100644
--- a/tests/eds/Makefile.am
+++ b/tests/eds/Makefile.am
@@ -1,59 +1,44 @@
+include $(top_srcdir)/tests/test.mk
+
 # This forces serialization of the tests because they run into terrible race
 # conditions if run in parallel (ie, make -jN, n > 1)
 #
 # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=709119
 .NOTPARALLEL:
 
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
+AM_VALAFLAGS = \
+       $(test_valaflags) \
+       --vapidir=$(top_srcdir)/backends/eds/lib \
+       --vapidir=$(top_srcdir)/tests/lib/eds \
+       --pkg posix \
+       --pkg libebook-1.2 \
+       --pkg libedataserver-1.2 \
+       --pkg libxml-2.0 \
+       --pkg folks-eds \
+       --pkg eds-test \
        $(NULL)
 
 AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GEE_CFLAGS) \
+       $(test_cppflags) \
        $(EBOOK_CFLAGS) \
        $(EDATASERVER_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
        -I$(top_srcdir)/backends/eds/lib \
        -I$(top_srcdir)/backends/eds/lib/folks \
-       -I$(top_srcdir)/tests/lib \
        -I$(top_srcdir)/tests/lib/eds \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
+       $(NULL)
+
+AM_CFLAGS = \
+       $(test_cflags) \
        $(NULL)
 
 LDADD = \
+       $(AM_LDADD) \
+       $(test_ldadd) \
        $(top_builddir)/tests/lib/eds/libeds-test.la \
-       $(top_builddir)/tests/lib/libfolks-test.la \
        $(top_builddir)/backends/eds/lib/libfolks-eds.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GEE_LIBS) \
        -L$(top_srcdir)/backends/eds/lib \
        $(NULL)
 
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
-       --vapidir=. \
-       --vapidir=$(top_srcdir)/folks \
-       --vapidir=$(top_srcdir)/backends/eds/lib \
-       --vapidir=$(top_srcdir)/tests/lib \
-       --vapidir=$(top_srcdir)/tests/lib/eds \
-       --pkg posix \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg folks \
-       --pkg folks-test \
-       --pkg libebook-1.2 \
-       --pkg libedataserver-1.2 \
-       --pkg libxml-2.0 \
-       --pkg folks-eds \
-       --pkg eds-test \
-       -g \
-       $(NULL)
-
 # in order from least to most complex
 TESTS = \
        persona-store-tests \
diff --git a/tests/folks/Makefile.am b/tests/folks/Makefile.am
index 1adaec3..7d01b3b 100644
--- a/tests/folks/Makefile.am
+++ b/tests/folks/Makefile.am
@@ -1,60 +1,41 @@
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
-       $(NULL)
-
-AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GEE_CFLAGS) \
-       $(TP_GLIB_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
-       -I$(top_srcdir)/tests/lib \
-       -I$(top_srcdir)/tests/lib/key-file \
-       -I$(top_srcdir)/tests/lib/telepathy \
-       -I$(top_srcdir)/tests/lib/telepathy/contactlist \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
-       $(NULL)
-
-LDADD = \
-       $(top_builddir)/tests/lib/libfolks-test.la \
-       $(top_builddir)/tests/lib/key-file/libkf-test.la \
-       $(top_builddir)/tests/lib/telepathy/libtpf-test.la \
-       $(top_builddir)/tests/lib/telepathy/contactlist/libtp-test-contactlist.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GEE_LIBS) \
-       $(GIO_LIBS) \
-       $(TP_GLIB_LIBS) \
-       $(NULL)
+include $(top_srcdir)/tests/test.mk
 
 # --disable-warnings is necessary so that we can test deprecated API such as
 # the IndividualAggregator.individuals_changed signal.
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
+AM_VALAFLAGS = \
+       $(test_valaflags) \
        --disable-warnings \
-       --vapidir=$(abs_srcdir) \
-       --vapidir=$(abs_builddir) \
-       --vapidir=$(abs_top_srcdir)/folks \
-       --vapidir=$(abs_top_builddir)/folks \
-       --vapidir=$(abs_top_srcdir)/tests/lib \
-       --vapidir=$(abs_top_builddir)/tests/lib \
        --vapidir=$(abs_top_srcdir)/tests/lib/key-file \
        --vapidir=$(abs_top_builddir)/tests/lib/key-file \
        --vapidir=$(abs_top_srcdir)/tests/lib/telepathy \
        --vapidir=$(abs_top_builddir)/tests/lib/telepathy \
        --vapidir=$(abs_top_srcdir)/tests/lib/telepathy/contactlist/ \
        --vapidir=$(abs_top_builddir)/tests/lib/telepathy/contactlist/ \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg folks \
        --pkg folks-generics \
-       --pkg folks-test \
        --pkg kf-test \
        --pkg tpf-test \
        --pkg tp-test-contactlist \
-       -g \
+       $(NULL)
+
+AM_CPPFLAGS = \
+       $(test_cppflags) \
+       $(TP_GLIB_CFLAGS) \
+       -I$(top_srcdir)/tests/lib/key-file \
+       -I$(top_srcdir)/tests/lib/telepathy \
+       -I$(top_srcdir)/tests/lib/telepathy/contactlist \
+       $(NULL)
+
+AM_CFLAGS = \
+       $(test_cflags) \
+       $(NULL)
+
+LDADD = \
+       $(AM_LDADD) \
+       $(test_ldadd) \
+       $(top_builddir)/tests/lib/key-file/libkf-test.la \
+       $(top_builddir)/tests/lib/telepathy/libtpf-test.la \
+       $(top_builddir)/tests/lib/telepathy/contactlist/libtp-test-contactlist.la \
+       $(TP_GLIB_LIBS) \
        $(NULL)
 
 # in order from least to most complex
diff --git a/tests/key-file/Makefile.am b/tests/key-file/Makefile.am
index 32ab459..ef3ee67 100644
--- a/tests/key-file/Makefile.am
+++ b/tests/key-file/Makefile.am
@@ -1,39 +1,24 @@
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
+include $(top_srcdir)/tests/test.mk
+
+AM_VALAFLAGS = \
+       $(test_valaflags) \
+       --vapidir=$(top_srcdir)/tests/lib/key-file \
+       --pkg kf-test \
        $(NULL)
 
 AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GEE_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
-       -I$(top_srcdir)/tests/lib \
+       $(test_cppflags) \
        -I$(top_srcdir)/tests/lib/key-file \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
        $(NULL)
 
-LDADD = \
-       $(top_builddir)/tests/lib/key-file/libkf-test.la \
-       $(top_builddir)/tests/lib/libfolks-test.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GEE_LIBS) \
+AM_CFLAGS = \
+       $(test_cflags) \
        $(NULL)
 
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
-       --vapidir=. \
-       --vapidir=$(top_srcdir)/folks \
-       --vapidir=$(top_srcdir)/tests/lib \
-       --vapidir=$(top_srcdir)/tests/lib/key-file \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg folks \
-       --pkg folks-test \
-       --pkg kf-test \
-       -g \
+LDADD = \
+       $(AM_LDADD) \
+       $(test_ldadd) \
+       $(top_builddir)/tests/lib/key-file/libkf-test.la \
        $(NULL)
 
 # in order from least to most complex
diff --git a/tests/libsocialweb/Makefile.am b/tests/libsocialweb/Makefile.am
index 6027228..02df9eb 100644
--- a/tests/libsocialweb/Makefile.am
+++ b/tests/libsocialweb/Makefile.am
@@ -1,52 +1,35 @@
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
+include $(top_srcdir)/tests/test.mk
+
+AM_VALAFLAGS = \
+       $(test_valaflags) \
+       --vapidir=$(top_srcdir)/backends/libsocialweb/lib \
+       --vapidir=$(top_srcdir)/tests/lib/libsocialweb \
+       --pkg folks-libsocialweb \
+       --pkg libsocialweb-client \
+       --pkg libsocialweb-test \
        $(NULL)
 
 AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GIO_CFLAGS) \
-       $(GEE_CFLAGS) \
+       $(test_cppflags) \
        $(SW_CLIENT_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
        -I$(top_srcdir)/backends/libsocialweb/lib \
        -I$(top_srcdir)/backends/libsocialweb/lib/folks \
-       -I$(top_srcdir)/tests/lib \
        -I$(top_srcdir)/tests/lib/libsocialweb \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
+       $(NULL)
+
+AM_CFLAGS = \
+       $(test_cflags) \
        $(NULL)
 
 LDADD = \
-       $(top_builddir)/tests/lib/libfolks-test.la \
+       $(AM_LDADD) \
+       $(test_ldadd) \
        $(top_builddir)/tests/lib/libsocialweb/libsocialweb-test.la \
        $(top_builddir)/backends/libsocialweb/lib/libfolks-libsocialweb.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GIO_LIBS) \
-       $(GEE_LIBS) \
        $(SW_CLIENT_LIBS) \
        -L$(top_srcdir)/backends/libsocialweb/lib \
        $(NULL)
 
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
-       --vapidir=. \
-       --vapidir=$(top_srcdir)/folks \
-       --vapidir=$(top_srcdir)/backends/libsocialweb/lib \
-       --vapidir=$(top_srcdir)/tests/lib \
-       --vapidir=$(top_srcdir)/tests/lib/libsocialweb \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg folks \
-       --pkg folks-test \
-       --pkg folks-libsocialweb \
-       --pkg libsocialweb-client \
-       --pkg libsocialweb-test \
-       -g \
-       $(NULL)
-
 # in order from least to most complex
 noinst_PROGRAMS = \
        dummy-lsw \
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index 4235f4e..645fdce 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -1,68 +1,48 @@
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
+include $(top_srcdir)/tests/test.mk
+
+AM_VALAFLAGS = \
+       $(test_valaflags) \
+       --vapidir=$(abs_top_srcdir)/tests/lib/telepathy/contactlist/ \
+       --vapidir=$(abs_top_builddir)/tests/lib/telepathy/contactlist/ \
+       --vapidir=$(abs_top_srcdir)/tests/lib/telepathy \
+       --vapidir=$(abs_top_builddir)/tests/lib/telepathy \
+       --vapidir=$(abs_top_srcdir)/tests/lib/key-file \
+       --vapidir=$(abs_top_builddir)/tests/lib/key-file \
+       --vapidir=$(abs_top_srcdir)/backends/telepathy/lib \
+       --vapidir=$(abs_top_builddir)/backends/telepathy/lib \
+       --pkg telepathy-glib \
+       --pkg folks-telepathy \
+       --pkg kf-test \
+       --pkg tpf-test \
+       --pkg tp-test-contactlist \
        $(NULL)
 
 AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GEE_CFLAGS) \
+       $(test_cppflags) \
        $(TP_GLIB_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
        -I$(top_srcdir)/backends/telepathy \
        -I$(top_srcdir)/backends/telepathy/lib \
        -I$(top_srcdir)/backends/telepathy/lib/folks \
-       -I$(top_srcdir)/tests/lib \
        -I$(top_srcdir)/tests/lib/key-file \
        -I$(top_srcdir)/tests/lib/telepathy \
        -I$(top_srcdir)/tests/lib/telepathy/contactlist \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
+       $(NULL)
+
+AM_CFLAGS = \
+       $(test_cflags) \
        $(NULL)
 
 LDADD = \
-       $(top_builddir)/tests/lib/libfolks-test.la \
+       $(AM_LDADD) \
+       $(test_ldadd) \
        $(top_builddir)/tests/lib/key-file/libkf-test.la \
        $(top_builddir)/tests/lib/telepathy/libtpf-test.la \
        $(top_builddir)/tests/lib/telepathy/contactlist/libtp-test-contactlist.la \
        $(top_builddir)/backends/telepathy/lib/libfolks-telepathy.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GIO_LIBS) \
-       $(GEE_LIBS) \
        $(TP_GLIB_LIBS) \
        -L$(top_srcdir)/backends/telepathy/lib \
        $(NULL)
 
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
-       --vapidir=$(abs_top_srcdir)/tests/lib/telepathy/contactlist/ \
-       --vapidir=$(abs_top_builddir)/tests/lib/telepathy/contactlist/ \
-       --vapidir=$(abs_top_srcdir)/tests/lib/telepathy \
-       --vapidir=$(abs_top_builddir)/tests/lib/telepathy \
-       --vapidir=$(abs_top_srcdir)/tests/lib/key-file \
-       --vapidir=$(abs_top_builddir)/tests/lib/key-file \
-       --vapidir=$(abs_top_srcdir)/tests/lib/ \
-       --vapidir=$(abs_top_builddir)/tests/lib/ \
-       --vapidir=$(abs_srcdir) \
-       --vapidir=$(abs_builddir) \
-       --vapidir=$(abs_top_srcdir)/folks \
-       --vapidir=$(abs_top_builddir)/folks \
-       --vapidir=$(abs_top_srcdir)/backends/telepathy/lib \
-       --vapidir=$(abs_top_builddir)/backends/telepathy/lib \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg gmodule-2.0 \
-       --pkg telepathy-glib \
-       --pkg folks \
-       --pkg folks-telepathy \
-       --pkg folks-test \
-       --pkg kf-test \
-       --pkg tpf-test \
-       --pkg tp-test-contactlist \
-       -g \
-       $(NULL)
-
 TESTS_ENVIRONMENT = \
        FOLKS_BACKEND_KEY_FILE_PATH=$(srcdir)/data/relationships-empty.ini \
        $(top_srcdir)/tests/tools/execute-test.sh \
diff --git a/tests/test.mk b/tests/test.mk
new file mode 100644
index 0000000..32c7fe9
--- /dev/null
+++ b/tests/test.mk
@@ -0,0 +1,59 @@
+#
+# Common build variable values for folks tests.
+#
+# There are no required variables or targets. The variables defined here will
+# apply to all Makefile targets.
+#
+# Note that this file must be included before any of the variables it defines
+# are defined, as it does not append to them.
+#
+# Defined variables (these must be included in the test-specific variables):
+#  - test_valaflags
+#  - test_cppflags
+#  - test_cflags
+#  - test_ldadd
+# The defined variables include flags for the standard dependencies:
+#  - folks
+#  - folks-test
+#  - GIO
+#  - GLib
+#  - libgee
+# but do *not* include the relevant $(AM_*) variables.
+
+test_valaflags = \
+       $(TARGET_VALAFLAGS) \
+       $(ERROR_VALAFLAGS) \
+       --vapidir=. \
+       --vapidir=$(top_srcdir)/folks \
+       --vapidir=$(top_builddir)/folks \
+       --vapidir=$(top_srcdir)/tests/lib \
+       --pkg folks \
+       --pkg folks-test \
+       --pkg gee-0.8 \
+       --pkg gio-2.0 \
+       --pkg gobject-2.0 \
+       -g \
+       $(NULL)
+
+test_cppflags = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/folks \
+       -I$(top_srcdir)/tests/lib \
+       -include $(CONFIG_HEADER) \
+       -include $(top_srcdir)/folks/warnings.h \
+       $(NULL)
+
+test_cflags = \
+       $(ERROR_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GLIB_CFLAGS) \
+       $(GEE_CFLAGS) \
+       $(NULL)
+
+test_ldadd = \
+       $(top_builddir)/folks/libfolks.la \
+       $(top_builddir)/tests/lib/libfolks-test.la \
+       $(GIO_LIBS) \
+       $(GLIB_LIBS) \
+       $(GEE_LIBS) \
+       $(NULL)
diff --git a/tests/tracker/Makefile.am b/tests/tracker/Makefile.am
index 095301c..0882260 100644
--- a/tests/tracker/Makefile.am
+++ b/tests/tracker/Makefile.am
@@ -1,58 +1,43 @@
+include $(top_srcdir)/tests/test.mk
+
 # This forces serialization of the tests because they run into terrible race
 # conditions if run in parallel (ie, make -jN, n > 1)
 #
 # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=709120
 .NOTPARALLEL:
 
-AM_CFLAGS = \
-       $(ERROR_CFLAGS) \
+AM_VALAFLAGS = \
+       $(test_valaflags) \
+       --vapidir=$(top_srcdir)/backends/tracker/lib \
+       --vapidir=$(top_srcdir)/tests/lib/tracker \
+       --pkg folks-tracker \
+       --pkg tracker-sparql-$(TRACKER_SPARQL_MAJOR) \
+       --pkg tracker-test \
        $(NULL)
 
 AM_CPPFLAGS = \
-       $(GLIB_CFLAGS) \
-       $(GEE_CFLAGS) \
+       $(test_cppflags) \
        $(TRACKER_SPARQL_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/folks \
        -I$(top_srcdir)/backends/tracker/lib \
        -I$(top_srcdir)/backends/tracker/lib/folks \
-       -I$(top_srcdir)/tests/lib \
        -I$(top_srcdir)/tests/lib/tracker \
-       -include $(CONFIG_HEADER) \
-       -include $(top_srcdir)/folks/warnings.h \
+       $(NULL)
+
+AM_CFLAGS = \
+       $(test_cflags) \
        $(NULL)
 
 LDADD = \
-       $(top_builddir)/tests/lib/libfolks-test.la \
+       $(AM_LDADD) \
+       $(test_ldadd) \
        $(top_builddir)/tests/lib/tracker/libtracker-test.la \
        $(top_builddir)/backends/tracker/lib/libfolks-tracker.la \
-       $(top_builddir)/folks/libfolks.la \
-       $(GLIB_LIBS) \
-       $(GEE_LIBS) \
        $(TRACKER_SPARQL_LIBS) \
        -L$(top_srcdir)/backends/tracker/lib \
        $(NULL)
 
 RUN_WITH_PRIVATE_BUS = $(top_srcdir)/tests/tools/with-session-bus-tracker.sh
 
-AM_VALAFLAGS += \
-       $(ERROR_VALAFLAGS) \
-       --vapidir=. \
-       --vapidir=$(top_srcdir)/folks \
-       --vapidir=$(top_srcdir)/backends/tracker/lib \
-       --vapidir=$(top_srcdir)/tests/lib \
-       --vapidir=$(top_srcdir)/tests/lib/tracker \
-       --pkg gobject-2.0 \
-       --pkg gio-2.0 \
-       --pkg gee-0.8 \
-       --pkg folks \
-       --pkg folks-test \
-       --pkg folks-tracker \
-       --pkg tracker-sparql-$(TRACKER_SPARQL_MAJOR) \
-       --pkg tracker-test \
-       -g \
-       $(NULL)
-
 # in order from least to most complex
 noinst_PROGRAMS = \
        individual-retrieval \


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