[glide] Add glib-mkenums support
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Add glib-mkenums support
- Date: Thu, 6 May 2010 11:55:58 +0000 (UTC)
commit 7b7a020830083ce54281279ed7bae186d804156b
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu May 6 07:54:20 2010 -0400
Add glib-mkenums support
Makefile.am.enums | 43 ++++++++++++++++++++++++++++++++++++++++
configure.ac | 2 +
libglide/Makefile.am | 14 +++++++++++-
libglide/glide-enum-types.c.in | 40 +++++++++++++++++++++++++++++++++++++
libglide/glide-enum-types.h.in | 26 ++++++++++++++++++++++++
5 files changed, 123 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am.enums b/Makefile.am.enums
new file mode 100644
index 0000000..0f34732
--- /dev/null
+++ b/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) $(srcdir)/$(enum_tmpl_h)
+ $(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) $(srcdir)/$(enum_tmpl_c)
+ $(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/configure.ac b/configure.ac
index da6cff2..bee342b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,8 @@ AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC
+AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
+
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index 30b9b41..a64dd47 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -3,6 +3,9 @@
## Created by Anjuta
BUILT_SOURCES =
+EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
AM_CFLAGS =\
-g \
@@ -53,6 +56,7 @@ glideheaders_HEADERS = \
glide-window.h \
glide-inspector-window.h \
glide-inspector-shape.h \
+ glide-enum-types.h \
glide.h \
glide-theme.h \
$(glide_VALABUILTHEADERS)
@@ -87,6 +91,7 @@ libglide_la_SOURCES = \
glide-inspector-text.c \
glide-inspector-window.c \
glide-inspector-shape.c \
+ glide-enum-types.c \
glide.c \
glide-theme.c \
$(glide_VALABUILTSOURCES)
@@ -104,15 +109,20 @@ libglide_la_CFLAGS = \
libglide_la_LDFLAGS = $(GTK_LIBS) $(CLUTTER_LIBS) $(CLUTTER_GTK_LIBS) $(GOBJECT_INTROSPECTION_LIBS) $(JSON_GLIB_LIBS) $(GMODULE_LIBS) -Wl --export-dynamic
-EXTRA_DIST = $(ui_DATA) \
+EXTRA_DIST += $(ui_DATA) \
$(glide_VALASOURCES)
if MAINTAINER_MODE
-CLEANFILES = \
+CLEANFILES += \
$(BUILT_SOURCES) \
$(glide_VALABUILTSOURCES)
endif
+glib_enum_h = glide-enum-types.h
+glib_enum_c = glide-enum-types.c
+glib_enum_headers = $(glideheaders_HEADERS)
+include $(top_srcdir)/Makefile.am.enums
+
# Remove ui directory on uninstall
uninstall-local:
-rm -r $(uidir)
diff --git a/libglide/glide-enum-types.c.in b/libglide/glide-enum-types.c.in
new file mode 100644
index 0000000..c6971eb
--- /dev/null
+++ b/libglide/glide-enum-types.c.in
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+#include "glide-enum-types.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))
+ {
+ static 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/libglide/glide-enum-types.h.in b/libglide/glide-enum-types.h.in
new file mode 100644
index 0000000..987a46e
--- /dev/null
+++ b/libglide/glide-enum-types.h.in
@@ -0,0 +1,26 @@
+/*** BEGIN file-header ***/
+#ifndef __GLIDE_ENUM_TYPES_H__
+#define __GLIDE_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 /* !__GLIDE_ENUM_TYPES_H__ */
+/*** END file-tail ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define GLIDE_TYPE_ ENUMSHORT@ (@enum_name _get_type())
+
+/*** END value-header ***/
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]