[libchamplain] Many improvements to the build process



commit 0881ef875fb66b96de88c4f3b0522508d3c980b0
Author: JiÅ?í Techet <techet gmail com>
Date:   Sun May 9 00:01:50 2010 +0200

    Many improvements to the build process
    
    * be less verbose during build
    * use templates for generated enum files
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 bindings/python/champlain-gtk/Makefile.am     |    2 +-
 bindings/python/champlain/Makefile.am         |    4 +-
 champlain-gtk/Makefile.am                     |   23 ++++---
 champlain/Makefile.am                         |   82 +++++++++----------------
 champlain/champlain-enum-types.c.in           |   33 ++++++++++
 champlain/champlain-enum-types.h.in           |   24 +++++++
 champlain/champlain-local-map-data-source.c   |    1 +
 champlain/champlain-map-data-source.c         |    1 +
 champlain/champlain-network-map-data-source.c |    1 +
 configure.ac                                  |    3 +-
 docs/Makefile.am                              |    8 +++
 tidy/Makefile.am                              |   15 ++---
 12 files changed, 119 insertions(+), 78 deletions(-)
---
diff --git a/bindings/python/champlain-gtk/Makefile.am b/bindings/python/champlain-gtk/Makefile.am
index 1722287..133ae96 100644
--- a/bindings/python/champlain-gtk/Makefile.am
+++ b/bindings/python/champlain-gtk/Makefile.am
@@ -40,7 +40,7 @@ champlaingtk_la_LDFLAGS =					\
 	-module -avoid-version
 
 pychamplaingtk.c: pychamplaingtk.override pychamplaingtk.defs
-	$(PYGOBJECTCODEGEN)				\
+	$(AM_V_GEN)$(PYGOBJECTCODEGEN)				\
 		--prefix champlain 			\
 		--register $(PYDEFS)/gdk-types.defs 	\
 		--register $(PYDEFS)/gtk-types.defs 	\
diff --git a/bindings/python/champlain/Makefile.am b/bindings/python/champlain/Makefile.am
index faecf61..8e904ec 100644
--- a/bindings/python/champlain/Makefile.am
+++ b/bindings/python/champlain/Makefile.am
@@ -56,14 +56,14 @@ codegen_register = \
 	--register $(PYGTKDEFS)/pango-types.defs
 
 pychamplain.c: pychamplain.override pychamplain.defs
-	$(PYGOBJECTCODEGEN)		\
+	$(AM_V_GEN)$(PYGOBJECTCODEGEN)		\
 		$(codegen_register)	\
 		--prefix champlain	\
 		--override pychamplain.override		\
 		pychamplain.defs > $@
 
 pychamplainmemphis.c: pychamplainmemphis.override pychamplainmemphis.defs
-	$(PYGOBJECTCODEGEN)		\
+	$(AM_V_GEN)$(PYGOBJECTCODEGEN)		\
 		$(codegen_register)	\
 		--register $(PYMEMPHISDEFS)/memphis-types.defs	\
 		--register pychamplain.defs	\
diff --git a/champlain-gtk/Makefile.am b/champlain-gtk/Makefile.am
index 2c4e8c9..a388d1d 100644
--- a/champlain-gtk/Makefile.am
+++ b/champlain-gtk/Makefile.am
@@ -5,13 +5,10 @@ BUILT_SOURCES = \
 
 CLEANFILES = $(BUILT_SOURCES)
 
-CHAMPLAIN_GTK_MARSHAL = champlain-gtk-marshal
-CHAMPLAIN_GTK_MARSHAL_LIST = champlain-gtk-marshal.list
-
 lib_LTLIBRARIES = libchamplain-gtk- CHAMPLAIN_API_VERSION@.la
 
 libchamplain_gtk_ CHAMPLAIN_API_VERSION@_la_SOURCES = \
-	$(CHAMPLAIN_GTK_MARSHAL_LIST)		 \
+	champlain-gtk-marshal.list		 \
 	$(BUILT_SOURCES) 			\
 	gtk-champlain-embed.c
 
