[unique] build: Update build environment
- From: Emmanuele Bassi <ebassi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [unique] build: Update build environment
- Date: Sun, 1 Nov 2009 18:30:15 +0000 (UTC)
commit 4e6085aac190afd564a184d159f288ff3aca5ffd
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Sun Nov 1 18:20:50 2009 +0000
build: Update build environment
â?¢ Clean up configure.ac and Makefile.am
â?¢ Use AM_SILENT_RULES if Automake 1.11 is present, and fall
back to Shave if it's not
â?¢ Use the generic Makefile rules for generating enumeration
GTypes and signal marshallers
â?¢ Clean up the Introspection data generation
.gitignore | 5 ++
Makefile.am | 4 +-
build/autotools/Makefile.am | 5 ++-
build/autotools/Makefile.am.enums | 43 +++++++++++++++
build/autotools/Makefile.am.marshal | 45 +++++++++++++++
build/autotools/Makefile.am.silent | 17 ++++++
configure.ac | 25 +++++++--
unique/Makefile.am | 102 ++++++++++++++++-------------------
unique/bacon/Makefile.am | 7 ++-
unique/dbus/Makefile.am | 2 +-
unique/unique.h | 1 +
unique/uniqueapp.c | 49 +----------------
unique/uniqueapp.h | 6 --
unique/uniqueenumtypes.c.in | 39 +++++++++++++
unique/uniqueenumtypes.h.in | 26 +++++++++
15 files changed, 255 insertions(+), 121 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2d2cc13..465b0b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,11 @@ unique.pc
/unique/*.o
/unique/*.gir
/unique/*.typelib
+/unique/stamp-*
+/unique/uniqueenumtypes.h
+/unique/uniqueenumtypes.c
+/unique/uniquemarshal.h
+/unique/uniquemarshal.c
xmldocs.make
.*.swp
*~
diff --git a/Makefile.am b/Makefile.am
index ab8fa32..32de107 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,11 @@
+include $(top_srcdir)/build/autotools/Makefile.am.silent
+
ACLOCAL_AMFLAGS = -I build/autotools
SUBDIRS = build unique tests doc po
unique-1.0.pc: unique.pc
- @cp -f $< $@
+ $(QUIET_GEN)cp -f $< $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = unique-1.0.pc
diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am
index d0035d1..5f35b85 100644
--- a/build/autotools/Makefile.am
+++ b/build/autotools/Makefile.am
@@ -3,6 +3,9 @@ EXTRA_DIST = \
shave.in \
shave.m4 \
as-compiler-flag.m4 \
- introspection.m4
+ introspection.m4 \
+ Makefile.am.enums \
+ Makefile.am.marshal \
+ Makefile.am.silent
DISTCLEANFILES = shave-libtool shave
diff --git a/build/autotools/Makefile.am.enums b/build/autotools/Makefile.am.enums
new file mode 100644
index 0000000..67f4de0
--- /dev/null
+++ b/build/autotools/Makefile.am.enums
@@ -0,0 +1,43 @@
+# Rules for generating enumeration types using glib-mkenums
+#
+# Define:
+# glib_enum_h = header template file
+# glib_enum_c = source template file
+# glib_enum_headers = list of headers to parse
+#
+# before including Makefile.am.enums. You will also need to have
+# the following targets already defined:
+#
+# CLEANFILES
+# DISTCLEANFILES
+# BUILT_SOURCES
+# EXTRA_DIST
+#
+# 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)
+
+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)
+
+stamp-enum-types: $(glib_enum_headers)
+ $(QUIET_GEN)$(GLIB_MKENUMS) \
+ --template $(srcdir)/$(enum_tmpl_h) \
+ $(glib_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)
+
+$(glib_enum_h): stamp-enum-types
+ @true
+
+$(glib_enum_c): $(glib_enum_h)
+ $(QUIET_GEN)$(GLIB_MKENUMS) \
+ --template $(srcdir)/$(enum_tmpl_c) \
+ $(glib_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
new file mode 100644
index 0000000..cab117d
--- /dev/null
+++ b/build/autotools/Makefile.am.marshal
@@ -0,0 +1,45 @@
+# Rules for generating marshal files using glib-genmarshal
+#
+# Define:
+# glib_marshal_list = marshal list file
+# glib_marshal_prefix = prefix for marshal functions
+#
+# before including Makefile.am.marshal. You will also need to have
+# the following targets already defined:
+#
+# CLEANFILES
+# DISTCLEANFILES
+# BUILT_SOURCES
+# EXTRA_DIST
+#
+# Author: Emmanuele Bassi <ebassi linux intel com>
+
+marshal_h = $(glib_marshal_list:.list=.h)
+marshal_c = $(glib_marshal_list:.list=.c)
+
+CLEANFILES += stamp-marshal
+DISTCLEANFILES += $(marshal_h) $(marshal_c)
+BUILT_SOURCES += $(marshal_h) $(marshal_c)
+EXTRA_DIST += $(srcdir)/$(glib_marshal_list)
+
+stamp-marshal: $(glib_marshal_list)
+ $(QUIET_GEN)$(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --header \
+ $(srcdir)/$(glib_marshal_list) > xgen-mh \
+ && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
+ && rm -f xgen-mh \
+ && echo timestamp > $(@F)
+
+$(marshal_h): stamp-marshal
+ @true
+
+$(marshal_c): $(marshal_h)
+ $(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \
+ $(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --body \
+ $(srcdir)/$(glib_marshal_list)) > xgen-mc \
+ && cp xgen-mc $(marshal_c) \
+ && rm -f xgen-mc
+
diff --git a/build/autotools/Makefile.am.silent b/build/autotools/Makefile.am.silent
new file mode 100644
index 0000000..249f6af
--- /dev/null
+++ b/build/autotools/Makefile.am.silent
@@ -0,0 +1,17 @@
+# custom rules for quiet builds
+
+if USE_SHAVE
+QUIET_GEN = $(Q:@= echo ' GEN '$@;)
+QUIET_LN = $(Q:@= echo ' LN '$@;)
+QUIET_RM = $(Q:@= echo ' RM '$@;)
+else
+QUIET_GEN = $(AM_V_GEN)
+
+QUIET_LN = $(QUIET_LN_$(V))
+QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY))
+QUIET_LN_0 = @echo ' LN '$@;
+
+QUIET_RM = $(QUIET_RM_$(V))
+QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY))
+QUIET_RM_0 = @echo ' RM '$@;
+endif # USE_SHAVE
diff --git a/configure.ac b/configure.ac
index 7bd86b9..65585fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,8 +23,7 @@ AC_INIT([unique], [unique_version],
AC_CONFIG_SRCDIR([unique/unique.h])
AC_CONFIG_MACRO_DIR([build/autotools])
-AM_INIT_AUTOMAKE
-
+AM_INIT_AUTOMAKE([1.10])
AM_CONFIG_HEADER([config.h])
# version symbols
@@ -141,6 +140,8 @@ AS_IF([test "x$enable_bacon" = "xyes"],
[have_bacon=no]
)
+AM_CONDITIONAL([HAVE_BACON], [test "x$have_bacon" = "xyes"])
+
dnl Choose the default backend
AC_MSG_CHECKING([for default IPC mechanism])
AS_IF([test "x$have_dbus" = "xyes"],
@@ -228,16 +229,28 @@ GOBJECT_INTROSPECTION_CHECK([0.6.3])
# gtk-doc
GTK_DOC_CHECK([1.11])
-# shave
-SHAVE_INIT([build/autotools], [enable])
+# nice builds
+m4_ifdef([AM_SILENT_RULES],
+ [
+ AM_SILENT_RULES([yes])
+ use_shave=no
+ ],
+ [
+ SHAVE_INIT([build/autotools], [enable])
+ AC_CONFIG_FILES([
+ build/autotools/shave-libtool
+ build/autotools/shave
+ ])
+ use_shave=yes
+ ])
+
+AM_CONDITIONAL([USE_SHAVE], [test "x$use_shave" = "xyes"])
AC_CONFIG_FILES([
Makefile
unique.pc
build/Makefile
build/autotools/Makefile
- build/autotools/shave
- build/autotools/shave-libtool
doc/Makefile
doc/reference/Makefile
doc/reference/version.xml
diff --git a/unique/Makefile.am b/unique/Makefile.am
index d5ea9b4..aa65752 100644
--- a/unique/Makefile.am
+++ b/unique/Makefile.am
@@ -1,8 +1,12 @@
+include $(top_srcdir)/build/autotools/Makefile.am.silent
+
NULL =
-QUIET_GEN = $(Q:@= echo ' GEN '$@;)
+SUBDIRS =
-SUBDIRS = bacon
+if HAVE_BACON
+SUBDIRS += bacon
+endif
if HAVE_DBUS
SUBDIRS += dbus
@@ -10,22 +14,33 @@ endif
DIST_SUBDIRS = bacon dbus
-INCLUDES = \
+INCLUDES = -I$(top_srcdir)
+
+LDADD = \
+ -version-info $(UNIQUE_LT_VERSION_INFO) \
+ -export-dynamic \
+ -export-symbols-regex "^unique.*"
+ -rpath $(libdir) \
+ $(NULL)
+
+AM_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \
-DGTK_DISABLE_SINGLE_INCLUDES \
-DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DG_LOG_DOMAIN=\"Unique\" \
-DPREFIX=\""$(prefix)"\" \
- -I$(top_srcdir) \
+ $(DISABLE_DEPRECATED_FLAGS) \
+ $(UNIQUE_DEBUG_CFLAGS) \
$(NULL)
-LDADD = \
- -version-info $(UNIQUE_LT_VERSION_INFO) \
- -export-dynamic \
- -export-symbols-regex "^unique.*"
- -rpath $(libdir) \
- $(NULL)
+AM_CFLAGS = $(MAINTAINER_CFLAGS) $(DBUS_CFLAGS) $(UNIQUE_CFLAGS)
+
+BUILT_SOURCES =
+
+EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
unique_sources_h = \
$(top_srcdir)/unique/uniqueapp.h \
@@ -34,14 +49,25 @@ unique_sources_h = \
$(NULL)
unique_sources_c = \
- $(srcdir)/uniqueapp.c \
- $(srcdir)/uniquebackend.c \
- $(srcdir)/uniquemessage.c \
+ $(srcdir)/uniqueapp.c \
+ $(srcdir)/uniquebackend.c \
+ $(srcdir)/uniquemessage.c \
+ $(NULL)
+
+unique_sources_priv_h = \
+ $(top_srcdir)/unique/uniqueinternals.h \
$(NULL)
-unique_sources_priv_h = $(top_srcdir)/unique/uniqueinternals.h
+# glib-mkenums rules
+glib_enum_h = uniqueenumtypes.h
+glib_enum_c = uniqueenumtypes.c
+glib_enum_headers = $(unique_sources_h)
+include $(top_srcdir)/build/autotools/Makefile.am.enums
-BUILT_SOURCES = uniquemarshal.h uniquemarshal.c
+# glib-genmarshal rules
+glib_marshal_list = uniquemarshal.list
+glib_marshal_prefix = unique_marshal
+include $(top_srcdir)/build/autotools/Makefile.am.marshal
unique_backend_libs = $(top_builddir)/unique/bacon/libunique-bacon.la
@@ -68,60 +94,24 @@ libunique_1_0_la_LIBADD = \
$(UNIQUE_LIBS) \
$(DBUS_LIBS)
-libunique_1_0_la_CFLAGS = \
- $(UNIQUE_CFLAGS) \
- $(UNIQUE_DEBUG_CFLAGS) \
- $(MAINTAINER_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(DISABLE_DEPRECATED_FLAGS)
-
-libunique_1_0_la_LDFLAGS = $(LDADD)
-
-uniquemarshal.h: stamp-uniquemarshal.h
- @true
-stamp-uniquemarshal.h: uniquemarshal.list Makefile
- $(QUIET_GEN)$(GLIB_GENMARSHAL) \
- --prefix=unique_marshal \
- --header \
- $(srcdir)/uniquemarshal.list > xgen-umh \
- && (cmp -s xgen-umh uniquemarshal.h || cp xgen-umh uniquemarshal.h) \
- && rm -f xgen-umh \
- && echo timestamp > $(@F)
-
-uniquemarshal.c: uniquemarshal.list Makefile
- $(QUIET_GEN)( echo "#include \"uniquemarshal.h\"" ; \
- $(GLIB_GENMARSHAL) \
- --prefix=unique_marshal \
- --body \
- $(srcdir)/uniquemarshal.list ) >> xgen-umc \
- && cp xgen-umc uniquemarshal.c \
- && rm -f xgen-umc
-
-CLEANFILES = stamp-uniquemarshal.h
-
-DISTCLEANFILES = \
- uniquemarshal.h \
- uniquemarshal.c \
- uniqueversion.h \
- $(NULL)
+DISTCLEANFILES += uniqueversion.h
-EXTRA_DIST = uniquemarshal.list uniqueversion.h.in
+EXTRA_DIST += uniqueversion.h.in
if HAVE_INTROSPECTION
BUILT_GIRSOURCES =
Unique-1.0.gir: $(INTROSPECTION_SCANNER) libunique-1.0.la
- $(INTROSPECTION_SCANNER) -v \
+ $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Unique --nsversion=1.0 \
- $(INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) \
--c-include='unique/unique.h' \
--include=GObject-2.0 \
--include=Gtk-2.0 \
- --library=unique-1.0 \
+ --library=libunique-1.0.la \
--libtool="$(top_builddir)/libtool" \
--pkg gobject-2.0 \
--pkg gtk+-2.0 \
- --pkg unique-1.0 \
--output $@ \
$(unique_sources_h) \
$(unique_sources_c)
diff --git a/unique/bacon/Makefile.am b/unique/bacon/Makefile.am
index c9c6f44..f4ab6b8 100644
--- a/unique/bacon/Makefile.am
+++ b/unique/bacon/Makefile.am
@@ -1,9 +1,10 @@
libuniqueincludedir = $(includedir)/unique-1.0/unique
-INCLUDES = \
+INCLUDES = -I$(top_srcdir)
+
+AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Unique-Bacon\" \
- -DG_DISABLE_SINGLE_INCLUDES \
- -I$(top_srcdir)
+ -DG_DISABLE_SINGLE_INCLUDES
LDADD = $(UNIQUE_LIBS)
diff --git a/unique/dbus/Makefile.am b/unique/dbus/Makefile.am
index 27ba2cf..724ae99 100644
--- a/unique/dbus/Makefile.am
+++ b/unique/dbus/Makefile.am
@@ -1,4 +1,4 @@
-QUIET_GEN = $(Q:@= echo ' GEN '$@;)
+include $(top_srcdir)/build/autotools/Makefile.am.silent
libuniqueincludedir = $(includedir)/unique-1.0/unique
diff --git a/unique/unique.h b/unique/unique.h
index 1010296..d2e97da 100644
--- a/unique/unique.h
+++ b/unique/unique.h
@@ -23,6 +23,7 @@
#include "uniqueapp.h"
#include "uniquebackend.h"
+#include "uniqueenumtypes.h"
#include "uniquemessage.h"
#include "uniqueversion.h"
diff --git a/unique/uniqueapp.c b/unique/uniqueapp.c
index 9ebc830..c16ae55 100644
--- a/unique/uniqueapp.c
+++ b/unique/uniqueapp.c
@@ -64,59 +64,14 @@
#include <gdk/gdkx.h>
#endif
-#include "uniquebackend.h"
#include "uniqueapp.h"
+#include "uniquebackend.h"
+#include "uniqueenumtypes.h"
#include "uniquemarshal.h"
#include "uniqueinternals.h"
-GType
-unique_command_get_type (void)
-{
- static GType etype = 0;
-
- if (G_UNLIKELY (etype == 0))
- {
- static const GEnumValue values[] = {
- { UNIQUE_INVALID, "UNIQUE_INVALID", "invalid" },
- { UNIQUE_ACTIVATE, "UNIQUE_ACTIVATE", "activate" },
- { UNIQUE_NEW, "UNIQUE_NEW", "new" },
- { UNIQUE_OPEN, "UNIQUE_OPEN", "open" },
- { UNIQUE_CLOSE, "UNIQUE_CLOSE", "close" },
- { 0, NULL, NULL }
- };
-
- etype = g_enum_register_static (I_("UniqueCommand"), values);
- }
-
- return etype;
-}
-
-GType
-unique_response_get_type (void)
-{
- static GType etype = 0;
-
- if (G_UNLIKELY (etype == 0))
- {
- static const GEnumValue values[] = {
- { UNIQUE_RESPONSE_INVALID, "UNIQUE_RESPONSE_INVALID", "invalid" },
- { UNIQUE_RESPONSE_OK, "UNIQUE_RESPONSE_OK", "ok" },
- { UNIQUE_RESPONSE_CANCEL, "UNIQUE_RESPONSE_CANCEL", "cancel" },
- { UNIQUE_RESPONSE_FAIL, "UNIQUE_RESPONSE_FAIL", "fail" },
- { UNIQUE_RESPONSE_PASSTHROUGH, "UNIQUE_RESPONSE_PASSTHROUGH", "passthrough" },
- { 0, NULL, NULL }
- };
-
- etype = g_enum_register_static (I_("UniqueResponse"), values);
- }
-
- return etype;
-}
-
-
-
G_DEFINE_TYPE (UniqueApp, unique_app, G_TYPE_OBJECT);
#define UNIQUE_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
diff --git a/unique/uniqueapp.h b/unique/uniqueapp.h
index 1476d99..aacab00 100644
--- a/unique/uniqueapp.h
+++ b/unique/uniqueapp.h
@@ -28,8 +28,6 @@
G_BEGIN_DECLS
-#define UNIQUE_TYPE_COMMAND (unique_command_get_type ())
-#define UNIQUE_TYPE_RESPONSE (unique_response_get_type ())
#define UNIQUE_TYPE_APP (unique_app_get_type ())
#define UNIQUE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNIQUE_TYPE_APP, UniqueApp))
#define UNIQUE_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNIQUE_TYPE_APP))
@@ -58,8 +56,6 @@ typedef enum { /*< prefix=UNIQUE >*/
UNIQUE_CLOSE = -4
} UniqueCommand;
-GType unique_command_get_type (void) G_GNUC_CONST;
-
/**
* UniqueResponse:
* @UNIQUE_RESPONSE_INVALID: Internal error code, should never be used.
@@ -79,8 +75,6 @@ typedef enum { /*< prefix=UNIQUE_RESPONSE >*/
UNIQUE_RESPONSE_PASSTHROUGH
} UniqueResponse;
-GType unique_response_get_type (void) G_GNUC_CONST;
-
typedef struct _UniqueApp UniqueApp;
typedef struct _UniqueAppPrivate UniqueAppPrivate;
typedef struct _UniqueAppClass UniqueAppClass;
diff --git a/unique/uniqueenumtypes.c.in b/unique/uniqueenumtypes.c.in
new file mode 100644
index 0000000..c17312a
--- /dev/null
+++ b/unique/uniqueenumtypes.c.in
@@ -0,0 +1,39 @@
+/*** BEGIN file-header ***/
+#include "uniqueenumtypes.h"
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+#include "@filename@"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ enum_name@_get_type(void) {
+ static volatile gsize g_enum_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_enum_type_id__volatile))
+ {
+ const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_enum_type_id;
+
+ g_enum_type_id =
+ g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+
+ g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id);
+ }
+
+ return g_enum_type_id__volatile;
+}
+/*** END value-tail ***/
diff --git a/unique/uniqueenumtypes.h.in b/unique/uniqueenumtypes.h.in
new file mode 100644
index 0000000..fa8a8c3
--- /dev/null
+++ b/unique/uniqueenumtypes.h.in
@@ -0,0 +1,26 @@
+/*** BEGIN file-header ***/
+#ifndef __UNIQUE_ENUM_TYPES_H__
+#define __UNIQUE_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* !__UNIQUE_ENUM_TYPES_H__ */
+/*** END file-tail ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define UNIQUE_TYPE_ ENUMSHORT@ (@enum_name _get_type())
+
+/*** END value-header ***/
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]