automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: FYI: PR 224


From: Tom Tromey
Subject: Patch: FYI: PR 224
Date: 20 Jan 2002 14:44:36 -0700

I'm checking this in.

This fixes PR 224.  Now we put the .deps files near the object files.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1269
diff -u -r1.1269 automake.in
--- automake.in 2002/01/18 23:08:26 1.1269
+++ automake.in 2002/01/20 21:27:09
@@ -1629,6 +1629,11 @@
 
                             '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 @@
        {
            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 @@
            # 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 @@
                             (%transform,
                              'GENERIC'   => 0,
 
+                             'DEPBASE'   => $depbase,
                              'BASE'      => $obj,
                              'SOURCE'    => $source,
                              # Use $myext and not `.o' here, in case
@@ -2040,12 +2061,9 @@
                 # 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");
                 }
@@ -2058,8 +2076,9 @@
                 # 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)
@@ -2073,7 +2092,8 @@
             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: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.259
diff -u -r1.259 automake.texi
--- automake.texi 2002/01/09 08:52:05 1.259
+++ automake.texi 2002/01/20 21:27:13
@@ -53,7 +53,7 @@
 
 @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 @address@hidden
@@ -1485,7 +1485,7 @@
 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
address@hidden is defined..  If @samp{--without-regex} is given, then
address@hidden 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: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.157
diff -u -r1.157 stamp-vti
--- stamp-vti 2002/01/09 08:52:05 1.157
+++ stamp-vti 2002/01/20 21:27:13
@@ -1,4 +1,4 @@
address@hidden UPDATED 9 January 2002
address@hidden UPDATED 20 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.230
diff -u -r1.230 version.texi
--- version.texi 2002/01/09 08:52:05 1.230
+++ version.texi 2002/01/20 21:27:13
@@ -1,4 +1,4 @@
address@hidden UPDATED 9 January 2002
address@hidden UPDATED 20 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.29
diff -u -r1.29 depcomp
--- lib/depcomp 2002/01/09 21:17:42 1.29
+++ lib/depcomp 2002/01/20 21:27:14
@@ -31,7 +31,16 @@
 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: lib/am/depend2.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/depend2.am,v
retrieving revision 1.40
diff -u -r1.40 depend2.am
--- lib/am/depend2.am 2001/11/16 10:25:58 1.40
+++ lib/am/depend2.am 2002/01/20 21:27:14
@@ -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 @@
 ?!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 @@
 ?!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: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.374
diff -u -r1.374 Makefile.am
--- tests/Makefile.am 2002/01/18 23:08:27 1.374
+++ tests/Makefile.am 2002/01/20 21:27:14
@@ -251,6 +251,7 @@
 pr2.test \
 pr211.test \
 pr220.test \
+pr224.test \
 pr229.test \
 pr243.test \
 pr266.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.484
diff -u -r1.484 Makefile.in
--- tests/Makefile.in 2002/01/18 23:08:27 1.484
+++ tests/Makefile.in 2002/01/20 21:27:14
@@ -325,6 +325,7 @@
 pr2.test \
 pr211.test \
 pr220.test \
+pr224.test \
 pr229.test \
 pr243.test \
 pr266.test \
Index: tests/pr224.test
===================================================================
RCS file: pr224.test
diff -N pr224.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ tests/pr224.test Sun Jan 20 13:27:14 2002
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]