From 8ad3fb0c2a9e0542235427f96f797c9bcf90d2b3 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Oct 2009 12:59:39 -0500 Subject: Stealing these makefile segments to build enums and marshallers --- Makefile.am.enum | 43 +++++++++++++++++++++++++++++++++++++++++++ Makefile.am.marshal | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 Makefile.am.enum create mode 100644 Makefile.am.marshal diff --git a/Makefile.am.enum b/Makefile.am.enum new file mode 100644 index 0000000..208dee3 --- /dev/null +++ b/Makefile.am.enum @@ -0,0 +1,43 @@ +# Rules for generating enumeration types using glib-mkenums +# +# Define: +# glib_enum_h = header template file +# glib_enum_c = source template file +# glib_enum_headers = list of headers to parse +# +# before including Makefile.am.enums. You will also need to have +# the following targets already defined: +# +# CLEANFILES +# DISTCLEANFILES +# BUILT_SOURCES +# EXTRA_DIST +# +# Author: Emmanuele Bassi + +enum_tmpl_h=$(glib_enum_h:.h=.h.in) +enum_tmpl_c=$(glib_enum_c:.c=.c.in) + +CLEANFILES += stamp-enum-types +DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c) +BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c) +EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c) + +stamp-enum-types: $(glib_enum_headers) + $(QUIET_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_h) \ + $(glib_enum_headers) > xgen-eh \ + && (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \ + && rm -f xgen-eh \ + && echo timestamp > $(@F) + +$(glib_enum_h): stamp-enum-types + @true + +$(glib_enum_c): $(glib_enum_h) + $(QUIET_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_c) \ + $(glib_enum_headers) > xgen-ec \ + && cp -f xgen-ec $(glib_enum_c) \ + && rm -f xgen-ec + diff --git a/Makefile.am.marshal b/Makefile.am.marshal new file mode 100644 index 0000000..8b30d4f --- /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 + +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 += $(glib_marshal_list) + +stamp-marshal: $(glib_marshal_list) + $(QUIET_GEN)$(GLIB_GENMARSHAL) \ + --prefix=$(glib_marshal_prefix) \ + --header \ + $(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) + $(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \ + $(GLIB_GENMARSHAL) \ + --prefix=$(glib_marshal_prefix) \ + --body \ + $(glib_marshal_list)) > xgen-mc \ + && cp xgen-mc $(marshal_c) \ + && rm -f xgen-mc + -- cgit v1.2.3