build: Fix up rules for enums and marshallers

• Use addprefix instead of manually concatenating $(srcdir)
• Use AM_V_GEN instead of QUIET_GEN, to avoid inter-dependencies
• Do basic checks on GLIB_MKENUMS and GLIB_GENMARSHAL being defined
• Do checks on the required variables being defined
This commit is contained in:
Emmanuele Bassi 2010-09-07 14:47:59 +01:00
parent d7e5e9247b
commit 368b24b420
2 changed files with 31 additions and 16 deletions

View File

@ -15,17 +15,26 @@
#
# Author: Emmanuele Bassi <ebassi@linux.intel.com>
enum_tmpl_h=$(glib_enum_h:.h=.h.in)
enum_tmpl_c=$(glib_enum_c:.c=.c.in)
# Basic sanity checks
$(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS))
$(if $(or $(glib_enum_h), \
$(glib_enum_c)),, \
$(error Need to define glib_enum_h and glib_enum_c))
$(if $(glib_enum_headers),,$(error Need to define glib_enum_headers))
enum_tmpl_h=$(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in))
enum_tmpl_c=$(addprefix $(srcdir)/, $(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 += $(srcdir)/$(enum_tmpl_h) $(srcdir)/$(enum_tmpl_c)
EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c)
stamp-enum-types: $(glib_enum_headers) $(srcdir)/$(enum_tmpl_h)
$(QUIET_GEN)$(GLIB_MKENUMS) \
--template $(srcdir)/$(enum_tmpl_h) \
stamp-enum-types: $(glib_enum_headers) $(enum_tmpl_h)
$(AM_V_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 \
@ -34,10 +43,9 @@ stamp-enum-types: $(glib_enum_headers) $(srcdir)/$(enum_tmpl_h)
$(glib_enum_h): stamp-enum-types
@true
$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(srcdir)/$(enum_tmpl_c)
$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(enum_tmpl_c)
$(QUIET_GEN)$(GLIB_MKENUMS) \
--template $(srcdir)/$(enum_tmpl_c) \
--template $(enum_tmpl_c) \
$(glib_enum_headers) > xgen-ec \
&& cp -f xgen-ec $(glib_enum_c) \
&& rm -f xgen-ec

View File

@ -14,19 +14,27 @@
#
# Author: Emmanuele Bassi <ebassi@linux.intel.com>
# Basic sanity checks
$(if $(GLIB_GENMARSHAL),,$(error Need to define GLIB_GENMARSHAL))
$(if $(or $(glib_marshal_list), \
$(glib_marshal_prefix)),, \
$(error Need to define glib_marshal_list and glib_marshal_prefix))
marshal_h = $(glib_marshal_list:.list=.h)
marshal_c = $(glib_marshal_list:.list=.c)
marshal_list = $(addprefix $(srcdir)/, $(glib_marshal_list))
CLEANFILES += stamp-marshal
DISTCLEANFILES += $(marshal_h) $(marshal_c)
BUILT_SOURCES += $(marshal_h) $(marshal_c)
EXTRA_DIST += $(srcdir)/$(glib_marshal_list)
EXTRA_DIST += $(marshal_list)
stamp-marshal: $(glib_marshal_list)
$(QUIET_GEN)$(GLIB_GENMARSHAL) \
stamp-marshal: $(marshal_list)
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--header \
$(srcdir)/$(glib_marshal_list) > xgen-mh \
$(marshal_list) > xgen-mh \
&& (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
&& rm -f xgen-mh \
&& echo timestamp > $(@F)
@ -35,11 +43,10 @@ $(marshal_h): stamp-marshal
@true
$(marshal_c): $(marshal_h)
$(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \
$(AM_V_GEN)(echo "#include \"$(marshal_h)\"" ; \
$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--body \
$(srcdir)/$(glib_marshal_list)) > xgen-mc \
$(marshal_list)) > xgen-mc \
&& cp xgen-mc $(marshal_c) \
&& rm -f xgen-mc