From: Stefano Lattarini Date: Sat, 21 Jul 2012 13:49:25 +0000 (+0200) Subject: [ng] automake: new function &almost_verbatim (small refactoring) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d5b52a96cf22911c8d271da9acdef8b4618304e;p=thirdparty%2Fautomake.git [ng] automake: new function &almost_verbatim (small refactoring) * automake.in (almost_verbatim): New function, thin wrapper around '&preprocess_file'. It requires just the name of the fragment to preprocess (assuming it is one provided by automake, and thus taking care to prepend the "$libdir/am/" path and append the ".am" extension automatically), and then automatically append the processed content to the '$output_verbatim' global variable. (handle_all_and_check, handle_install, handle_texinfo): Adjust to use '&almost_verbatim' instead of '&preprocess_file'. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index 6e7da4b39..b1875fd22 100644 --- a/automake.in +++ b/automake.in @@ -3013,7 +3013,7 @@ sub handle_texinfo () if ($info_texinfos) { define_verbose_texinfo; - $output_verbatim .= preprocess_file ("$libdir/am/texibuild.am"); + almost_verbatim ('texibuild'); ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); chomp $mostlyclean; chomp $clean; @@ -3930,7 +3930,7 @@ sub handle_footer # Generate 'make install' rules. sub handle_install () { - $output_verbatim .= preprocess_file ("$libdir/am/install.am"); + almost_verbatim ('install'); } # Generate "make all" and "make check" rules. @@ -3944,13 +3944,13 @@ sub handle_all_and_check () if dirname ($out) eq $relative_dir; } - $output_verbatim .= preprocess_file ("$libdir/am/all-target.am", - 'ALL-DEPS' => "@all", - 'LOCAL-HEADERS' => "@local_headers"); + almost_verbatim ('all-target', + 'ALL-DEPS' => "@all", + 'LOCAL-HEADERS' => "@local_headers"); - $output_verbatim .= preprocess_file ("$libdir/am/check-target.am", - 'CHECK-DEPS' => "@check", - 'CHECK-TESTS' => "@check_tests"); + almost_verbatim ('check-target', + 'CHECK-DEPS' => "@check", + 'CHECK-TESTS' => "@check_tests"); } # Generate helper targets for user recursion, where needed. @@ -5882,6 +5882,17 @@ sub preprocess_file ($%) return $_; } +# almost_verbatim ($NAME, [%TRANSFORM]) +# ------------------------------------- +# Load a "$libdir/am/$NAME.am", apply the %TRANSFORM, and append the +# result to the '$output_verbatim'. No extra parsing or post-processing +# is done (i.e., recognition of rules declaration or of make variables +# definitions). +sub almost_verbatim ($%) +{ + my $name = shift; + $output_verbatim .= preprocess_file ("$libdir/am/$name.am", @_); +} # @PARAGRAPHS # &make_paragraphs ($MAKEFILE, [%TRANSFORM]) @@ -6910,7 +6921,7 @@ sub generate_makefile ($$) check_gnu_standards; check_gnits_standards; - $output_verbatim .= preprocess_file ("$libdir/am/am-dir.am"); + almost_verbatim ('am-dir'); handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); handle_gettext;