bug-automake
[Top][All Lists]
Advanced

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

Re: Option ansi2knr mishandles sources in different directories


From: Alexandre Duret-Lutz
Subject: Re: Option ansi2knr mishandles sources in different directories
Date: Thu, 21 Nov 2002 00:22:40 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-debian-linux-gnu)

>>> "Andreas" == Andreas Schwab <address@hidden> writes:

 Andreas> Alexandre Duret-Lutz <address@hidden> writes:
 >>> AFAICT this was fixed in Automake 1.7.1.  
 >>> (The test case is ansi9.test.)

 Andreas> Sorry, that's the version I'm using.

Ah, I see, the difference is that you don't use
`subdir-objects'.  The test suite has a case similars to yours,
ansi6.test, but it wasn't exercized with U=''.

I'm checking in the following change on HEAD and branch-1-7.
Maybe you can use `AUTOMAKE_OPTIONS = subdir-objects' as a
workaround, if this is acceptable.

2002-11-21  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (handle_single_transform_list): Don't strip the
        directory from $full_ansi.  This reverts my patch of 2002-10-16.
        (lang_c_finish): Use the full filename, including the directory,
        in the .c -> _.c rule.  These two files must reside in the same
        directory.
        * tests/ansi6.test: Also try to compile without ansi2knr.
        Reported by Andreas Schwab

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1392
diff -u -r1.1392 automake.in
--- automake.in 20 Nov 2002 22:03:56 -0000      1.1392
+++ automake.in 20 Nov 2002 23:15:54 -0000
@@ -2453,8 +2453,6 @@
                if ($lang->ansi && defined $options{'ansi2knr'})
                  {
                    $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
-                   $full_ansi = basename $full_ansi
-                     unless defined $options{'subdir-objects'};
                  }
 
                my $val = ("$full_ansi $obj_sans_ext "
@@ -5610,16 +5608,17 @@
            # we can't use $< -- some makes only define $< during a
            # suffix rule.
            my $ansfile = $de_ansi_files{$base} . $base . '.c';
-           $output_rules .= ($base . "_.c: $ansfile \$(ANSI2KNR)\n\t"
+           my $root = $de_ansi_files{$base} . $base;
+           $output_rules .= ($root . "_.c: $ansfile \$(ANSI2KNR)\n\t"
                              . '$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) '
                              . '`if test -f $(srcdir)/' . $ansfile
                              . '; then echo $(srcdir)/' . $ansfile
                              . '; else echo ' . $ansfile . '; fi` '
                              . "| sed 's/^# \\([0-9]\\)/#line \\1/' "
-                             . '| $(ANSI2KNR) > ' . $base . "_.c"
+                             . '| $(ANSI2KNR) > $@'
                              # If ansi2knr fails then we shouldn't
                              # create the _.c file
-                             . " || rm -f ${base}_.c\n");
+                             . " || rm -f ${root}_.c\n");
            push (@objects, $base . '_.$(OBJEXT)');
            push (@objects, $base . '_.lo')
              if variable_defined ('LIBTOOL');
Index: tests/ansi6.test
===================================================================
RCS file: /cvs/automake/automake/tests/ansi6.test,v
retrieving revision 1.3
diff -u -r1.3 ansi6.test
--- tests/ansi6.test    16 Oct 2002 18:53:44 -0000      1.3
+++ tests/ansi6.test    20 Nov 2002 23:15:55 -0000
@@ -74,3 +74,10 @@
 
 ./configure ac_cv_prog_cc_stdc=no
 $MAKE
+
+# Also run without forcing ansi2knr, so we make sure the
+# rules work with ANSI compilers.
+# Report from Andreas Schwab.
+$MAKE distclean
+./configure
+$MAKE


-- 
Alexandre Duret-Lutz





reply via email to

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