summaryrefslogtreecommitdiff
path: root/common/glib-gen.mak
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2012-09-07 21:59:49 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2012-09-07 22:00:07 +0900
commit8665a5303d5fa3daaba53cff8f0758e0fc859636 (patch)
tree1f047a01969b70f244d6c0b4381a34e5b7b64355 /common/glib-gen.mak
parent4e9e23ca3164c203a46c205da5af49e354dbbdd2 (diff)
downloadgst-plugins-s5pc2xx-8665a5303d5fa3daaba53cff8f0758e0fc859636.tar.gz
gst-plugins-s5pc2xx-8665a5303d5fa3daaba53cff8f0758e0fc859636.tar.bz2
gst-plugins-s5pc2xx-8665a5303d5fa3daaba53cff8f0758e0fc859636.zip
Change-Id: I0736f126be88ae94efb6698b91de356c16357e52
Diffstat (limited to 'common/glib-gen.mak')
-rwxr-xr-xcommon/glib-gen.mak44
1 files changed, 44 insertions, 0 deletions
diff --git a/common/glib-gen.mak b/common/glib-gen.mak
new file mode 100755
index 0000000..f9027da
--- /dev/null
+++ b/common/glib-gen.mak
@@ -0,0 +1,44 @@
+# 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
+
+enum_headers=$(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")
+
+# 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 "\n/* 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 \"$*-enumtypes.h\"\n$(enum_headers)" \
+ --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" \
+ $^ > $@
+
+# a hack rule to make sure .Plo files exist because they get include'd
+# from Makefile's
+.deps/%-marshal.Plo:
+ touch $@
+
+.deps/%-enumtypes.Plo:
+ touch $@