summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-11-26 17:32:19 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-11-26 17:32:19 +0000
commit736f86b303eab2c8cec5a5817c5c07628b4704d5 (patch)
tree5ed7bde92b521bc857f559ea9d9ca942883882e9 /perf
parentd5eb6847e58cd6276aa4cb68d31225c02f0c21ac (diff)
downloadgtk+-736f86b303eab2c8cec5a5817c5c07628b4704d5.tar.gz
Use templates for glib-mkenums calls instead of complicated commandlines
2007-11-26 Matthias Clasen <mclasen@redhat.com> Use templates for glib-mkenums calls instead of complicated commandlines in Makefiles. (#429910) * gdk-pixbuf/Makefile.am: * gdk/Makefile.am: * gtk/Makefile.am: * perf/Makefile.am: Use templates for glib-mkenums * gdk-pixbuf/gdk-pixbuf-enum-types.[ch].template: * gdk/gdkenumtypes.[ch].template: * gtk/gtktypebuiltings.[ch].template: * perf/typebuiltins.[ch].template: The templates svn path=/trunk/; revision=19053
Diffstat (limited to 'perf')
-rw-r--r--perf/Makefile.am20
-rw-r--r--perf/typebuiltins.c.template35
-rw-r--r--perf/typebuiltins.h.template24
3 files changed, 65 insertions, 14 deletions
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 3cb7029512..f3cee2cfb0 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -71,24 +71,14 @@ marshalers.c: @REBUILD@ marshalers.list
typebuiltins.h: stamp-typebuiltins.h
@true
-stamp-typebuiltins.h: @REBUILD@ $(headers_with_enums) Makefile
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#ifndef __TYPE_BUILTINS_H__\n#define __TYPE_BUILTINS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define GTK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* __TYPE_BUILTINS_H__ */" \
+stamp-typebuiltins.h: @REBUILD@ $(headers_with_enums) typebuiltins.h.template
+ ( cd $(srcdir) && $(GLIB_MKENUMS) --template typebuiltins.h.template \
$(headers_with_enums) ) >> xgen-gtbh \
&& (cmp -s xgen-gtbh typebuiltins.h || cp xgen-gtbh typebuiltins.h ) \
&& rm -f xgen-gtbh \
&& echo timestamp > $(@F)
-typebuiltins.c: @REBUILD@ $(headers_with_enums) Makefile
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#include \"gtkwidgetprofiler.h\"" \
- --ftail "#define __TYPE_BUILTINS_C__\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
+typebuiltins.c: @REBUILD@ $(headers_with_enums) typebuiltins.c.template
+ ( cd $(srcdir) && $(GLIB_MKENUMS) --template typebuiltins.c.template \
$(headers_with_enums) ) > xgen-gtbc \
&& cp xgen-gtbc typebuiltins.c \
&& rm -f xgen-gtbc
@@ -97,6 +87,8 @@ typebuiltins.c: @REBUILD@ $(headers_with_enums) Makefile
EXTRA_DIST += \
README \
marshalers.list \
+ typebuiltins.c.template \
+ typebuiltins.h.template \
$(BUILT_SOURCES)
# if srcdir!=builddir, clean out maintainer-clean files from builddir
diff --git a/perf/typebuiltins.c.template b/perf/typebuiltins.c.template
new file mode 100644
index 0000000000..523ffa5d9c
--- /dev/null
+++ b/perf/typebuiltins.c.template
@@ -0,0 +1,35 @@
+/*** BEGIN file-header ***/
+#include "gtkwidgetprofiler.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 ***/
+#define __TYPE_BUILTINS_C__
+/*** END file-tail ***/
diff --git a/perf/typebuiltins.h.template b/perf/typebuiltins.h.template
new file mode 100644
index 0000000000..26acc8368c
--- /dev/null
+++ b/perf/typebuiltins.h.template
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef __TYPE_BUILTINS_H__
+#define __TYPE_BUILTINS_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 GTK_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __TYPE_BUILTINS_H__ */
+/*** END file-tail ***/