Subject: bug#10894: Mixed C-Vala projects distcheck is broken

From: Quentin Glidic <[email-masked]>
Date: Sun, 26 Feb 2012 22:12:50 +0100

Package: automake
Version: 1.11.3

Hello,

The distcheck of a project which mix C and Vala targets in the same 
Makefile.am leads to a pass of C targets to valac, which is completely 
wrong and fails if you put your headers in _SOURCES (valac ignores *.c 
files only).

Attached a patch that limits the vala stamps’ generation to targets with 
*.vala file.

-- 

Quentin "Sardem FF7" Glidic
>From 98104788ad0b444e69fb4403cd7ad7c7780ca9ba Mon Sep 17 00:00:00 2001
From: Quentin Glidic <[email-masked]>
Date: Sat, 4 Feb 2012 11:00:10 +0100
Subject: [PATCH] vala: Fix mixed C/Vala projects distcheck

---
 automake.in |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/automake.in b/automake.in
index 69b6010..f354068 100644
--- a/automake.in
+++ b/automake.in
@@ -6038,12 +6038,13 @@ sub lang_vala_finish_target ($$)
   my $derived = canonicalize ($name);
   my $varname = $derived . '_SOURCES';
   my $var = var ($varname);
+  my $vala_output_rules = '';
 
   if ($var)
     {
       foreach my $file ($var->value_as_list_recursive)
         {
-          $output_rules .= "\$(srcdir)/$file: \$(srcdir)/${derived}_vala.stamp\n"
+          $vala_output_rules .= "\$(srcdir)/$file: \$(srcdir)/${derived}_vala.stamp\n"
             . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
             . "\t\@if test -f \$@; then :; else \\\n"
             . "\t  \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
@@ -6051,6 +6052,11 @@ sub lang_vala_finish_target ($$)
             if $file =~ s/(.*)\.vala$/$1.c/;
         }
     }
+  if ($vala_output_rules eq '')
+    {
+      return;
+    }
+  $output_rules .= $vala_output_rules;
 
   # Add rebuild rules for generated header and vapi files
   my $flags = var ($derived . '_VALAFLAGS');
-- 
1.7.8.1