[json-glib] build: Enable subdir-objects



commit 52cf02caa0db2eee99c3a1145319eea5806b2977
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Mar 15 17:42:58 2015 +0000

    build: Enable subdir-objects
    
    We need to remove the path specification inside the sources listing, and
    modify the enumeration type and marshallers generation rules to cope
    with it (by adding the $(srcdir) when needed). This is similar to the
    changes there were made to Clutter.

 .gitignore                          |    1 +
 build/autotools/Makefile.am.enums   |   29 +++++++++-----
 build/autotools/Makefile.am.marshal |   17 ++++++--
 configure.ac                        |    2 +-
 json-glib/Makefile.am               |   70 +++++++++++++++++-----------------
 5 files changed, 68 insertions(+), 51 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 53c477f..230eb06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ json-glib.pc
 /json-lcov
 .deps
 .libs
+.dirstamp
 *.o
 *.lo
 *.test
diff --git a/build/autotools/Makefile.am.enums b/build/autotools/Makefile.am.enums
index 7e2e8a4..2fd69d5 100644
--- a/build/autotools/Makefile.am.enums
+++ b/build/autotools/Makefile.am.enums
@@ -15,18 +15,28 @@
 #
 # Author: Emmanuele Bassi <ebassi linux intel com>
 
-enum_tmpl_h=$(glib_enum_h:.h=.h.in)
-enum_tmpl_c=$(glib_enum_c:.c=.c.in)
+# Basic sanity checks
+$(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS))
+
+$(if $(or $(glib_enum_h), \
+          $(glib_enum_c)),, \
+    $(error Need to define glib_enum_h and glib_enum_c))
+
+$(if $(glib_enum_headers),,$(error Need to define glib_enum_headers))
+
+enum_tmpl_h=$(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in))
+enum_tmpl_c=$(addprefix $(srcdir)/, $(glib_enum_c:.c=.c.in))
+enum_headers=$(addprefix $(srcdir)/, $(glib_enum_headers))
 
 CLEANFILES += stamp-enum-types
 DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c)
 BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c)
-EXTRA_DIST += $(srcdir)/$(enum_tmpl_h) $(srcdir)/$(enum_tmpl_c)
+EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c)
 
-stamp-enum-types: $(glib_enum_headers) $(srcdir)/$(enum_tmpl_h)
+stamp-enum-types: $(enum_headers) $(enum_tmpl_h)
        $(AM_V_GEN)$(GLIB_MKENUMS) \
-               --template $(srcdir)/$(enum_tmpl_h) \
-       $(glib_enum_headers) > xgen-eh \
+               --template $(enum_tmpl_h) \
+       $(enum_headers) > xgen-eh \
        && (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \
        && rm -f xgen-eh \
        && echo timestamp > $(@F)
@@ -34,10 +44,9 @@ stamp-enum-types: $(glib_enum_headers) $(srcdir)/$(enum_tmpl_h)
 $(glib_enum_h): stamp-enum-types
        @true
 
-$(glib_enum_c): $(glib_enum_h) $(srcdir)/$(enum_tmpl_c)
+$(glib_enum_c): $(enum_headers) $(enum_tmpl_h) $(enum_tmpl_c)
        $(AM_V_GEN)$(GLIB_MKENUMS) \
-               --template $(srcdir)/$(enum_tmpl_c) \
-       $(glib_enum_headers) > xgen-ec \
+               --template $(enum_tmpl_c) \
+       $(enum_headers) > xgen-ec \
        && cp -f xgen-ec $(glib_enum_c) \
        && rm -f xgen-ec
-
diff --git a/build/autotools/Makefile.am.marshal b/build/autotools/Makefile.am.marshal
index f2b4996..89d3222 100644
--- a/build/autotools/Makefile.am.marshal
+++ b/build/autotools/Makefile.am.marshal
@@ -14,19 +14,27 @@
 #
 # Author: Emmanuele Bassi <ebassi linux intel com>
 
+# Basic sanity checks
+$(if $(GLIB_GENMARSHAL),,$(error Need to define GLIB_GENMARSHAL))
+
+$(if $(or $(glib_marshal_list), \
+          $(glib_marshal_prefix)),, \
+    $(error Need to define glib_marshal_list and glib_marshal_prefix))
+
 marshal_h = $(glib_marshal_list:.list=.h)
 marshal_c = $(glib_marshal_list:.list=.c)
+marshal_list = $(addprefix $(srcdir)/, $(glib_marshal_list))
 
 CLEANFILES += stamp-marshal
 DISTCLEANFILES += $(marshal_h) $(marshal_c)
 BUILT_SOURCES += $(marshal_h) $(marshal_c)
-EXTRA_DIST += $(srcdir)/$(glib_marshal_list)
+EXTRA_DIST += $(marshal_list)
 
-stamp-marshal: $(glib_marshal_list)
+stamp-marshal: $(marshal_list)
        $(AM_V_GEN)$(GLIB_GENMARSHAL) \
                --prefix=$(glib_marshal_prefix) \
                --header \
-       $(srcdir)/$(glib_marshal_list) > xgen-mh \
+       $(marshal_list) > xgen-mh \
        && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
        && rm -f xgen-mh \
        && echo timestamp > $(@F)
@@ -39,7 +47,6 @@ $(marshal_c): $(marshal_h)
        $(GLIB_GENMARSHAL) \
                --prefix=$(glib_marshal_prefix) \
                --body \
-       $(srcdir)/$(glib_marshal_list)) > xgen-mc \
+       $(marshal_list)) > xgen-mc \
        && cp xgen-mc $(marshal_c) \
        && rm -f xgen-mc
