automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [FYI] [ng] internals: copy 'header-vars.am' more verbatim


From: Stefano Lattarini
Subject: [Automake-NG] [FYI] [ng] internals: copy 'header-vars.am' more verbatim in the output makefile
Date: Sat, 2 Jun 2012 20:53:43 +0200

* automake.in (define_standard_variables): The 'header-vars.am' file should
contain no rule definition, nor any variable definition that must be known
at automake runtime; so we can read and process that file's content using
the 'preprocess_file' function rather than the 'file_contents_internal' one.
This will allow us to make a more liberal use of GNU make builtins in there,
like the 'define' builtin.
* t/comment4.sh: Adjust.
* t/vpath.sh: Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in   |    8 +-------
 t/comment4.sh |   13 ++++++++-----
 t/vpath.sh    |   20 +++++++++++++++++---
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/automake.in b/automake.in
index 1bf6a24..0428cf9 100644
--- a/automake.in
+++ b/automake.in
@@ -6250,17 +6250,11 @@ sub read_am_file ($$)
 # and variables from header-vars.am.
 sub define_standard_variables
 {
-  my $saved_output_vars = $output_vars;
-  my ($comments, undef, $rules) =
-    file_contents_internal (1, "$libdir/am/header-vars.am",
-                           new Automake::Location);
-
   foreach my $var (sort keys %configure_vars)
     {
       &define_configure_variable ($var);
     }
-
-  $output_vars .= $comments . $rules;
+  $output_vars .= preprocess_file ("$libdir/am/header-vars.am");
 }
 
 # Read main am file.
diff --git a/t/comment4.sh b/t/comment4.sh
index 42e7bf9..616877a 100755
--- a/t/comment4.sh
+++ b/t/comment4.sh
@@ -31,9 +31,12 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
-# UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file
-test `sed -n -e '1,/UnIqUe_COPYRIGHT_BOILERPLATE/p' Makefile.in \
-      | wc -l` -le 30
+# UnIqUe_COPYRIGHT_BOILERPLATE shouldn't appear just before the
+# definition of 'mumble'.
+test $(sed -n -e '/UnIqUe_COPYRIGHT_BOILERPLATE/,/UnIqUe_MUMBLE_VALUE/p' \
+       Makefile.in | wc -l) -gt 50
 # UnIqUe_MUMBLE_COMMENT should appear right before the mumble declaration.
-test `sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' Makefile.in \
-      | wc -l` -eq 2
+test $(sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' \
+       Makefile.in | wc -l) -eq 2
+
+:
diff --git a/t/vpath.sh b/t/vpath.sh
index 4bfc9be..f20ebf8 100755
--- a/t/vpath.sh
+++ b/t/vpath.sh
@@ -19,15 +19,29 @@
 
 . ./defs || Exit 1
 
+echo AC_OUTPUT >> configure.ac
+
 cat > Makefile.am << 'END'
 VPATH = zardoz
+%.bar: %.foo
+       cp $< $@
 END
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
-grep VPATH Makefile.in # For debugging.
-grep '^VPATH = zardoz$' Makefile.in
-grep 'address@hidden@' Makefile.in && Exit 1
+mkdir build
+cd build
+mkdir zardoz
+../configure
+
+echo OK > zardoz/file.foo
+echo KO > ../file.foo
+$MAKE file.bar
+test "$(cat file.bar)" = OK
+rm -f file.bar zardoz/file.foo
+$MAKE file.bar && Exit 1
+test ! -f file.bar
 
 :
-- 
1.7.9.5




reply via email to

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