@@ -20,11 +17,15 @@ noinst_HEADERS = gtk-champlain-embed.h
 libchamplain_gtk_ CHAMPLAIN_API_VERSION@_la_LIBADD = $(GTK_LIBS) 	\
 	$(top_builddir)/champlain/libchamplain- CHAMPLAIN_API_VERSION@.la
 
-champlain-gtk-marshal.h: $(CHAMPLAIN_GTK_MARSHAL_LIST)
-	@GLIB_GENMARSHAL@ --header --prefix=champlain_gtk_marshal $< > $(CHAMPLAIN_GTK_MARSHAL).h
+champlain-gtk-marshal.h: champlain-gtk-marshal.list
+	$(AM_V_GEN) ( $(GLIB_GENMARSHAL) --header --prefix=champlain_gtk_marshal champlain-gtk-marshal.list > champlain-gtk-marshal.tmp \
+	&& mv champlain-gtk-marshal.tmp champlain-gtk-marshal.h ) \
+	|| ( rm -f champlain-gtk-marshal.tmp && exit 1 )
 
-champlain-gtk-marshal.c: $(CHAMPLAIN_GTK_MARSHAL_LIST)
-	@GLIB_GENMARSHAL@ --body --prefix=champlain_gtk_marshal $< > $(CHAMPLAIN_GTK_MARSHAL).c
+champlain-gtk-marshal.c: champlain-gtk-marshal.h
+	$(AM_V_GEN) ( (echo '#include "champlain-gtk-marshal.h"'; $(GLIB_GENMARSHAL) --prefix=champlain_gtk_marshal $(srcdir)/champlain-gtk-marshal.list --body) > champlain-gtk-marshal.tmp \
+	&& mv champlain-gtk-marshal.tmp champlain-gtk-marshal.c ) \
+	|| ( rm -f champlain-gtk-marshal.tmp && exit 1 )
 
 libchamplain_includedir=$(includedir)/libchamplain-gtk- CHAMPLAIN_API_VERSION@/champlain-gtk
 libchamplain_include_HEADERS = champlain-gtk.h gtk-champlain-embed.h
