summaryrefslogtreecommitdiff
path: root/bin/automake.in
diff options
context:
space:
mode:
authorMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>2018-07-20 15:57:14 +0200
committerMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>2018-07-20 15:57:14 +0200
commit5d67c620ca0504a91bc6f285de4184d17dffe4d9 (patch)
tree9258c2495f89975af7c76da1fc6669d01c920b68 /bin/automake.in
parentdab76f124624298068db4f4a73f0803252957a27 (diff)
downloadautomake-5d67c620ca0504a91bc6f285de4184d17dffe4d9.tar.gz
lib/Automake/File.pm: Modifie file_contents_internal
This function now takes a list of paragraph as argument instead of building it in its code. This is the first step in the modification of this function to be able to test it with files that don't "physically" exist in the actual file system. * lib/Automake/File.pm: Start the modification of file_contents_internal for unit testing
Diffstat (limited to 'bin/automake.in')
-rwxr-xr-xbin/automake.in89
1 files changed, 47 insertions, 42 deletions
diff --git a/bin/automake.in b/bin/automake.in
index 761491fbf..6c79d1422 100755
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -1738,54 +1738,59 @@ sub check_canonical_spelling
# Set up the compile suite.
sub handle_compile ()
{
- return if ! $must_handle_compiled_objects;
+ return if ! $must_handle_compiled_objects;
- # Boilerplate.
- my $default_includes = '';
- if (! option 'nostdinc')
- {
- my @incs = ('-I.', subst ('am__isrc'));
+ # Boilerplate.
+ my $default_includes = '';
+ if (! option 'nostdinc')
+ {
+ my @incs = ('-I.', subst ('am__isrc'));
- my $var = var 'CONFIG_HEADER';
- if ($var)
- {
- foreach my $hdr (split (' ', $var->variable_value))
- {
- push @incs, '-I' . dirname ($hdr);
- }
- }
- # We want '-I. -I$(srcdir)', but the latter -I is redundant
- # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@`
- # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'.
- # Items in CONFIG_HEADER are never in $(srcdir) so it is safe
- # to just put @am__isrc@ right after '-I.', without a space.
- ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/;
- }
+ my $var = var 'CONFIG_HEADER';
+ if ($var)
+ {
+ foreach my $hdr (split (' ', $var->variable_value))
+ {
+ push @incs, '-I' . dirname ($hdr);
+ }
+ }
+ # We want '-I. -I$(srcdir)', but the latter -I is redundant
+ # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@`
+ # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'.
+ # Items in CONFIG_HEADER are never in $(srcdir) so it is safe
+ # to just put @am__isrc@ right after '-I.', without a space.
+ ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/;
+ }
- my (@mostly_rms, @dist_rms);
- foreach my $item (sort keys %compile_clean_files)
+ my (@mostly_rms, @dist_rms);
+ foreach my $item (sort keys %compile_clean_files)
{
- if ($compile_clean_files{$item} == MOSTLY_CLEAN)
- {
- push (@mostly_rms, "\t-rm -f $item");
- }
- elsif ($compile_clean_files{$item} == DIST_CLEAN)
- {
- push (@dist_rms, "\t-rm -f $item");
- }
- else
- {
- prog_error 'invalid entry in %compile_clean_files';
- }
+ if ($compile_clean_files{$item} == MOSTLY_CLEAN)
+ {
+ push (@mostly_rms, "\t-rm -f $item");
+ }
+ elsif ($compile_clean_files{$item} == DIST_CLEAN)
+ {
+ push (@dist_rms, "\t-rm -f $item");
+ }
+ else
+ {
+ prog_error 'invalid entry in %compile_clean_files';
+ }
}
- my ($coms, $vars, $rules) =
- file_contents_internal (1, "$libdir/am/compile.am",
- new Automake::Location,
- 'DEFAULT_INCLUDES' => $default_includes,
- 'MOSTLYRMS' => join ("\n", @mostly_rms),
- 'DISTRMS' => join ("\n", @dist_rms));
- $output_vars .= $vars;
+ my $filename = "$libdir/am/compile.am";
+ my %transform =
+ (
+ 'DEFAULT_INCLUDES' => $default_includes,
+ 'MOSTLYRMS' => join ("\n", @mostly_rms),
+ 'DISTRMS' => join ("\n", @dist_rms)
+ );
+
+ my @paragraphs = make_paragraphs ($filename, %transform);
+ my ($coms, $vars, $rules) =
+ file_contents_internal (1, $filename, new Automake::Location,
+ \@paragraphs, %transform);
$output_rules .= "$coms$rules";
}