gst-glib-gen.mak 2.66 KB
Newer Older
1 2 3 4 5 6 7
# 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_gen_prefix=gst_color_balance
#glib_gen_basename=colorbalance
8
#glib_gen_decl_banner=GST_EXPORT
9
#glib_gen_decl_include=\#include <gst/foo/foo-prelude.h>
10 11 12 13 14

enum_headers=$(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")

# these are all the rules generating the relevant files
$(glib_gen_basename)-marshal.h: $(glib_gen_basename)-marshal.list
15
	$(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=$(glib_gen_prefix)_marshal $^ > $(glib_gen_basename)-marshal.h.tmp && \
16 17 18
	mv $(glib_gen_basename)-marshal.h.tmp $(glib_gen_basename)-marshal.h

$(glib_gen_basename)-marshal.c: $(glib_gen_basename)-marshal.list
19
	$(AM_V_GEN)echo "#include \"config.h\"\n#include \"$(glib_gen_basename)-marshal.h\"" >> $(glib_gen_basename)-marshal.c.tmp && \
20
	$(GLIB_GENMARSHAL) --body --prefix=$(glib_gen_prefix)_marshal $^ >> $(glib_gen_basename)-marshal.c.tmp && \
21 22 23
	mv $(glib_gen_basename)-marshal.c.tmp $(glib_gen_basename)-marshal.c

$(glib_gen_basename)-enumtypes.h: $(glib_enum_headers)
24
	$(AM_V_GEN)$(GLIB_MKENUMS) \
25
	--fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n$(glib_gen_decl_include)\nG_BEGIN_DECLS\n" \
26
	--fprod "\n/* enumerations from \"@filename@\" */\n" \
27
	--vhead "$(glib_gen_decl_banner)\nGType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
28 29 30 31
	--ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \
	$^ > $@

$(glib_gen_basename)-enumtypes.c: $(glib_enum_headers)
32
	@if test "x$(glib_enum_headers)" = "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi
33
	$(AM_V_GEN)$(GLIB_MKENUMS) \
34
	--fhead "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"$(glib_gen_basename)-enumtypes.h\"\n$(enum_headers)" \
35 36 37 38 39 40 41 42 43
	--fprod "\n/* enumerations from \"@filename@\" */" \
	--vhead "GType\n@enum_name@_get_type (void)\n{\n  static volatile gsize g_define_type_id__volatile = 0;\n  if (g_once_init_enter (&g_define_type_id__volatile)) {\n    static const G@Type@Value values[] = {"     \
	--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
	--vtail "      { 0, NULL, NULL }\n    };\n    GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n  }\n  return g_define_type_id__volatile;\n}\n" \
	$^ > $@

# a hack rule to make sure .Plo files exist because they get include'd
# from Makefile's
.deps/%-marshal.Plo:
44
	@touch $@
45 46

.deps/%-enumtypes.Plo:
47
	@touch $@