[libwnck] Clean up rules for generated files



commit 0ee4159972087eb00f19f792445e7fd9b9579666
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Apr 24 05:36:47 2009 +0200

    Clean up rules for generated files
---
 libwnck/Makefile.am |   76 +++++++++++++++++++-------------------------------
 1 files changed, 29 insertions(+), 47 deletions(-)

diff --git a/libwnck/Makefile.am b/libwnck/Makefile.am
index d5b707a..a345e2d 100644
--- a/libwnck/Makefile.am
+++ b/libwnck/Makefile.am
@@ -100,48 +100,39 @@ test_tasklist_LDADD= LIBWNCK_LIBS@ ./$(lib_LTLIBRARIES)
 test_selector_LDADD= LIBWNCK_LIBS@ ./$(lib_LTLIBRARIES)
 test_pager_LDADD= LIBWNCK_LIBS@ ./$(lib_LTLIBRARIES)
 
-wnck-marshal.h: stamp-wnck-marshal.h
-	@true
-stamp-wnck-marshal.h: wnck-marshal.list
-	(cd $(srcdir) \
-	&& glib-genmarshal --prefix=_wnck_marshal wnck-marshal.list --header) > new-wnck-marshal.h \
-	&& (cmp -s new-wnck-marshal.h wnck-marshal.h || cp new-wnck-marshal.h wnck-marshal.h) \
-	&& rm -f new-wnck-marshal.h \
-	&& echo timestamp > $(@F)
+wnck-marshal.h: wnck-marshal.list
+	@GLIB_GENMARSHAL@ --prefix=_wnck_marshal $< --header > $@
 
 wnck-marshal.c: wnck-marshal.list wnck-marshal.h
-	echo "#include <libwnck/libwnck.h>" > new-wnck-marshal.c \
-	&& echo "#include \"wnck-marshal.h\"" >> new-wnck-marshal.c \
-	&& (cd $(srcdir) \
-	&& glib-genmarshal --prefix=_wnck_marshal wnck-marshal.list --body) >> new-wnck-marshal.c \
-	&& cp new-wnck-marshal.c wnck-marshal.c \
-	&& rm -f new-wnck-marshal.c
-
-wnck-enum-types.h: stamp-wnck-enum-types.h
-	@true
-stamp-wnck-enum-types.h: $(wnck_headers)
-	(cd $(srcdir) \
-	&& glib-mkenums \
-		--fhead "#ifndef __WNCK_ENUM_TYPES_H__\n#define __WNCK_ENUM_TYPES_H__\n" \
-		--fprod "/* enumerations from \"@filename \" */\n" \
-		--vhead "GType @enum_name _get_type (void);\n#define WNCK_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-		--ftail "#endif /* __WNCK_ENUM_TYPES_H__ */" \
-		$(wnck_headers)) > new-wnck-enum-types.h \
-	&& (cmp -s new-wnck-enum-types.h wnck-enum-types.h || cp new-wnck-enum-types.h wnck-enum-types.h) \
-	&& rm -f new-wnck-enum-types.h \
-	&& echo timestamp > $(@F)
+	echo "#include <libwnck/libwnck.h>" > $@ \
+	&& echo "#include \"wnck-marshal.h\"" >> $@ \
+	&& @GLIB_GENMARSHAL@ --prefix=_wnck_marshal $< --body >> $@
+
+wnck-enum-types.h: $(wnck_headers)
+	glib-mkenums \
+		--fhead "#ifndef __WNCK_ENUM_TYPES_H__\n" \
+		--fhead "#define __WNCK_ENUM_TYPES_H__\n\n" \
+		--fhead "G_BEGIN_DECLS\n\n" \
+		--ftail "G_END_DECLS\n\n" \
+		--ftail "#endif /* __WNCK_ENUM_TYPES_H__ */\n" \
+		--fprod "\n/* enumerations from \"@filename \" */\n" \
+		--eprod "#define WNCK_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
+		--eprod "GType @enum_name _get_type (void);\n" \
+		$(wnck_headers) > $@
 
 wnck-enum-types.c: $(wnck_headers) wnck-enum-types.h
-	(cd $(srcdir) \
-	&& glib-mkenums \
-		--fhead "#include <libwnck/libwnck.h>" \
+	glib-mkenums \
+		--fhead "#include <libwnck/libwnck.h>\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" \
-		$(wnck_headers)) > new-wnck-enum-types.c \
-	&& cp new-wnck-enum-types.c $(@F) \
-	&& rm -f new-wnck-enum-types.c
+		--vhead "static const GEnumValue _ 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_enum_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
+		--vtail "  return type;\n}\n\n" \
+		$(wnck_headers) > $@
 
 IMAGES=default_icon.png stock_delete.png stock_maximize.png stock_minimize.png
 VARIABLES=default_icon_data $(srcdir)/default_icon.png 		\
@@ -152,13 +143,6 @@ VARIABLES=default_icon_data $(srcdir)/default_icon.png 		\
 noinst_DATA = inlinepixbufs.h
 CLEANFILES =			\
 	$(noinst_DATA)		\
-	new-wnck-enum-types.c	\
-	new-wnck-enum-types.h	\
-	new-wnck-marshal.c	\
-	new-wnck-marshal.h
-DISTCLEANFILES =		\
-	stamp-wnck-enum-types.h	\
-	stamp-wnck-marshal.h	\
 	$(wnck_built_headers)	\
 	$(wnck_built_cfiles)
 
@@ -169,6 +153,4 @@ $(OBJECTS): inlinepixbufs.h
 
 EXTRA_DIST= 			\
 	wnck-marshal.list	\
-	$(IMAGES)		\
-	$(wnck_built_headers)	\
-	$(wnck_built_cfiles)
+	$(IMAGES)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]