]> sourceware.org Git - automake.git/commitdiff
For PR automake/224:
authorTom Tromey <tromey@redhat.com>
Sun, 20 Jan 2002 21:30:17 +0000 (21:30 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 20 Jan 2002 21:30:17 +0000 (21:30 +0000)
* tests/Makefile.am (TESTS): Added pr224.test.
* tests/pr224.test: New file.
* lib/depcomp: Fixed computation of depfile.
* lib/am/depend2.am: Use %DEPBASE%, not $(DEPDIR).
* automake.in (handle_single_transform_list): Only reject `..'
component for Java.  Put dependencies in directory near object.
(handle_languages): Set DEPBASE.  Handle de-ansi-fication.

ChangeLog
automake.in
automake.texi
lib/am/depend2.am
lib/depcomp
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/pr224.test [new file with mode: 0755]
version.texi

index e09dc640a61dbf5e23aabe4d812e28cae7b0951e..0cfa8d1ab16d1d25ee120b4e18e936baf65303f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-01-20  Tom Tromey  <tromey@redhat.com>
+
+       For PR automake/224:
+       * tests/Makefile.am (TESTS): Added pr224.test.
+       * tests/pr224.test: New file.
+       * lib/depcomp: Fixed computation of depfile.
+       * lib/am/depend2.am: Use %DEPBASE%, not $(DEPDIR).
+       * automake.in (handle_single_transform_list): Only reject `..'
+       component for Java.  Put dependencies in directory near object.
+       (handle_languages): Set DEPBASE.  Handle de-ansi-fication.
+
 2002-01-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * tests/defs: Export AUTOMAKE and ACLOCAL.
index 3ab25bcb7d46be680b8cbf9ad6a41a28fd23795e..41b1a2d5139a6e025928aea63a7a3624cfe1026d 100755 (executable)
@@ -1629,6 +1629,11 @@ sub handle_languages
 
                             'DERIVED-EXT' => $der_ext,
 
+                            # In this situation we know that the
+                            # object is in this directory, so
+                            # $(DEPDIR) is the correct location for
+                            # dependencies.
+                            'DEPBASE'   => '$(DEPDIR)/$*',
                             'BASE'      => '$*',
                             'SOURCE'    => '$<',
                             'OBJ'       => '$@',
@@ -1647,6 +1652,14 @@ sub handle_languages
        {
            my ($derived, $source, $obj, $myext) = split (' ', $file);
 
+           # For any specially-generated object, we must respect the
+           # ansi2knr setting so that we don't inadvertently try to
+           # use the default rule.
+           if ($lang->ansi && defined $options{'ansi2knr'})
+           {
+               $myext = '$U' . $myext;
+           }
+
            # We might see a given object twice, for instance if it is
            # used under different conditions.
            next if defined $seen_files{$obj};
@@ -1664,6 +1677,13 @@ sub handle_languages
            # We _need_ `-o' for per object rules.
            my $output_flag = $lang->output_flag || '-o';
 
+           my $depbase = dirname ($obj);
+           $depbase = ''
+               if $depbase eq '.';
+           $depbase .= '/'
+               unless $depbase eq '';
+           $depbase .= '$(DEPDIR)/' . basename ($obj);
+
            # Generate a transform which will turn suffix targets in
            # depend2.am into real targets for the particular objects we
            # are building.
@@ -1672,6 +1692,7 @@ sub handle_languages
                             (%transform,
                              'GENERIC'   => 0,
 
+                             'DEPBASE'   => $depbase,
                              'BASE'      => $obj,
                              'SOURCE'    => $source,
                              # Use $myext and not `.o' here, in case
@@ -2042,12 +2063,9 @@ sub handle_single_transform_list ($$$$@)
                 # FIXME: check that $DIRECTORY is somewhere in the
                 # project
 
-                # We don't allow `..' in object file names for
-                # *any* source, not just Java.  For Java it just
-                # doesn't make sense, but in general it is
-                # a problem because we can't pick a good name for
-                # the .deps entry.
-                if ($object =~ /(\/|^)\.\.\//)
+               # For Java, the way we're handling it right now, a
+               # `..' component doesn't make sense.
+                if ($lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
                 {
                     am_error ("`$full' contains `..' component but should not");
                 }
@@ -2060,8 +2078,9 @@ sub handle_single_transform_list ($$$$@)
                 # If we're generating dependencies, we also want
                 # to make sure that the appropriate subdir of the
                 # .deps directory is created.
-               push (@dep_list, require_build_directory ('$(DEPDIR)/' . $directory))
-                   if ($use_dependencies);
+               push (@dep_list,
+                     require_build_directory ($directory . '/$(DEPDIR)'))
+                   if $use_dependencies;
             }
 
             &pretty_print_rule ($object . ':', "\t", @dep_list)
@@ -2075,7 +2094,8 @@ sub handle_single_transform_list ($$$$@)
             my $depfile = $object;
             $depfile =~ s/\.([^.]*)$/.P$1/;
             $depfile =~ s/\$\(OBJEXT\)$/o/;
-            $dep_files{'$(DEPDIR)/' . $depfile} = 1;
+            $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
+                          . basename ($depfile)} = 1;
         }
     }
 
index 7e5760fdafa378654c228afb549be73f5620de7a..42de6731d6eaf754be38c74b267c8448181908c4 100644 (file)
@@ -53,7 +53,7 @@ by the Foundation.
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 1995, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
 @sp 2
 This is the first edition of the GNU Automake documentation,@*
 and is consistent with GNU Automake @value{VERSION}.@*
@@ -1485,7 +1485,7 @@ package.  If the user configures with @samp{--with-dmalloc}, then define
 Adds @samp{--with-regex} to the @code{configure} command line.  If
 specified (the default), then the @samp{regex} regular expression
 library is used, @file{regex.o} is put into @samp{LIBOBJS}, and
-@samp{WITH_REGEX} is defined..  If @samp{--without-regex} is given, then
+@samp{WITH_REGEX} is defined.  If @samp{--without-regex} is given, then
 the @samp{rx} regular expression library is used, and @file{rx.o} is put
 into @samp{LIBOBJS}.
 
index 0540e9d0957af4a310c5dea0d2000628c2a78252..46d3896dfc1e6636e3b44bd97ead74a2fb89186d 100644 (file)
@@ -18,7 +18,7 @@
 ## 02111-1307, USA.
 
 ## This file is read several times:
-## - once per *extention* (not per language) for generic compilation rules
+## - once per *extension* (not per language) for generic compilation rules
 ## - once for each file which requires specific flags.
 
 ## Note it is on purpose we wrote `if %AMDEP%', since:
@@ -34,7 +34,7 @@
 ?!GENERIC?%OBJ%: %SOURCE%
 if %AMDEP%
        source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
-       depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
+       depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
 ?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
@@ -44,7 +44,7 @@ endif %AMDEP%
 ?!GENERIC?%OBJOBJ%: %SOURCE%
 if %AMDEP%
        source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
-       depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' @AMDEPBACKSLASH@
+       depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
 ?-o?   %COMPILE% %-c% %-o% %OBJOBJ% `cygpath -w %SOURCE%`
@@ -55,7 +55,7 @@ if %?LIBTOOL%
 ?!GENERIC?%LTOBJ%: %SOURCE%
 if  %AMDEP%
        source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
-       depfile='$(DEPDIR)/%BASE%.Plo' tmpdepfile='$(DEPDIR)/%BASE%.TPlo' @AMDEPBACKSLASH@
+       depfile='%DEPBASE%.Plo' tmpdepfile='%DEPBASE%.TPlo' @AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif  %AMDEP%
 ## We can always use `-o' with Libtool.
index 9ab71e2f2657d35e6c0a106ba29a86ed742331a7..d1d45a3feaed09fae72543b5ed84341fecaf5d26 100755 (executable)
@@ -31,7 +31,16 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
 fi
 # `libtool' can also be set to `yes' or `no'.
 
-depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
index d016b7aeb33ae4a1a7e87b375e5510af0e63ff15..c434cb561f4e057b2a6779e280214e29b1c922fd 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 9 January 2002
+@set UPDATED 20 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
index 4f93d5e940ca2ee581eb0faf2cd8b7f118112968..4aa24b20ca0d5c653a0619c15ec42e4b083dc8e6 100644 (file)
@@ -252,6 +252,7 @@ pr2.test \
 pr204.test \
 pr211.test \
 pr220.test \
+pr224.test \
 pr229.test \
 pr243.test \
 pr266.test \
index 2eab6a5ddbf7f34a9934e0937ac34766e2189e68..a3ef24a54db5c93bacaef245416d2e924ea7dae4 100644 (file)
@@ -326,6 +326,7 @@ pr2.test \
 pr204.test \
 pr211.test \
 pr220.test \
+pr224.test \
 pr229.test \
 pr243.test \
 pr266.test \
diff --git a/tests/pr224.test b/tests/pr224.test
new file mode 100755 (executable)
index 0000000..5023fa8
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+# Test for $(top_srcdir) with dependencies.
+
+required=gcc
+. $srcdir/defs || exit 1
+
+mkdir foo
+
+cat >foo/main.c <<'EOF'
+int main() { return 0; }
+EOF
+
+cat >Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = bar
+bar_SOURCES = foo/main.c
+EOF
+
+cat >configure.in <<'EOF'
+AC_INIT(foo/main.c)
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE(test_am, 1.0)
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_OUTPUT(Makefile)
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+mkdir build
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cd build
+CC='gcc' ../configure
+$MAKE
+
+test -d foo/.deps
index d016b7aeb33ae4a1a7e87b375e5510af0e63ff15..c434cb561f4e057b2a6779e280214e29b1c922fd 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 9 January 2002
+@set UPDATED 20 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
This page took 0.053572 seconds and 5 git commands to generate.