From a09d8f50b3ba671c5366b46edf7f48192a936c99 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 2 Jun 2012 17:59:19 +0200 Subject: [PATCH] [ng] internals: copy 'header-vars.am' more verbatim in the output makefile * 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 --- 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 1bf6a241d..0428cf97b 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 42e7bf9ad..616877a7b 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 4bfc9be90..f20ebf840 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 '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 : -- 2.47.2