diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-02-03 16:48:52 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-02-03 16:48:52 +0000 |
commit | 0f9fe900b0757fd2450454a1af24146b47aaaac2 (patch) | |
tree | ceb06c4a1533e0b061d426e2831885bf82c8c9e9 | |
parent | ab32709acc23a4a1b458823fd094327332408035 (diff) | |
download | gstreamer-common-0f9fe900b0757fd2450454a1af24146b47aaaac2.tar.gz |
adding makefile snippet to generate enums and marshal stuff
Original commit message from CVS:
adding makefile snippet to generate enums and marshal stuff
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | glib-gen.mak | 35 |
2 files changed, 39 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2004-02-03 Thomas Vander Stichele <thomas at apestaart dot org> + + * glib-gen.mak: added; used to generate enums and marshal code + 2004-01-13 Thomas Vander Stichele <thomas at apestaart dot org> * gettext.patch: added; used by autogen.sh to make sure diff --git a/glib-gen.mak b/glib-gen.mak new file mode 100644 index 0000000..8394920 --- /dev/null +++ b/glib-gen.mak @@ -0,0 +1,35 @@ +# these are the variables your Makefile.am should set +# the example is based on the colorbalance interface + +#glib_enum_headers=$(colorbalance_headers) +#glib_enum_define=GST_COLOR_BALANCE +#glib_enum_prefix=gst_color_balance +#glib_root=colorbalance + +# these are all the rules generating the relevant files +%-marshal.h: %-marshal.list + glib-genmarshal --header --prefix=$(glib_enum_prefix)_marshal $^ > $*-marshal.h.tmp + mv $*-marshal.h.tmp $*-marshal.h + +%-marshal.c: %-marshal.list + echo "#include \"$*-marshal.h\"" >> $*-marshal.c.tmp + glib-genmarshal --body --prefix=$(glib_enum_prefix)_marshal $^ >> $*-marshal.c.tmp + mv $*-marshal.c.tmp $*-marshal.c + +%-enumtypes.h: $(glib_enum_headers) + glib-mkenums \ + --fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_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);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ + --ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \ + $^ > $@ + +%-enumtypes.c: $(glib_enum_headers) + @if test "x$(glib_enum_headers)" == "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi + glib-mkenums \ + --fhead "#include <$*.h>" \ + --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" \ + $^ > $@ |