From 00a10b88ccbf3f5eb9e1de8c82a18eb70598830e Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Sat, 31 Jan 2009 12:30:25 +0200 Subject: [PATCH] Build GTypes for enums --- champlain/Makefile.am | 60 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/champlain/Makefile.am b/champlain/Makefile.am index 9bb55a6..d36a8b8 100644 --- a/champlain/Makefile.am +++ b/champlain/Makefile.am @@ -1,7 +1,10 @@ BUILT_SOURCES = \ - champlain-marshal.h \ - champlain-marshal.c + champlain-marshal.h \ + champlain-marshal.c \ + champlain-enum-types.h \ + champlain-enum-types.c \ + stamp-enum-types CLEANFILES = $(BUILT_SOURCES) @@ -10,6 +13,17 @@ CHAMPLAIN_MARSHAL_LIST = champlain-marshal.list lib_LTLIBRARIES = libchamplain-0.3.la +libchamplain_headers = \ + champlain.h \ + champlain-defines.h \ + champlain-view.h \ + champlain-layer.h \ + champlain-marker.h \ + champlain-map.h \ + champlain-zoom-level.h \ + champlain-tile.h + + libchamplain_0_3_la_SOURCES = \ $(CHAMPLAIN_MARSHAL_LIST) \ $(BUILT_SOURCES) \ @@ -42,7 +56,8 @@ noinst_HEADERS = \ sources/googlemap.h \ sources/googlesat.h \ sources/googleterrain.h \ - sources/debugmap.h + sources/debugmap.h \ + champlain-enum-types.h libchamplain_include_HEADERS = \ champlain.h \ @@ -70,3 +85,42 @@ champlain-marshal.h: $(CHAMPLAIN_MARSHAL_LIST) champlain-marshal.c: $(CHAMPLAIN_MARSHAL_LIST) @GLIB_GENMARSHAL@ --body --prefix=cpl_marshal $< > $(CHAMPLAIN_MARSHAL).c + +champlain-enum-types.h: stamp-enum-types + @true + +stamp-enum-types: $(libchamplain_headers) Makefile + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#ifndef __CHAMPLAIN_ENUM_TYPES_H__\n" \ + --fhead "#define __CHAMPLAIN_ENUM_TYPES_H__ 1\n\n" \ + --fhead "#include \n\n" \ + --fhead "G_BEGIN_DECLS\n\n" \ + --ftail "G_END_DECLS\n\n" \ + --ftail "#endif /* __CHAMPLAIN_ENUM_TYPES_H__ */\n" \ + --fprod "#include \n" \ + --eprod "#define CHAMPLAIN_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \ + --eprod "GType @enum_name@_get_type (void);\n" \ + $(libchamplain_headers) ) > xgen-gth \ + && (cmp -s xgen-gth champlain-enum-type.h || cp xgen-gth champlain-enum-types.h) \ + && rm -f xgen-gth \ + && echo timestamp > $(@F) + +champlain-enum-types.c: $(libchamplain_headers) Makefile + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#include \n" \ + --fhead "#include \n" \ + --fhead "#include \"champlain-enum-types.h\"\n\n" \ + --fprod "\n/* enumerations from \"@filename@\" */" \ + --vhead "static const G@Type@Value _@enum_name@_values[] = {" \ + --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ + --vtail " { 0, NULL, NULL }\n};\n\n" \ + --vtail "GType\n@enum_name@_get_type (void)\n{\n" \ + --vtail " static GType type = 0;\n\n" \ + --vtail " if (!type)\n" \ + --vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \ + --vtail " return type;\n}\n\n" \ + $(libchamplain_headers) ) > xgen-gtc \ + && cp xgen-gtc $(@F) \ + && rm -f xgen-gtc -- 2.39.5