Makefile.am.marshal 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# 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>

17 18 19 20 21 22 23
# 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))

24 25
marshal_h = $(glib_marshal_list:.list=.h)
marshal_c = $(glib_marshal_list:.list=.c)
26
marshal_list = $(addprefix $(srcdir)/, $(glib_marshal_list))
27 28 29 30

CLEANFILES += stamp-marshal
DISTCLEANFILES += $(marshal_h) $(marshal_c)
BUILT_SOURCES += $(marshal_h) $(marshal_c)
31
EXTRA_DIST += $(marshal_list)
32

33 34
stamp-marshal: $(marshal_list)
	$(AM_V_GEN)$(GLIB_GENMARSHAL) \
35 36
		--prefix=$(glib_marshal_prefix) \
		--header \
37
	$(marshal_list) > xgen-mh \
38 39 40 41 42 43 44 45
	&& (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)
Emmanuele Bassi's avatar
Emmanuele Bassi committed
46
	$(AM_V_GEN)$(GLIB_GENMARSHAL) \
47 48
		--prefix=$(glib_marshal_prefix) \
		--body \
49 50
	$(marshal_list) > xgen-mc \
	&& (cmp -s xgen-mc $(marshal_c) || cp -f xgen-mc $(marshal_c)) \
51
	&& rm -f xgen-mc