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
This commit is contained in:
Matthias Clasen 2007-11-26 17:32:19 +00:00 committed by Matthias Clasen
parent d5eb6847e5
commit 736f86b303
13 changed files with 289 additions and 58 deletions

View File

@ -1,3 +1,18 @@
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
2007-11-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c:

View File

@ -442,12 +442,8 @@ MAINTAINERCLEANFILES = \
gdk-pixbuf-enum-types.h: s-enum-types-h
@true
s-enum-types-h: @REBUILD@ $(gdk_pixbuf_headers) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#ifndef __GDK_PIXBUF_ENUM_TYPES_H__\n#define __GDK_PIXBUF_ENUM_TYPES_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 GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* __GDK_PIXBUF_ENUM_TYPES_H__ */" \
s-enum-types-h: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.h.template
( cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.h.template \
$(gdk_pixbuf_headers) ) > tmp-gdk-pixbuf-enum-types.h \
&& (cmp -s tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h || cp tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h ) \
&& rm -f tmp-gdk-pixbuf-enum-types.h \
@ -459,14 +455,8 @@ MAINTAINERCLEANFILES += s-enum-types-h
#
# gdk-pixbuf-enum-types.c
#
gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) Makefile
(cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#include <gdk-pixbuf/gdk-pixbuf.h>\n#include \"gdk-pixbuf-alias.h\"\n" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--ftail "\n#define __GDK_PIXBUF_ENUM_TYPES_C__\n#include \"gdk-pixbuf-aliasdef.c\"" \
--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 (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.c.template
(cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.c.template \
$(gdk_pixbuf_headers)) > gdk-pixbuf-enum-types.c
#
@ -512,6 +502,8 @@ EXTRA_DIST += \
gdk_pixbuf.rc \
gdk-pixbuf-marshal.c \
gdk-pixbuf-marshal.list \
gdk-pixbuf-enum-types.c.template \
gdk-pixbuf-enum-types.h.template \
gen-color-table.pl
if CROSS_COMPILING

View File

@ -0,0 +1,38 @@
/*** BEGIN file-header ***/
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdk-pixbuf-alias.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 __GDK_PIXBUF_ENUM_TYPES_C__
#include "gdk-pixbuf-aliasdef.c"
/*** END file-tail ***/

View File

@ -0,0 +1,24 @@
/*** BEGIN file-header ***/
#ifndef __GDK_PIXBUF_ENUM_TYPES_H__
#define __GDK_PIXBUF_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 GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __GDK_PIXBUF_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@ -18,6 +18,8 @@ EXTRA_DIST += \
gdk.symbols \
makegdkalias.pl \
gdkaliasdef.c \
gdkenumtypes.c.template \
gdkenumtypes.h.template \
abicheck.sh \
pltcheck.sh
@ -242,24 +244,14 @@ BUILT_SOURCES = \
gdkenumtypes.h: stamp-gdkenumtypes.h
@true
stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#ifndef __GDK_ENUM_TYPES_H__\n#define __GDK_ENUM_TYPES_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 GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* __GDK_ENUM_TYPES_H__ */" \
stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.h.template
( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.h.template \
$(gdk_public_h_sources) ) >> xgen-geth \
&& (cmp -s xgen-geth gdkenumtypes.h || cp xgen-geth gdkenumtypes.h ) \
&& rm -f xgen-geth \
&& echo timestamp > $(@F)
gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#define GDK_ENABLE_BROKEN\n#include \"gdk.h\"\n#include \"gdkalias.h\"\n" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--ftail "\n#define __GDK_ENUM_TYPES_C__\n#include \"gdkaliasdef.c\"\n" \
--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 (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.c.template
( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.c.template \
$(gdk_public_h_sources) ) > xgen-getc \
&& cp xgen-getc gdkenumtypes.c \
&& rm -f xgen-getc

View File

@ -0,0 +1,38 @@
/*** BEGIN file-header ***/
#define GDK_ENABLE_BROKEN
#include "gdk.h"
#include "gdkalias.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 __GDK_ENUM_TYPES_C__
#include "gdkaliasdef.c"
/*** END file-tail ***/

View File

@ -0,0 +1,24 @@
/*** BEGIN file-header ***/
#ifndef __GDK_ENUM_TYPES_H__
#define __GDK_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 GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __GDK_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@ -795,28 +795,18 @@ gtkmarshal.c: @REBUILD@ gtkmarshal.list
echo "#define __gtk_marshal_MARSHAL_C__"; \
echo "#include \"gtkaliasdef.c\"") >> xgen-gmc \
&& cp xgen-gmc gtkmarshal.c \
&& rm -f xgen-gmc
&& rm -f xgen-gmc
gtktypebuiltins.h: stamp-gtktypebuiltins.h
@true
stamp-gtktypebuiltins.h: @REBUILD@ $(gtk_public_h_sources) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#ifndef __GTK_TYPE_BUILTINS_H__\n#define __GTK_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 /* __GTK_TYPE_BUILTINS_H__ */" \
stamp-gtktypebuiltins.h: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.h.template
( cd $(srcdir) && $(GLIB_MKENUMS) --template gtktypebuiltins.h.template \
$(gtk_public_h_sources) ) >> xgen-gtbh \
&& (cmp -s xgen-gtbh gtktypebuiltins.h || cp xgen-gtbh gtktypebuiltins.h ) \
&& rm -f xgen-gtbh \
&& echo timestamp > $(@F)
gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) Makefile
( cd $(srcdir) && $(GLIB_MKENUMS) \
--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include \"gtk.h\"\n#include \"gtkprivate.h\"\n#include \"gtkalias.h\"\n" \
--ftail "#define __GTK_TYPE_BUILTINS_C__\n#include \"gtkaliasdef.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 (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
( cd $(srcdir) && $(GLIB_MKENUMS) --template gtktypebuiltins.c.template \
$(gtk_public_h_sources) ) > xgen-gtbc \
&& cp xgen-gtbc gtktypebuiltins.c \
&& rm -f xgen-gtbc
@ -1219,6 +1209,9 @@ EXTRA_DIST += \
makegtkalias.pl \
aliasfilescheck.sh \
abicheck.sh \
pltcheck.sh
pltcheck.sh \
gtktypebuiltins.c.template \
gtktypebuiltins.h.template
install-data-local:

View File

@ -0,0 +1,40 @@
/*** BEGIN file-header ***/
#undef GTK_DISABLE_DEPRECATED
#define GTK_ENABLE_BROKEN
#include "gtk.h"
#include "gtkprivate.h"
#include "gtkalias.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 __GTK_TYPE_BUILTINS_C__
#include "gtkaliasdef.c"
/*** END file-tail ***/

View File

@ -0,0 +1,24 @@
/*** BEGIN file-header ***/
#ifndef __GTK_TYPE_BUILTINS_H__
#define __GTK_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 /* __GTK_TYPE_BUILTINS_H__ */
/*** END file-tail ***/

View File

@ -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

View File

@ -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 ***/

View File

@ -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 ***/