@@ -34,13 +35,13 @@ libchamplain_gtk_ CHAMPLAIN_API_VERSION@_la_LDFLAGS= -version-info $(LIBRARY_VER
 AM_CPPFLAGS = $(GTK_CFLAGS) -I$(top_srcdir) -DCHAMPLAIN_GTK_COMPILATION
 AM_LDFLAGS = $(GTK_LIBS) -export-symbols-regex ^gtk_champlain_.*
 
-EXTRA_DIST = $(CHAMPLAIN_GTK_MARSHAL_LIST)
+EXTRA_DIST = champlain-gtk-marshal.list
 
 if HAVE_INTROSPECTION
 BUILT_GIRSOURCES =
 
 GtkChamplain- CHAMPLAIN_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libchamplain-gtk- CHAMPLAIN_API_VERSION@.la
-	$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+	$(AM_V_GEN)$(INTROSPECTION_SCANNER) -v \
 	--namespace GtkChamplain --nsversion= CHAMPLAIN_API_VERSION@ \
 	--strip-prefix=GtkChamplain \
 	$(GTK_CFLAGS) \
@@ -72,7 +73,7 @@ typelibsdir = $(libdir)/girepository-1.0/
 typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
 
 GtkChamplain- CHAMPLAIN_API_VERSION@.typelib: GtkChamplain- CHAMPLAIN_API_VERSION@.gir $(INTROSPECTION_COMPILER)
-	$(QUIET_GEN)$(DEBUG) $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. --includedir=$(top_builddir)/champlain $(INTROSPECTION_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+	$(AM_V_GEN)$(DEBUG) $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. --includedir=$(top_builddir)/champlain $(INTROSPECTION_COMPILER_OPTS) $< -o $(builddir)/$(@F)
 
 CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
 endif
diff --git a/champlain/Makefile.am b/champlain/Makefile.am
index d37ef07..5a7b693 100644
--- a/champlain/Makefile.am
+++ b/champlain/Makefile.am
@@ -4,18 +4,14 @@ BUILT_SOURCES = \
 	champlain-marshal.c \
 	champlain-enum-types.h \
 	champlain-enum-types.c \
-	stamp-enum-types \
 	champlain-version.h \
 	champlain-features.h
 
-champlain-features.h:
-	cd $(top_builddir) && ./config.status src/$@
+champlain-features.h: $(top_builddir)/config.status
+	$(AM_V_GEN) ( cd $(top_builddir) && ./config.status champlain/$@ )
 
 CLEANFILES = $(BUILT_SOURCES)
 
-CHAMPLAIN_MARSHAL = champlain-marshal
-CHAMPLAIN_MARSHAL_LIST = champlain-marshal.list
-
 lib_LTLIBRARIES = libchamplain- CHAMPLAIN_API_VERSION@.la
 
 if ENABLE_MEMPHIS
@@ -62,7 +58,7 @@ memphis_sources = \
 endif
 
 libchamplain_ CHAMPLAIN_API_VERSION@_la_SOURCES = \
-	$(CHAMPLAIN_MARSHAL_LIST) 	\
+	champlain-marshal.list	 	\
 	$(BUILT_SOURCES) 		\
 	$(libchamplain_headers)		\
 	$(memphis_sources)		\
@@ -133,53 +129,31 @@ AM_CPPFLAGS = 				\
 	-DCHAMPLAIN_COMPILATION 	\
 	$(WARN_CFLAGS)
 
-EXTRA_DIST = $(CHAMPLAIN_MARSHAL_LIST)
-
-champlain-marshal.h: $(CHAMPLAIN_MARSHAL_LIST)
-	@GLIB_GENMARSHAL@ --header --prefix=cpl_marshal $< > $(CHAMPLAIN_MARSHAL).h
-
-champlain-marshal.c: $(CHAMPLAIN_MARSHAL_LIST)
-	@GLIB_GENMARSHAL@ --body --prefix=cpl_marshal $< > $(CHAMPLAIN_MARSHAL).c
-
-champlain-enum-types.h: stamp-enum-types
-	@true
-
-stamp-enum-types: $(libchamplain_headers) Makefile
-	(cd $(srcdir) \
-	&& glib-mkenums \
-			--fhead "#ifndef __CHAMPLAIN_ENUM_TYPES_H__\n" \
-			--fhead "#define __CHAMPLAIN_ENUM_TYPES_H__ 1\n\n" \
-			--fhead "#include <glib-object.h>\n\n" \
-			--fhead "G_BEGIN_DECLS\n\n" \
-			--ftail "G_END_DECLS\n\n" \
-			--ftail "#endif /* __CHAMPLAIN_ENUM_TYPES_H__ */\n" \
-			--fprod "#include <champlain/@filename@>\n" \
-			--eprod "#define CHAMPLAIN_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
-			--eprod "GType @enum_name _get_type (void);\n" \
-		$(libchamplain_headers) ) > xgen-gth \
-	&& (cmp -s xgen-gth champlain-enum-type.h || cp xgen-gth champlain-enum-types.h) \
-	&& rm -f xgen-gth \
-	&& echo timestamp > $(@F)
-
-champlain-enum-types.c: $(libchamplain_headers) Makefile
-	(cd $(srcdir) \
-	&& glib-mkenums \
-			--fhead "#include <config.h>\n" \
-			--fhead "#include <glib-object.h>\n" \
-			--fhead "#include \"champlain-enum-types.h\"\n\n" \
-			--fprod "\n/* enumerations from \"@filename \" */" \
-	--vhead "static const G Type@Value _ enum_name@_values[] = {" \
-			--vprod "  { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
-			--vtail "  { 0, NULL, NULL }\n};\n\n" \
-			--vtail "GType\n enum_name@_get_type (void)\n{\n" \
-			--vtail "  static GType type = 0;\n\n" \
-			--vtail "  if (!type)\n" \
-			--vtail "    type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
-			--vtail "  return type;\n}\n\n" \
-		$(libchamplain_headers) ) > xgen-gtc \
-	&& cp xgen-gtc $(@F) \
-	&& rm -f xgen-gtc
+EXTRA_DIST = champlain-marshal.list \
+	champlain-enum-types.h.in \
+	champlain-enum-types.c.in
+
+champlain-marshal.h: champlain-marshal.list
+	$(AM_V_GEN) ( $(GLIB_GENMARSHAL) --header --prefix=cpl_marshal champlain-marshal.list > champlain-marshal.tmp \
+	&& mv champlain-marshal.tmp champlain-marshal.h ) \
+	|| ( rm -f champlain-marshal.tmp && exit 1 )
+
+champlain-marshal.c: champlain-marshal.h
+	$(AM_V_GEN) ( (echo '#include "champlain-marshal.h"'; $(GLIB_GENMARSHAL) --prefix=cpl_marshal $(srcdir)/champlain-marshal.list --body) > champlain-marshal.tmp \
+	&& mv champlain-marshal.tmp champlain-marshal.c ) \
+	|| ( rm -f champlain-marshal.tmp && exit 1 )
+
+champlain-enum-types.h: $(libchamplain_headers)
+	$(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) --template champlain-enum-types.h.in \
+		$(libchamplain_headers) ) > champlain-enum-types.h.tmp \
+	&& mv champlain-enum-types.h.tmp champlain-enum-types.h \
+	|| rm -f champlain-enum-type.h.tmp
 
+champlain-enum-types.c: $(libchamplain_headers) champlain-enum-types.h
+	$(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) --template champlain-enum-types.c.in \
+		$(libchamplain_headers) ) > champlain-enum-types.c.tmp \
+	&& mv champlain-enum-types.c.tmp champlain-enum-types.c \
+	|| rm -f champlain-enum-type.c.tmp
 
 if HAVE_INTROSPECTION
 
