[glib] build: Use subdir-objects with Autotools



commit 5c13bf9bcf0f2c585ae97a7380f82f068264eea2
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Oct 14 15:42:31 2017 +0100

    build: Use subdir-objects with Autotools
    
    We're eventually going to drop Autotools, but in the meantime we should
    probably use idiomatic options and reduce warnings.
    
    GLib is pretty much already safe for subdir-objects to be enabled,
    except in the GIO tests, where the build references files that are
    generated in a different level. For that, we can use the same solution
    employed by GTK+, and link the appropriate file in the right
    sub-directory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788989

 configure.ac          |    2 +-
 gio/tests/Makefile.am |   26 ++++++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9cd1510..b34ec4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,7 +63,7 @@ AC_CONFIG_MACRO_DIR([m4macros])
 # Save this value here, since automake will set cflags later
 cflags_set=${CFLAGS:+set}
 
-AM_INIT_AUTOMAKE([1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
+AM_INIT_AUTOMAKE([1.14 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar subdir-objects])
 AM_MAINTAINER_MODE([enable])
 
 # Support silent build rules. Disable
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 4e269dc..4a04dd9 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -231,11 +231,29 @@ socket_client_SOURCES = \
 EXTRA_DIST += socket-common.c
 
 uninstalled_test_extra_programs += gdbus-daemon
+gdbus_daemon_SOURCES = gdbus-daemon.c
 nodist_gdbus_daemon_SOURCES = \
-       $(top_builddir)/gio/gdbus-daemon-generated.c
-gdbus_daemon_SOURCES = \
-       gdbus-daemon.c                          \
-       $(top_srcdir)/gio/gdbusdaemon.c
+       gdbus-daemon-generated.c \
+       gdbus-daemon-impl.c
+CLEANFILES += gdbus-daemon-impl.c gdbus-daemon-generated.c gdbus-daemon-generated.h
+
+# With subdir-objects we need to create a link to the original
+# file in the right directory, otherwise libtool will complain
+# that it cannot find the wrapper file
+gdbus-daemon-impl.c: $(top_srcdir)/gio/gdbusdaemon.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+# These files are only generated on Windows builds inside GIO,
+# but we want them on non-Windows builds for the tests
+gdbus-daemon-generated.h gdbus-daemon-generated.c: $(top_srcdir)/gio/dbus-daemon.xml $(GDBUS_PYTHON_DEPS)
+       $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
+               UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
+               $(PYTHON) $(top_srcdir)/gio/gdbus-2.0/codegen/gdbus-codegen.in \
+               --interface-prefix org. \
+               --generate-c-code gdbus-daemon-generated \
+               --c-namespace _G \
+               $(top_srcdir)/gio/dbus-daemon.xml \
+               $(NULL)
 
 # -----------------------------------------------------------------------------
 #  Test programs buildable on UNIX only


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