diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am index 96bb55f80..b510e22a6 100644 --- a/build/autotools/Makefile.am +++ b/build/autotools/Makefile.am @@ -2,6 +2,8 @@ NULL = EXTRA_DIST = \ Makefile.am.silent \ + Makefile.am.marshal \ + Makefile.am.enums \ dolt.m4 \ introspection.m4 \ gtk-doc.m4 \ diff --git a/build/autotools/Makefile.am.enums b/build/autotools/Makefile.am.enums new file mode 100644 index 000000000..208dee30c --- /dev/null +++ b/build/autotools/Makefile.am.enums @@ -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/build/autotools/Makefile.am.marshal b/build/autotools/Makefile.am.marshal new file mode 100644 index 000000000..c3f62a150 --- /dev/null +++ b/build/autotools/Makefile.am.marshal @@ -0,0 +1,44 @@ +# 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 diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 85aa046f8..d26c68a4f 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -16,10 +16,11 @@ DIST_SUBDIRS = pango glx eglx eglnative cogl sdl json osx x11 win32 fruity target = $(clutterbackend) -MARSHALFILES = clutter-marshal.c clutter-marshal.h -ENUMFILES = clutter-enum-types.c clutter-enum-types.h -STAMPFILES = stamp-clutter-marshal.h stamp-clutter-enum-types.h - +# common definitions +CLEANFILES = +DISTCLEANFILES = +EXTRA_DIST = +BUILT_SOURCES = INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/clutter/cogl \ @@ -46,8 +47,6 @@ LDADD = \ -rpath $(libdir) \ $(NULL) -BUILT_SOURCES = $(MARSHALFILES) $(ENUMFILES) - # please, keep this sorted alphabetically source_h = \ $(srcdir)/clutter-actor.h \ @@ -100,44 +99,16 @@ source_h = \ $(top_builddir)/clutter/clutter-version.h \ $(NULL) -clutter-marshal.h: stamp-clutter-marshal.h - @true -stamp-clutter-marshal.h: clutter-marshal.list - $(QUIET_GEN)$(GLIB_GENMARSHAL) \ - --prefix=clutter_marshal \ - --header \ - $(srcdir)/clutter-marshal.list > xgen-cmh \ - && (cmp -s xgen-cmh clutter-marshal.h || cp xgen-cmh clutter-marshal.h ) \ - && rm -f xgen-cmh \ - && echo timestamp > $(@F) +# glib-genmarshal rules +glib_marshal_list = $(srcdir)/clutter-marshal.list +glib_marshal_prefix = clutter_marshal +include $(top_srcdir)/build/autotools/Makefile.am.marshal -clutter-marshal.c: clutter-marshal.h Makefile - $(QUIET_GEN)( echo "#include \"clutter-marshal.h\"" ; \ - $(GLIB_GENMARSHAL) \ - --prefix=clutter_marshal \ - --body \ - $(srcdir)/clutter-marshal.list --body ) >> xgen-cmc \ - && cp xgen-cmc clutter-marshal.c \ - && rm -f xgen-cmc - -clutter-enum-types.h: stamp-clutter-enum-types.h - @true -stamp-clutter-enum-types.h: $(source_h) Makefile - $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/clutter-enum-types.h.in \ - $(source_h) ) >> xgen-ceth && \ - (cmp -s xgen-ceth clutter-enum-types.h || cp xgen-ceth clutter-enum-types.h) && \ - rm -f xgen-ceth && \ - echo timestamp > $(@F) - -clutter-enum-types.c: clutter-enum-types.h - $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/clutter-enum-types.c.in \ - $(source_h) ) >> xgen-cetc && \ - cp xgen-cetc clutter-enum-types.c && \ - rm -f xgen-cetc - -CLEANFILES = $(STAMPFILES) +# glib-mkenums rules +glib_enum_h = clutter-enum-types.h +glib_enum_c = clutter-enum-types.c +glib_enum_headers = $(source_h) +include $(top_srcdir)/build/autotools/Makefile.am.enums # please, keep this sorted alphabetically source_c = \ @@ -239,6 +210,9 @@ clutter_HEADERS = \ $(top_builddir)/clutter/clutter-enum-types.h \ $(top_srcdir)/clutter/clutter.h +DISTCLEANFILES += clutter-version.h +EXTRA_DIST += clutter-version.h.in + if HAVE_INTROSPECTION BUILT_GIRSOURCES = @@ -322,16 +296,3 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) endif - -DISTCLEANFILES = \ - $(ENUMFILES) \ - $(MARSHALFILES) \ - clutter-version.h \ - $(NULL) - -EXTRA_DIST = \ - clutter-marshal.list \ - clutter-version.h.in \ - clutter-enum-types.h.in \ - clutter-enum-types.c.in \ - $(NULL)