@@ -190,7 +164,7 @@ endif
 BUILT_GIRSOURCES =
 
 Champlain- CHAMPLAIN_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libchamplain- CHAMPLAIN_API_VERSION@.la
-	$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+	$(AM_V_GEN)$(INTROSPECTION_SCANNER) -v \
 	--namespace Champlain --nsversion= CHAMPLAIN_API_VERSION@ \
 	--strip-prefix=Champlain \
 	$(DEPS_CFLAGS) \
diff --git a/champlain/champlain-enum-types.c.in b/champlain/champlain-enum-types.c.in
new file mode 100644
index 0000000..d9a3aab
--- /dev/null
+++ b/champlain/champlain-enum-types.c.in
@@ -0,0 +1,33 @@
+/*** BEGIN file-header ***/
+#include "champlain.h"
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ enum_name@_get_type (void)
+{
+	static GType etype = 0;
+	if (G_UNLIKELY (etype == 0)) {
+		static const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+			{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+			{ 0, NULL, NULL }
+		};
+		etype = g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+	}
+	return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
diff --git a/champlain/champlain-enum-types.h.in b/champlain/champlain-enum-types.h.in
new file mode 100644
index 0000000..276fbf3
--- /dev/null
+++ b/champlain/champlain-enum-types.h.in
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef __CHAMPLAIN_ENUM_TYPES_H__
+#define __CHAMPLAIN_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define CHAMPLAIN_TYPE_ ENUMSHORT@ @enum_name _get_type()
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __CHAMPLAIN_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/champlain/champlain-local-map-data-source.c b/champlain/champlain-local-map-data-source.c
index f654d81..3987a2b 100644
--- a/champlain/champlain-local-map-data-source.c
+++ b/champlain/champlain-local-map-data-source.c
@@ -32,6 +32,7 @@
 #include "champlain-debug.h"
 #include "champlain-bounding-box.h"
 #include "champlain-enum-types.h"
+#include "champlain-tile.h"
 
 #include <memphis/memphis.h>
 
diff --git a/champlain/champlain-map-data-source.c b/champlain/champlain-map-data-source.c
index 63d8fbe..b83e2fa 100644
--- a/champlain/champlain-map-data-source.c
+++ b/champlain/champlain-map-data-source.c
@@ -31,6 +31,7 @@
 #include "champlain-debug.h"
 #include "champlain-bounding-box.h"
 #include "champlain-enum-types.h"
+#include "champlain-tile.h"
 
 G_DEFINE_TYPE (ChamplainMapDataSource, champlain_map_data_source, G_TYPE_INITIALLY_UNOWNED)
 
diff --git a/champlain/champlain-network-map-data-source.c b/champlain/champlain-network-map-data-source.c
index e249813..6a9bb47 100644
--- a/champlain/champlain-network-map-data-source.c
+++ b/champlain/champlain-network-map-data-source.c
@@ -35,6 +35,7 @@
 #include "champlain-bounding-box.h"
 #include "champlain-enum-types.h"
 #include "champlain-version.h"
+#include "champlain-tile.h"
 
 #include <memphis/memphis.h>
 #ifdef HAVE_LIBSOUP_GNOME
diff --git a/configure.ac b/configure.ac
index 3c4a4c5..262a34f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,6 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 # Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
 
 # Checks for libraries.
 LIBRARY_VERSION=0:0:0
@@ -57,6 +56,8 @@ PKG_CHECK_MODULES(DEPS,
 AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_LIBS)
 
+AM_PATH_GLIB_2_0(2.16.0,,gobject gthread gio)
+
 # check for gtk-doc
 GTK_DOC_CHECK(1.9)
 IDT_COMPILE_WARNINGS
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 0000000..ddb88c8
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1,8 @@
+SUBDIRS=reference
+
+if ENABLE_GTK
+  SUBDIRS+=reference-gtk
+endif
+
+DIST_SUBDIRS=reference reference-gtk
+
diff --git a/tidy/Makefile.am b/tidy/Makefile.am
index 6dda7bc..e5c5a88 100644
--- a/tidy/Makefile.am
+++ b/tidy/Makefile.am
@@ -1,8 +1,5 @@
 NULL =
 
-GLIB_GENMARSHAL = `pkg-config --variable=glib_genmarshal glib-2.0`
-GLIB_MKENUMS = `pkg-config --variable=glib_mkenums glib-2.0`
-
 INCLUDES = \
 	-I$(top_srcdir) 		\
 	-DPREFIX=\""$(prefix)"\" 	\
@@ -49,16 +46,16 @@ source_c = \
 tidy-marshal.h: stamp-tidy-marshal.h
 	@true
 stamp-tidy-marshal.h: Makefile tidy-marshal.list
-	$(GLIB_GENMARSHAL) \
+	$(AM_V_GEN) $(GLIB_GENMARSHAL) \
 		--prefix=_tidy_marshal \
 		--header \
 	$(srcdir)/tidy-marshal.list > xgen-tmh && \
 	(cmp -s xgen-tmh tidy-marshal.h || cp -f xgen-tmh tidy-marshal.h) && \
 	rm -f xgen-tmh && \
-	echo timestamp > $(@F)
+	echo timestamp > $(@F) 
 
 tidy-marshal.c: Makefile tidy-marshal.list
-	(echo "#include \"tidy-marshal.h\"" ; \
+	$(AM_V_GEN) ( echo "#include \"tidy-marshal.h\"" ; \
 	 $(GLIB_GENMARSHAL) \
 		--prefix=_tidy_marshal \
 		--body \
@@ -69,15 +66,15 @@ tidy-marshal.c: Makefile tidy-marshal.list
 tidy-enum-types.h: stamp-tidy-enum-types.h Makefile
 	@true
 stamp-tidy-enum-types.h: $(source_h) tidy-enum-types.h.in
-	( $(GLIB_MKENUMS) \
+	$(AM_V_GEN) ( $(GLIB_MKENUMS) \
 	    --template $(srcdir)/tidy-enum-types.h.in \
 	  $(source_h) ) >> xgen-teth && \
 	(cmp xgen-teth tidy-enum-types.h || cp xgen-teth tidy-enum-types.h) && \
 	rm -f xgen-teth && \
-	echo timestamp > $(@F)
+	echo timestamp > $(@F) 
 
 tidy-enum-types.c: stamp-tidy-enum-types.h tidy-enum-types.c.in
-	( $(GLIB_MKENUMS) \
+	$(AM_V_GEN) ( $(GLIB_MKENUMS) \
 	    --template $(srcdir)/tidy-enum-types.c.in \
 	  $(source_h) ) >> xgen-tetc && \
 	cp xgen-tetc tidy-enum-types.c && \



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