]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] internals: copy 'header-vars.am' more verbatim in the output makefile
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 2 Jun 2012 15:59:19 +0000 (17:59 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 2 Jun 2012 19:44:00 +0000 (21:44 +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 <stefano.lattarini@gmail.com>
automake.in
t/comment4.sh
t/vpath.sh

index 1bf6a241d767af09df290e0da811e4f6a72db6d5..0428cf97b779647b50f728d8c5f9219e993a518f 100644 (file)
@@ -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.
index 42e7bf9ad9f583556c3ea7109f5e453865fdf344..616877a7b3f9144aa064322c007667a89df5626f 100755 (executable)
@@ -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
+
+:
index 4bfc9be901f0efdfaf31e1059d28746f561cff97..f20ebf84023de55c2c61ec779436cbb042bec58c 100755 (executable)
 
 . ./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 'VPATH.*@srcdir@' 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
 
 :