This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New bugs


>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> The reason is only historical.  Feel free to change it.

I'm applying this.  Sure, more clarification is needed in this area.
I find it especially hard to track failures of substitution since
Automake uses @FOO@ just like AC_SUBST :(  Can't we move to something
else, say %FOO%?


2001-01-31  Akim Demaille  <akim@epita.fr>

	* depend2.am: Instead of replacing @PFX@ in $(@PFX@COMPILE), and
	then replacing `$(@PFX@COMPILE)' for the files that need some
	special flags, use only @COMPILE@.  Similarly for @LTCOMPILE@.
	Try to document this file.
	* automake.in (add_depend2): Adjust to these changes.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.843
diff -u -u -r1.843 automake.in
--- automake.in 2001/01/31 14:36:21 1.843
+++ automake.in 2001/01/31 16:44:49
@@ -2956,12 +2956,13 @@
 {
     local ($lang) = @_;
 
+    # Get information on $LANG.
+    my $pfx = $language_map{"$lang-autodep"};
+    my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
+    my $flag = $language_map{"$lang-flags"};
+
     # First include code for ordinary objects.
-    local ($key) = $lang . '-autodep';
     local ($xform, $ext);
-
-    local ($pfx) = $language_map{$key};
-    local ($fpfx) = ($pfx eq '') ? 'CC' : $pfx;
     $xform = &transform ('PFX'  => $pfx,
 			 'FPFX' => $fpfx);
     $xform .= $seen_objext  ? 's/^OBJEXT//;'  : 's/^OBJEXT.*$//;';
@@ -2972,12 +2973,16 @@
     # target.  In this case we don't want to include the generic code.
     if ($use_dependencies)
     {
-	local ($xform1) = ($xform
-			   . &transform ('BASE'   => '$*',
-					 'SOURCE' => '$<',
-					 'OBJ'    => '$@',
-					 'LTOBJ'  => '$@',
-					 'OBJOBJ' => '$@'));
+        my $compile = '$(' . $pfx . 'COMPILE)';
+	my $ltcompile = '$(LT' . $pfx . 'COMPILE)';
+	my $xform1 = ($xform
+		      . &transform ('BASE'      => '$*',
+				    'SOURCE'    => '$<',
+				    'OBJ'       => '$@',
+				    'LTOBJ'     => '$@',
+				    'OBJOBJ'    => '$@',
+				    'COMPILE'   => $compile,
+				    'LTCOMPILE' => $ltcompile));
 
 	foreach $ext (&lang_extensions ($lang))
 	{
@@ -3007,11 +3012,12 @@
 	$source = $list[$i + 1];
 	$obj = $list[$i + 2];
 	$i += 3;
+
+	my $val = "${derived}_${flag}";
 
-	local ($flag) = $language_map{$lang . '-flags'};
-	local ($val) = "(${derived}_${flag}";
-	($rule = $language_map{$lang . '-compile'}) =~
-	    s/\(AM_$flag/$val/;
+	my $obj_compile = $language_map{"$lang-compile"};
+	$obj_compile =~ s/\(AM_$flag/\($val/;
+	my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile;
 
 	# Generate a transform which will turn suffix targets in
 	# depend2.am into real targets for the particular objects we
@@ -3020,16 +3026,14 @@
 	    &file_contents
 	        ('depend2',
 		 $xform
-		 . &transform ('$(' . $pfx . 'COMPILE)'
-			       => $rule,
-			       '$(LT' . $pfx . 'COMPILE)'
-			       => '$(LIBTOOL) --mode=compile ' . $rule,
+		 . &transform ('COMPILE'   => $obj_compile,
+			       'LTCOMPILE' => $obj_ltcompile,
 			       # Handle source and obj transforms.
-			       'OBJ'    => $obj . '.o',
-			       'OBJOBJ' => $obj . '.obj',
-			       'LTOBJ'  => $obj . '.lo',
-			       'BASE'   => $obj,
-			       'SOURCE' => $source)
+			       'OBJ'       => $obj . '.o',
+			       'OBJOBJ'    => $obj . '.obj',
+			       'LTOBJ'     => $obj . '.lo',
+			       'BASE'      => $obj,
+			       'SOURCE'    => $source)
 		 # Generate rule for `.o'.
 		 . 's/^\@EXT\@\.o:/' . $obj . '.o: ' . $source . '/g;'
 		 # Maybe generate rule for `.lo'.  Might be eliminated
Index: depend2.am
===================================================================
RCS file: /cvs/automake/automake/depend2.am,v
retrieving revision 1.26
diff -u -u -r1.26 depend2.am
--- depend2.am 2000/10/16 09:01:36 1.26
+++ depend2.am 2001/01/31 16:44:49
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -16,22 +16,30 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
+
+## This file is read several times:
+## - once per language for generic compilation rules
+## - once for each file which requires specific flags.
+##
+## It is worth noting that @AMDEP@ and @AMDEPBACKSLASH@ are not
+## transformed by automake, they are AC_SUBST'ed.
+
 @AMDEP@@FPFX@DEPMODE = @@FPFX@DEPMODE@
 
 @EXT@.o:
 @AMDEP@	source='@SOURCE@' object='@OBJ@' libtool=no @AMDEPBACKSLASH@
 @AMDEP@	depfile='$(DEPDIR)/@BASE@.Po' tmpdepfile='$(DEPDIR)/@BASE@.TPo' @AMDEPBACKSLASH@
 @AMDEP@	$(@FPFX@DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-	$(@PFX@COMPILE) -c -o @OBJ@ `test -f @SOURCE@ || echo '$(srcdir)/'`@SOURCE@
+	@COMPILE@ -c -o @OBJ@ `test -f @SOURCE@ || echo '$(srcdir)/'`@SOURCE@
 
 LIBTOOL@EXT@.lo:
 LIBTOOL@AMDEP@	source='@SOURCE@' object='@LTOBJ@' libtool=yes @AMDEPBACKSLASH@
 LIBTOOL@AMDEP@	depfile='$(DEPDIR)/@BASE@.Plo' tmpdepfile='$(DEPDIR)/@BASE@.TPlo' @AMDEPBACKSLASH@
 LIBTOOL@AMDEP@	$(@FPFX@DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-LIBTOOL	$(LT@PFX@COMPILE) -c -o @LTOBJ@ `test -f @SOURCE@ || echo '$(srcdir)/'`@SOURCE@
+LIBTOOL	@LTCOMPILE@ -c -o @LTOBJ@ `test -f @SOURCE@ || echo '$(srcdir)/'`@SOURCE@
 
 OBJEXT@EXT@.obj:
 OBJEXT@AMDEP@	source='@SOURCE@' object='@OBJOBJ@' libtool=no @AMDEPBACKSLASH@
 OBJEXT@AMDEP@	depfile='$(DEPDIR)/@BASE@.Po' tmpdepfile='$(DEPDIR)/@BASE@.TPo' @AMDEPBACKSLASH@
 OBJEXT@AMDEP@	$(@FPFX@DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-OBJEXT	$(@PFX@COMPILE) -c -o @OBJOBJ@ `cygpath -w @SOURCE@`
+OBJEXT	@COMPILE@ -c -o @OBJOBJ@ `cygpath -w @SOURCE@`


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]