]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Vala: Add and test rebuild rules for generated header and vapi files.
authorJürg Billeter <j@bitron.ch>
Fri, 15 May 2009 13:50:59 +0000 (15:50 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 17 May 2009 08:18:19 +0000 (10:18 +0200)
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.

* automake.in (lang_vala_finish_target): Recognize -H, -h,
--header, --internal-header, --vapi, --internal-api, --gir flags
to valac and rebuild rules for generated headers; distribute
and maintainer-clean them.
* tests/vala2.test: Test rebuild rules.

Signed-off-by: Jürg Billeter <j@bitron.ch>
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
automake.in
tests/vala2.test

index a8589d35441328206f87d0fa2e2f6d78c5fe891b..b0f6f7afab498596f25f3de351d827e233f06075 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-17  Jürg Billeter  <j@bitron.ch>
+
+       Vala: Add and test rebuild rules for generated header and vapi files.
+       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.
+       * automake.in (lang_vala_finish_target): Recognize -H, -h,
+       --header, --internal-header, --vapi, --internal-api, --gir flags
+       to valac and rebuild rules for generated headers; distribute
+       and maintainer-clean them.
+       * tests/vala2.test: Test rebuild rules.
+
 2009-05-17  Jürg Billeter  <j@bitron.ch>
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index be525053bfc4b1b626c4e94cbcf726ade1e04c96..a2b735f021dc5ac8edc24459efe4ad460d7a7358 100755 (executable)
@@ -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".
+               "\t\@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
index a6efba98af263ff29bf161dff0a875a1039d1f1a..bfa38cd3b877012cc152aedf209edc78db974c79 100755 (executable)
@@ -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