valac will generate additional files when using, for example, -H in VALAFLAGS. We need to recognize these options and add appropriate rebuild rules to fix parallel build.
Signed-off-by: Jürg Billeter <j...@bitron.ch> --- automake.in | 26 ++++++++++++++++++++++++++ tests/vala2.test | 6 ++++++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/automake.in b/automake.in index be52505..a2b735f 100755 --- a/automake.in +++ b/automake.in @@ -5951,6 +5951,32 @@ sub lang_vala_finish_target ($$) } } + # Add rebuild rules for generated header and vapi files + my $flags = var ($derived . '_VALAFLAGS'); + if ($flags) + { + my $lastflag = ''; + foreach my $flag ($flags->value_as_list_recursive) + { + if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header', + '--vapi', '--internal-vapi', '--gir'))) + { + my $headerfile = $flag; + $output_rules .= "$headerfile: ${derived}_vala.stamp\n". + "\...@if test -f \$@; then :; else \\\n". + "\t rm -f ${derived}_vala.stamp; \\\n". + "\t \$(MAKE) \$(AM_MAKEFLAGS) ${derived}_vala.stamp; \\\n". + "\tfi\n"; + + # valac is not used when building from dist tarballs + # distribute the generated files + push_dist_common ($headerfile); + $clean_files{$headerfile} = MAINTAINER_CLEAN; + } + $lastflag = $flag; + } + } + my $compile = $self->compile; # Rewrite each occurrence of `AM_VALAFLAGS' in the compile diff --git a/tests/vala2.test b/tests/vala2.test index a6efba9..bfa38cd 100755 --- a/tests/vala2.test +++ b/tests/vala2.test @@ -44,6 +44,7 @@ END cat > 'src/Makefile.am' <<'END' bin_PROGRAMS = zardoz +zardoz_VALAFLAGS = -H zardoz.h zardoz_CFLAGS = $(GOBJECT_CFLAGS) zardoz_LDADD = $(GOBJECT_LIBS) zardoz_SOURCES = zardoz.vala @@ -67,6 +68,11 @@ $AUTOMAKE -a ./configure || Exit 77 $MAKE + +# test rebuild rules +rm src/zardoz.h +$MAKE -C src zardoz.h + $MAKE distcheck $MAKE distclean mkdir build -- 1.6.3