Hi there,

this patch fixes a problem using foreign languages (Qt, Ice, ...) with renamed 
objects. E.g. you have the language .baz and want to include it into your 
c-program:

AUTOMAKE_OPTIONS = subdir-objects
SUFFIXES = .baz .c
# we fake here:
.baz.c:
        cp $< $@

bin_PROGRAMS = foo
foo_SOURCES = foo.c sub/bar.baz
foo_CFLAGS = -I.

The current automake produces this:

--- snip ----
sub/foo-bar.o: sub/bar.baz
@am__fastdepCC_TRUE@    $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(foo_CFLAGS) $(CFLAGS) -MT sub/foo-bar.o -M
D -MP -MF sub/$(DEPDIR)/foo-bar.Tpo -c -o sub/foo-bar.o 
`test -f 'sub/bar.baz' || echo '$(srcdir)/'`sub/bar.baz
@am__fastdepCC_TRUE@    mv -f sub/$(DEPDIR)/foo-bar.Tpo 
sub/$(DEPDIR)/foo-bar.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@       source='sub/bar.baz' 
object='sub/foo-bar.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(foo_CFLAGS) $(CFLAGS) -c -o sub/foo-bar.o
`test -f 'sub/bar.baz' || echo '$(srcdir)/'`sub/bar.baz
--- snip ----

Which is wrong.
The patch feeds the generated c-file to the c-compiler instead of the 
baz-file:

--- snip ----
sub/foo-bar.o: sub/bar.c
@am__fastdepCC_TRUE@    $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(foo_CFLAGS) $(CFLAGS) -MT sub/foo-bar.o -M
D -MP -MF sub/$(DEPDIR)/foo-bar.Tpo -c -o sub/foo-bar.o 
`test -f 'sub/bar.c' || echo '$(srcdir)/'`sub/bar.c
@am__fastdepCC_TRUE@    mv -f sub/$(DEPDIR)/foo-bar.Tpo 
sub/$(DEPDIR)/foo-bar.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@       source='sub/bar.c' 
object='sub/foo-bar.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(AM_CPPFLAGS) $(CPPFLAGS) $(foo_CFLAGS) $(CFLAGS) -c -o sub/foo-bar.o
`test -f 'sub/bar.c' || echo '$(srcdir)/'`sub/bar.c
--- snip ----

I have also included a testscript suffix13.test. It is not in the diff, 
because "svn diff -u" has not included it in the diff file.

Cheers,
Florian

-- 
Suddenly, Professor Liebowitz realizes he has come to the seminar
without his duck ...
? tests/suffix13.test
Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.2988
diff -u -r1.2988 ChangeLog
--- ChangeLog	25 Apr 2007 17:55:15 -0000	1.2988
+++ ChangeLog	1 May 2007 14:42:57 -0000
@@ -1,3 +1,11 @@
+2007-05-01  Florian Briegel  <[EMAIL PROTECTED]>
+
+	* automake.in: Fixed bug when building with renamed objects 
+	and foreign languages.
+	* tests/suffix13.test: New test.
+	* tests/Makefile.am: Adjust.
+	* THANKS: Update.
+
 2007-04-25  Eric Blake  <[EMAIL PROTECTED]>
 
 	* doc/stamp-vti: Remove generated file from revision control.
@@ -337,7 +345,7 @@
 
 	* automake.in (handle_compile): Use subst, for maintainer-check.
 
-2006-10-09  Andreas Köhler  <[EMAIL PROTECTED]>  (tiny change)
+2006-10-09  Andreas K�hler  <[EMAIL PROTECTED]>  (tiny change)
 
 	For PR automake/505:
 	* lib/am/configure.am (am__CONFIG_DISTCLEAN_FILES):
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.301
diff -u -r1.301 THANKS
--- THANKS	29 Mar 2007 22:40:41 -0000	1.301
+++ THANKS	1 May 2007 14:42:57 -0000
@@ -87,6 +87,7 @@
 Esben Haabendal Soerensen [EMAIL PROTECTED]
 Ezra Peisach		[EMAIL PROTECTED]
 Flavien Astraud		[EMAIL PROTECTED]
+Florian Briegel		[EMAIL PROTECTED]
 François Pinard		[EMAIL PROTECTED]
 Fred Fish		[EMAIL PROTECTED]
 Ganesan Rajagopal	[EMAIL PROTECTED]
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1644
diff -u -r1.1644 automake.in
--- automake.in	29 Mar 2007 23:01:59 -0000	1.1644
+++ automake.in	1 May 2007 14:43:07 -0000
@@ -1774,7 +1774,16 @@
             {
                 my $obj_sans_ext = substr ($object, 0,
 					   - length ($this_obj_ext));
-		my $full_ansi = $full;
+		my $full_ansi;
+		if ($directory ne '')
+	          {
+			$full_ansi = $directory . '/' . $base . $extension;
+	          }
+		else
+	          {
+			$full_ansi = $base . $extension;
+	          }
+
 		if ($lang->ansi && option 'ansi2knr')
 		  {
 		    $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.621
diff -u -r1.621 Makefile.am
--- tests/Makefile.am	29 Mar 2007 23:26:48 -0000	1.621
+++ tests/Makefile.am	1 May 2007 14:43:08 -0000
@@ -544,6 +544,7 @@
 suffix10.test \
 suffix11.test \
 suffix12.test \
+suffix13.test \
 symlink.test \
 symlink2.test \
 symlink3.test \

Attachment: suffix13.test
Description: application/shellscript

Reply via email to