[cheese] build: borrow marshal generation rules from clutter



commit 9d67d87aaa71078b26cb96e5979697425d2b5367
Author: Filippo Argiolas <filippo argiolas gmail com>
Date:   Mon Feb 22 22:15:07 2010 +0100

    build: borrow marshal generation rules from clutter
    
    I took the mkenum rules, let's take this too.
    Thanks Emmanuele.

 Makefile.am.marshal   |   45 +++++++++++++++++++++++++++++++++++++++++++++
 libcheese/Makefile.am |   27 ++++++++++++---------------
 2 files changed, 57 insertions(+), 15 deletions(-)
---
diff --git a/Makefile.am.marshal b/Makefile.am.marshal
new file mode 100644
index 0000000..f2b4996
--- /dev/null
+++ b/Makefile.am.marshal
@@ -0,0 +1,45 @@
+# Rules for generating marshal files using glib-genmarshal
+#
+# Define:
+# 	glib_marshal_list = marshal list file
+# 	glib_marshal_prefix = prefix for marshal functions
+#
+# before including Makefile.am.marshal. You will also need to have
+# the following targets already defined:
+#
+# 	CLEANFILES
+#	DISTCLEANFILES
+#	BUILT_SOURCES
+#	EXTRA_DIST
+#
+# Author: Emmanuele Bassi <ebassi linux intel com>
+
+marshal_h = $(glib_marshal_list:.list=.h)
+marshal_c = $(glib_marshal_list:.list=.c)
+
+CLEANFILES += stamp-marshal
+DISTCLEANFILES += $(marshal_h) $(marshal_c)
+BUILT_SOURCES += $(marshal_h) $(marshal_c)
+EXTRA_DIST += $(srcdir)/$(glib_marshal_list)
+
+stamp-marshal: $(glib_marshal_list)
+	$(AM_V_GEN)$(GLIB_GENMARSHAL) \
+		--prefix=$(glib_marshal_prefix) \
+		--header \
+	$(srcdir)/$(glib_marshal_list) > xgen-mh \
+	&& (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
+	&& rm -f xgen-mh \
+	&& echo timestamp > $(@F)
+
+$(marshal_h): stamp-marshal
+	@true
+
+$(marshal_c): $(marshal_h)
+	$(AM_V_GEN)(echo "#include \"$(marshal_h)\"" ; \
+	$(GLIB_GENMARSHAL) \
+		--prefix=$(glib_marshal_prefix) \
+		--body \
+	$(srcdir)/$(glib_marshal_list)) > xgen-mc \
+	&& cp xgen-mc $(marshal_c) \
+	&& rm -f xgen-mc
+
diff --git a/libcheese/Makefile.am b/libcheese/Makefile.am
index e02387b..524f6f7 100644
--- a/libcheese/Makefile.am
+++ b/libcheese/Makefile.am
@@ -12,15 +12,21 @@ INCLUDES = \
 lib_LTLIBRARIES = libcheese-gtk.la
 noinst_LTLIBRARIES = libcheesecommon.la
 
-cheese-marshal.h: cheese-marshal.list Makefile
-	$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_cheese_marshal $< --header > $@
+EXTRA_DIST = cheese-gtk.symbols
+CLEANFILES =
+DISTCLEANFILES =
+BUILT_SOURCES =
 
-cheese-marshal.c: cheese-marshal.list Makefile
-	$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_cheese_marshal $< --body > $@
+glib_marshal_list = cheese-marshal.list
+glib_marshal_prefix = _cheese_marshal
+include $(top_srcdir)/Makefile.am.marshal
 
-libcheese_gtk_la_CFLAGS = $(CHEESE_CFLAGS)
+glib_enum_h = cheese-enum-types.h
+glib_enum_c = cheese-enum-types.c
+glib_enum_headers = $(top_srcdir)/libcheese/cheese-widget.h
+include $(top_srcdir)/Makefile.am.enums
 
-BUILT_SOURCES = cheese-marshal.c cheese-marshal.h
+libcheese_gtk_la_CFLAGS = $(CHEESE_CFLAGS)
 
 libcheesecommon_la_SOURCES = \
 	cheese-gconf.c \
@@ -49,10 +55,6 @@ libcheese_gtk_la_SOURCES = \
 	cheese-widget-private.h \
 	$(NULL)
 
-EXTRA_DIST = cheese-gtk.symbols cheese-marshal.list
-CLEANFILES = $(BUILT_SOURCES)
-DISTCLEANFILES =
-
 # FIXME when we have a .pc file, and sonames
 cheesedir = $(includedir)/cheese
 cheese_HEADERS = cheese-widget.h cheese-avatar-chooser.h cheese-camera-device-monitor.h
@@ -65,8 +67,3 @@ libcheese_gtk_la_LDFLAGS = \
 	-export-symbols $(srcdir)/cheese-gtk.symbols	\
 	-no-undefined					\
 	$(AM_LDFLAGS)
-
-glib_enum_h = cheese-enum-types.h
-glib_enum_c = cheese-enum-types.c
-glib_enum_headers = cheese-widget.h
-include $(top_srcdir)/Makefile.am.enums



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