-
diff --git a/configure.ac b/configure.ac
index 6a43504..ebbd68b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,7 @@ AC_CONFIG_SRCDIR([json-glib/json-glib.h])
 AC_CONFIG_AUX_DIR([build])
 AC_CONFIG_MACRO_DIR([build/autotools])
 
-AM_INIT_AUTOMAKE([1.11 no-define foreign -Wno-portability dist-xz no-dist-gzip tar-ustar])
+AM_INIT_AUTOMAKE([1.11 no-define foreign -Wno-portability dist-xz no-dist-gzip tar-ustar subdir-objects])
 
 AM_SILENT_RULES([yes])
 AM_PATH_GLIB_2_0
diff --git a/json-glib/Makefile.am b/json-glib/Makefile.am
index 85fb818..13e024a 100644
--- a/json-glib/Makefile.am
+++ b/json-glib/Makefile.am
@@ -15,40 +15,40 @@ SUBDIRS = . tests
 
 # main library
 source_h = \
-       $(top_srcdir)/json-glib/json-builder.h          \
-       $(top_srcdir)/json-glib/json-generator.h        \
-       $(top_srcdir)/json-glib/json-gobject.h          \
-       $(top_srcdir)/json-glib/json-gvariant.h         \
-       $(top_srcdir)/json-glib/json-parser.h           \
-       $(top_srcdir)/json-glib/json-path.h             \
-       $(top_srcdir)/json-glib/json-reader.h           \
-       $(top_srcdir)/json-glib/json-types.h            \
-       $(top_srcdir)/json-glib/json-version-macros.h   \
+       json-builder.h          \
+       json-generator.h        \
+       json-gobject.h          \
+       json-gvariant.h         \
+       json-parser.h           \
+       json-path.h             \
+       json-reader.h           \
+       json-types.h            \
+       json-version-macros.h   \
        $(NULL)
 
 source_h_private = \
-       $(top_srcdir)/json-glib/json-debug.h            \
-       $(top_srcdir)/json-glib/json-gobject-private.h  \
-       $(top_srcdir)/json-glib/json-scanner.h          \
-       $(top_srcdir)/json-glib/json-types-private.h    \
+       json-debug.h            \
+       json-gobject-private.h  \
+       json-scanner.h          \
+       json-types-private.h    \
        $(NULL)
 
 source_c = \
-       $(srcdir)/json-array.c          \
-       $(srcdir)/json-builder.c        \
-       $(srcdir)/json-debug.c          \
-       $(srcdir)/json-gboxed.c         \
-       $(srcdir)/json-generator.c      \
-       $(srcdir)/json-gobject.c        \
-       $(srcdir)/json-gvariant.c       \
-       $(srcdir)/json-node.c           \
-       $(srcdir)/json-object.c         \
-       $(srcdir)/json-parser.c         \
-       $(srcdir)/json-path.c           \
-       $(srcdir)/json-reader.c         \
-       $(srcdir)/json-scanner.c        \
-       $(srcdir)/json-serializable.c   \
-       $(srcdir)/json-value.c          \
+       json-array.c            \
+       json-builder.c  \
+       json-debug.c            \
+       json-gboxed.c           \
+       json-generator.c        \
+       json-gobject.c  \
+       json-gvariant.c \
+       json-node.c             \
+       json-object.c   \
+       json-parser.c   \
+       json-path.c             \
+       json-reader.c           \
+       json-scanner.c  \
+       json-serializable.c     \
+       json-value.c            \
        $(NULL)
 
 DISTCLEANFILES += json-version.h
@@ -83,10 +83,10 @@ libjson_glib_1_0_la_LDFLAGS = $(JSON_LT_LDFLAGS) $(JSON_GCOV_LDADD) -export-dyna
 
 jsonincludedir = $(includedir)/json-glib-1.0/json-glib
 jsoninclude_DATA = \
-       $(source_h)                                     \
-       $(top_builddir)/json-glib/json-enum-types.h     \
-       $(top_builddir)/json-glib/json-version.h        \
-       $(top_srcdir)/json-glib/json-glib.h             \
+       $(source_h) \
+       json-enum-types.h \
+       json-version.h \
+       json-glib.h \
        $(NULL)
 
 EXTRA_DIST += json-version.h.in json-glib.h json-version.h
@@ -123,9 +123,9 @@ INTROSPECTION_GIRS = Json-1.0.gir
 introspection_source = \
        $(source_c) \
        $(source_h) \
-       $(top_builddir)/json-glib/json-enum-types.h \
-       $(top_builddir)/json-glib/json-enum-types.c \
-       $(top_builddir)/json-glib/json-version.h
+       json-enum-types.h \
+       json-enum-types.c \
+       json-version.h
 
 Json-1.0.gir: libjson-glib-1.0.la Makefile
 


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