From: Tom Tromey Date: Sun, 21 Mar 1999 21:11:32 +0000 (+0000) Subject: * automake.in (initialize_per_input): Initialize %object_map. X-Git-Tag: user-dep-gen-branchpoint~20 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=0bb43f8e9629a856840128d37f9ccc588c2dfea9;p=automake.git * automake.in (initialize_per_input): Initialize %object_map. (handle_single_transform_list): Allow source files in subdirectories. --- diff --git a/ChangeLog b/ChangeLog index 6ea245f2..8dec3e55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1999-03-21 Tom Tromey + + * automake.in (initialize_per_input): Initialize %object_map. + (handle_single_transform_list): Allow source files in + subdirectories. + 1999-03-21 Jim Meyering * automake.in (handle_dist): Add missing newline after the first diff --git a/automake.in b/automake.in index 64309e75..4da86eff 100755 --- a/automake.in +++ b/automake.in @@ -1068,22 +1068,16 @@ sub handle_single_transform_list # Skip things that look like configure substitutions. next if /^\@.*\@$/; - # We don't support source files in a subdirectory. The - # reason is that we'd want to put the .o into a similar - # subdirectory, but this means finding a good way to make - # the directory. Later. - if (/\//) - { - &am_error - ("not supported: source file `$_' is in subdirectory"); - next; - } + # If the source file is in a subdirectory then the `.o' is + # put into the current directory. # Split file name into base and extension. - local ($base, $extension, $linker, $object); - next if ! /^(.*)\.(.*)$/; - $base = $1; - $extension = $2; + local ($full, $directory, $base, $extension, $linker, $object); + next if ! /^((.*)\/)?([^\/]*)\.(.*)$/; + $full = $_; + $directory = $2; + $base = $3; + $extension = $4; local ($lang) = $extension_map{$extension}; if ($lang) @@ -1125,6 +1119,23 @@ sub handle_single_transform_list push (@result, $object); + if (defined $object_map{$object}) + { + if ($object_map{$object} ne $full) + { + &am_error ("object \`$object' created by \`$full' and \`$object_map{$object}'"); + } + } + else + { + $object_map{$object} = $full; + if ($directory ne '') + { + # If file is in subdirectory, we need explicit dependency. + &pretty_print_rule ($object . ':', "\t", $full); + } + } + # Transform .o or $o file into .P file (for automatic # dependency code). $dep_files{'.deps/' . $base . '.P'} = 1; @@ -6328,6 +6339,11 @@ sub initialize_per_input @sources = (); @objects = (); + # This hash maps object file names onto their corresopnding source + # file names. This is used to ensure that each object is created + # by a single source file. + %object_map = (); + # These variables track inclusion of various compile-related .am # files. $included_generic_compile is TRUE if the basic code has # been included. $included_knr_compile is TRUE if the ansi2knr