From: Tom Tromey Date: Sun, 20 Jan 2002 21:30:17 +0000 (+0000) Subject: For PR automake/224: X-Git-Tag: Release-1-5d~19 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=b9e0cb2ff524b3b9f5efbd26b7eb1354b6ad379a;p=automake.git 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. --- diff --git a/ChangeLog b/ChangeLog index e09dc640..0cfa8d1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-01-20 Tom Tromey + + 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 * tests/defs: Export AUTOMAKE and ACLOCAL. diff --git a/automake.in b/automake.in index 3ab25bcb..41b1a2d5 100755 --- a/automake.in +++ b/automake.in @@ -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; } } diff --git a/automake.texi b/automake.texi index 7e5760fd..42de6731 100644 --- a/automake.texi +++ b/automake.texi @@ -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}. diff --git a/lib/am/depend2.am b/lib/am/depend2.am index 0540e9d0..46d3896d 100644 --- a/lib/am/depend2.am +++ b/lib/am/depend2.am @@ -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. diff --git a/lib/depcomp b/lib/depcomp index 9ab71e2f..d1d45a3f 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -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" diff --git a/stamp-vti b/stamp-vti index d016b7ae..c434cb56 100644 --- 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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 4f93d5e9..4aa24b20 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -252,6 +252,7 @@ pr2.test \ pr204.test \ pr211.test \ pr220.test \ +pr224.test \ pr229.test \ pr243.test \ pr266.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 2eab6a5d..a3ef24a5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 00000000..5023fa82 --- /dev/null +++ b/tests/pr224.test @@ -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 diff --git a/version.texi b/version.texi index d016b7ae..c434cb56 100644 --- a/version.texi +++ b/version.texi @@ -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