[gtk+] build: Enable subdir-objects



commit 59af3a0c15c44b97920fec7afbf289ceddd4ba69
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Oct 19 15:21:03 2016 +0100

    build: Enable subdir-objects
    
    Newer versions of Automake warn about forward compatibility when the
    build uses sources in sub-directories without the subdir-objects option.
    
    Both GTK+ and GDK have an almost-but-not-quite non-recursive Automake
    layout, with sources in sub-directories contributing to the build of a
    top-level object.
    
    In theory, just adding subdir-objects to AM_INIT_AUTOMAKE would be
    enough, but the test suite references sources in a different top-level
    in order to build tests that verify the implementation of private data
    structures. This is not really allowed when using subdir-objects and out
    of srcdir builds. In order to fix this case, we require some ad hoc
    rules to create symbolic links in the appropriate build directory.

 configure.ac              |    2 +-
 testsuite/gtk/Makefile.am |   52 +++++++++++++++++++++++++++++---------------
 2 files changed, 35 insertions(+), 19 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3d5cb6e..f93c2d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ AC_SUBST(INTROSPECTION_REQUIRED_VERSION)
 # Save this value here, since automake will set cflags later
 cflags_set=${CFLAGS+set}
 
-AM_INIT_AUTOMAKE([1.11 -Wall no-define -Wno-portability tar-ustar no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE([1.14 subdir-objects -Wall no-define -Wno-portability tar-ustar no-dist-gzip dist-xz])
 AM_MAINTAINER_MODE([enable])
 
 # Support silent build rules. Disable
diff --git a/testsuite/gtk/Makefile.am b/testsuite/gtk/Makefile.am
index 0ea22f3..b0a487f 100644
--- a/testsuite/gtk/Makefile.am
+++ b/testsuite/gtk/Makefile.am
@@ -24,6 +24,9 @@ LDADD = \
        $(top_builddir)/gdk/libgdk-4.la \
        $(GTK_DEP_LIBS)
 
+CLEANFILES =
+BUILT_SOURCES =
+
 noinst_PROGRAMS = $(TEST_PROGS)
 
 TESTS_ENVIRONMENT = \
@@ -114,19 +117,26 @@ rbtree_CFLAGS  = -DGTK_COMPILATION -UG_ENABLE_DEBUG
 rbtree_LDADD = $(GTK_DEP_LIBS)
 rbtree_SOURCES =                       \
        rbtree.c                        \
-       $(top_srcdir)/gtk/gtkrbtree.h   \
-       $(top_srcdir)/gtk/gtkrbtree.c   \
+       gtkrbtree.c                     \
        $(NULL)
 
+gtkrbtree.c: $(top_srcdir)/gtk/gtkrbtree.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+CLEANFILES += gtkrbtree.c
+
 bitmask_CFLAGS  = -DGTK_COMPILATION -UG_ENABLE_DEBUG
 bitmask_LDADD = $(GTK_DEP_LIBS)
-bitmask_SOURCES =                                      \
-       bitmask.c                                       \
-       $(top_srcdir)/gtk/gtkbitmaskprivate.h           \
-       $(top_srcdir)/gtk/gtkallocatedbitmaskprivate.h  \
-       $(top_srcdir)/gtk/gtkallocatedbitmask.c         \
+bitmask_SOURCES =                      \
+       bitmask.c                       \
+       gtkallocatedbitmask.c           \
        $(NULL)
 
+gtkallocatedbitmask.c: $(top_srcdir)/gtk/gtkallocatedbitmask.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+CLEANFILES += gtkallocatedbitmask.c
+
 keyhash_CFLAGS =                                       \
        -DGTK_COMPILATION                               \
        -DGTK_LIBDIR=\"$(libdir)\"                      \
@@ -135,16 +145,23 @@ keyhash_CFLAGS =                                  \
        -DGTK_SYSCONFDIR=\"$(sysconfdir)\"              \
        $(NULL)
 
-keyhash_SOURCES        =                                       \
-       keyhash.c                                       \
-       $(top_srcdir)/gtk/gtkkeyhash.c                  \
-       $(top_srcdir)/gtk/gtkkeyhash.h                  \
-       $(top_builddir)/gtk/gtkresources.c              \
-       $(top_builddir)/gtk/gtkresources.h              \
-       $(top_srcdir)/gtk/gtkprivate.c                  \
-       $(top_srcdir)/gtk/gtkprivate.h                  \
+keyhash_SOURCES        =               \
+       keyhash.c               \
+       gtkkeyhash.c            \
+       gtkresources.c          \
+       gtkprivate.c            \
        $(NULL)
 
+gtkkeyhash.c: $(top_srcdir)/gtk/gtkkeyhash.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+gtkresources.c: $(top_builddir)/gtk/gtkresources.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+gtkprivate.c: $(top_srcdir)/gtk/gtkprivate.c
+       $(AM_V_GEN) $(LN_S) $^ $@
+
+CLEANFILES += gtkkeyhash.c gtkresources.c gtkprivate.c
 
 test_icontheme =                                       \
        icons/index.theme                               \
@@ -253,9 +270,8 @@ GTK_GSETTINGS_SCHEMAS = \
        $(top_srcdir)/gtk/org.gtk.Settings.FileChooser.gschema.xml \
        $(NULL)
 
-BUILT_SOURCES = gschemas.compiled
-
-CLEANFILES = gschemas.compiled
+BUILT_SOURCES += gschemas.compiled
+CLEANFILES += gschemas.compiled
 
 gschemas.compiled: $(GTK_GSETTINGS_SCHEMAS)
        $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) \


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