automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/6] vala: cleanup rules are better and more complete now


From: Stefano Lattarini
Subject: [PATCH 4/6] vala: cleanup rules are better and more complete now
Date: Tue, 17 Apr 2012 10:40:19 +0200

* automake.in (lang_vala_finish_target): Ensure Vala-generated C sources
and header files and our custom stamp files are correctly cleaned.
* t/vala-headers.sh, t/vala-vpath.sh: Enhance.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 NEWS              |    3 +++
 automake.in       |   25 +++++++++++++++----------
 t/vala-headers.sh |    3 +++
 t/vala-vpath.sh   |   15 ++++++++-------
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/NEWS b/NEWS
index 9b487a0..142f805 100644
--- a/NEWS
+++ b/NEWS
@@ -236,6 +236,9 @@ Bugs fixed in 1.11c:
 
   - Automake's own build system finally have a real "installcheck" target.
 
+  - Vala-related cleanup rules are now more complete, and work better in
+    a VPATH setup.
+
   - Files listed with the AC_REQUIRE_AUX_FILE macro in configure.ac are
     now automatically distributed also if the directory of the auxiliary
     files coincides with the top-level directory.
diff --git a/automake.in b/automake.in
index 7930ff1..d8235ab 100644
--- a/automake.in
+++ b/automake.in
@@ -5826,12 +5826,16 @@ sub lang_vala_finish_target ($$)
   foreach my $vala_file (@vala_sources)
     {
       my $c_file = $vala_file;
-      $output_rules .= "\$(srcdir)/$c_file: \$(srcdir)/${derived}_vala.stamp\n"
-        . "address@hidden test -f \$@; then :; else rm -f 
\$(srcdir)/${derived}_vala.stamp; fi\n"
-        . "address@hidden test -f \$@; then :; else \\\n"
-        . "\t  \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; 
\\\n"
-        . "\tfi\n"
-        if $c_file =~ s/(.*)\.vala$/$1.c/;
+      if ($c_file =~ s/(.*)\.vala$/$1.c/)
+        {
+          $c_file = "\$(srcdir)/$c_file";
+          $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n"
+            . "address@hidden test -f \$@; then :; else rm -f 
\$(srcdir)/${derived}_vala.stamp; fi\n"
+            . "address@hidden test -f \$@; then :; else \\\n"
+            . "\t  \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; 
\\\n"
+            . "\tfi\n";
+         $clean_files{$c_file} = MAINTAINER_CLEAN;
+        }
     }
 
   # Add rebuild rules for generated header and vapi files
@@ -5844,8 +5848,8 @@ sub lang_vala_finish_target ($$)
          if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header',
                                  '--vapi', '--internal-vapi', '--gir')))
            {
-             my $headerfile = $flag;
-             $output_rules .= "\$(srcdir)/$headerfile: 
\$(srcdir)/${derived}_vala.stamp\n"
+             my $headerfile = "\$(srcdir)/$flag";
+             $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n"
                . "address@hidden test -f \$@; then :; else rm -f 
\$(srcdir)/${derived}_vala.stamp; fi\n"
                . "address@hidden test -f \$@; then :; else \\\n"
                . "\t  \$(MAKE) \$(AM_MAKEFLAGS) 
\$(srcdir)/${derived}_vala.stamp; \\\n"
@@ -5879,6 +5883,7 @@ sub lang_vala_finish_target ($$)
 
   my $verbose = verbose_flag ('VALAC');
   my $silent = silent_flag ();
+  my $stampfile = "\$(srcdir)/${derived}_vala.stamp";
 
   $output_rules .=
     "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n".
@@ -5892,9 +5897,9 @@ sub lang_vala_finish_target ($$)
     "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n".
     "\t${silent}mv -f address@hidden address@hidden";
 
-  push_dist_common ("${derived}_vala.stamp");
+  push_dist_common ($stampfile);
 
-  $clean_files{"${derived}_vala.stamp"} = MAINTAINER_CLEAN;
+  $clean_files{$stampfile} = MAINTAINER_CLEAN;
 }
 
 # Add output rules to invoke valac and create stamp file as a witness
diff --git a/t/vala-headers.sh b/t/vala-headers.sh
index 764c747..ffb66d9 100755
--- a/t/vala-headers.sh
+++ b/t/vala-headers.sh
@@ -79,4 +79,7 @@ for h in $headers; do test -f $h; done
 
 $MAKE distcheck
 
+$MAKE maintainer-clean
+for h in $headers; do test ! -f $h; done
+
 :
diff --git a/t/vala-vpath.sh b/t/vala-vpath.sh
index 0d2e8c9..ae2d792 100755
--- a/t/vala-vpath.sh
+++ b/t/vala-vpath.sh
@@ -32,7 +32,7 @@ bin_PROGRAMS = foo bar
 AM_VALAFLAGS = --profile=posix
 foo_SOURCES = hello.vala
 bar_VALAFLAGS = $(AM_VALAFLAGS) -H zardoz.h
-bar_SOURCES = $(foo_SOURCES)
+bar_SOURCES = goodbye.vala
 END
 
 cat > hello.vala <<'END'
@@ -41,6 +41,7 @@ void main ()
   stdout.printf ("foofoofoo\n");
 }
 END
+cp hello.vala goodbye.vala
 
 $ACLOCAL
 $AUTOCONF
@@ -79,12 +80,12 @@ $MAKE -n | grep '\.stamp' && Exit 1
 $MAKE clean
 test -f ../foo_vala.stamp
 test -f ../bar_vala.stamp
-grep barbarbar ../hello.c
+test -f ../zardoz.h
+test -f ../hello.c
 $MAKE maintainer-clean
-# FIXME: Generated C files and stamp files doesn't get correctly
-# FIXME: cleaned in a VPATH build.
-#test ! -f ../hello.c
-#test ! -f ../foo_vala.stamp
-#test ! -f ../bar_vala.stamp
+test ! -f ../zardoz.h
+test ! -f ../hello.c
+test ! -f ../foo_vala.stamp
+test ! -f ../bar_vala.stamp
 
 :
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]