]> sourceware.org Git - automake.git/commitdiff
* automake.in (initialize_per_input): Initialize %object_map.
authorTom Tromey <tromey@redhat.com>
Sun, 21 Mar 1999 21:11:32 +0000 (21:11 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 21 Mar 1999 21:11:32 +0000 (21:11 +0000)
(handle_single_transform_list): Allow source files in
subdirectories.

ChangeLog
automake.in

index 6ea245f28cd0c79c432f2236487c4847c3cd8d44..8dec3e5503961d2d6d687ae5091402ac42cc649b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1999-03-21  Tom Tromey  <tromey@cygnus.com>
+
+       * automake.in (initialize_per_input): Initialize %object_map.
+       (handle_single_transform_list): Allow source files in
+       subdirectories.
+
 1999-03-21  Jim Meyering  <meyering@na-net.ornl.gov>
 
        * automake.in (handle_dist): Add missing newline after the first
index 64309e75e5cdc362ae163fcadaa6258b14b85cfd..4da86eff22878514484a68e7dd3fe1943ee0895d 100755 (executable)
@@ -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
This page took 0.047342 seconds and 5 git commands to generate.