bug-automake
[Top][All Lists]
Advanced

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

Re: unesthetic build commands generated by automake


From: Alexandre Duret-Lutz
Subject: Re: unesthetic build commands generated by automake
Date: Tue, 25 Feb 2003 21:06:44 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)

>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:

>>> "Bruno" == Bruno Haible <address@hidden> writes:
 Bruno> Hi,

 Bruno> The compilation commands printed to the console while
 Bruno> compiling a package with C sources are more complicated
 Bruno> than necessary. Each time I track down an error I have
 Bruno> to get simplify this

 Bruno> `test -f 'hello.c' || echo './'`hello.c

 adl> More info on this topic here:
 adl> http://sources.redhat.com/ml/automake/2002-01/msg00144.html

 adl> To summarize:
 adl> - people agree this command seems to make no sense for suffix rules
 adl> - it's useful only for non-suffix rules (when using per-target flags
 adl> or subdir objects).
 adl> - still, it was added to fix an issue related to _suffix_ rules

I'm relieved to report this last point is wrong!  I've always
thought Automake didn't support anything else but suffix rules
at this time, because the rules patched by Gordon Matzigkeit's
start with address@hidden@.o:' and address@hidden@.lo:'.

Now I've just looked at the automake code from 2000-03, and it
does things like s/address@hidden@\.o:/$obj.o: $source/g; while
processing depend2.am.

That means non-suffix rules were supported.  Gordon, had a
problem with these, no doubt: `test -f ... || ...` is required
there.  But his patch changed all rules (it wasn't easy to
distinguish suffix rules from non-suffix rules in depend2.am
anyway).

Great great great.

Here is the patch I'm installing on HEAD (I wouldn't call it
cute, though.  I think we need a way to have conditional words
in .am files, not just condtional lines.)

2003-02-25  Alexandre Duret-Lutz  <address@hidden>

        * lib/am/depend2.am (?GENERIC?%EXT%.o, ?GENERIC?%EXT%.obj): Do not
        use the `test -f foo || echo $(srcdir)/` to emulate a VPATH search
        when outputing suffix rules.
        * lib/am/texibuild.am (?GENERIC?%SOURCE_SUFFIX%.dvi)
        (?GENERIC?%SOURCE_SUFFIX%.pdf): Likewise.
        Suggested by Bruno Haible.

Index: lib/am/depend2.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/depend2.am,v
retrieving revision 1.50
diff -u -r1.50 depend2.am
--- lib/am/depend2.am   14 Nov 2002 20:22:03 -0000      1.50
+++ lib/am/depend2.am   25 Feb 2003 19:52:18 -0000
@@ -41,7 +41,9 @@
 if %FASTDEP%
 ## In fast-dep mode, we can always use -o.
        if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
-         %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?!GENERIC?       %-c% -o %OBJ% `test -f '%SOURCE%' || echo 
'$(srcdir)/'`%SOURCE%; \
+?GENERIC?        %-c% -o %OBJ% %SOURCE%; \
        then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
        else rm -f "%DEPBASE%.Tpo"; exit 1; \
        fi
@@ -51,8 +53,14 @@
        depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
+if %?GENERIC%
+?-o?   %COMPILE% %-c% %-o% %OBJ% %SOURCE%
+?!-o?  %COMPILE% %-c% %SOURCE%
+else !%?GENERIC%
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo 
'$(srcdir)/'`%SOURCE%
 ?!-o?  %COMPILE% %-c% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+endif !%?GENERIC%
 endif !%FASTDEP%
 
 ?GENERIC?%EXT%.obj:
@@ -60,9 +68,9 @@
 if %FASTDEP%
 ## In fast-dep mode, we can always use -o.
        if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
-## Ugly invocation here; using a variable fails due to a parsing
-## problem in automake.
-         %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) 
'%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?!GENERIC?       %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) 
'%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \
+?GENERIC?        %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`; \
        then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
        else rm -f "%DEPBASE%.Tpo"; exit 1; \
        fi
@@ -72,8 +80,14 @@
        depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
+if %?GENERIC%
+?-o?   %COMPILE% %-c% %-o% %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`
+?!-o?  %COMPILE% %-c% `$(CYGPATH_W) '%SOURCE%'`
+else !%?GENERIC%
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ?-o?   %COMPILE% %-c% %-o% %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) 
'%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
 ?!-o?  %COMPILE% %-c% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; 
else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
+endif !%?GENERIC%
 endif !%FASTDEP%
 
 if %?LIBTOOL%
Index: lib/am/texibuild.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texibuild.am,v
retrieving revision 1.15
diff -u -r1.15 texibuild.am
--- lib/am/texibuild.am 24 Feb 2003 22:09:21 -0000      1.15
+++ lib/am/texibuild.am 25 Feb 2003 19:52:18 -0000
@@ -60,7 +60,7 @@
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) 
%MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2DVI) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?GENERIC?      $(TEXI2DVI) %SOURCE%
 ?!GENERIC?     $(TEXI2DVI) -o $@ `test -f '%SOURCE%' || echo 
'$(srcdir)/'`%SOURCE%
 
 ?GENERIC?%SOURCE_SUFFIX%.pdf:
@@ -70,7 +70,7 @@
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) 
%MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2PDF) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?GENERIC?      $(TEXI2PDF) %SOURCE%
 ?!GENERIC?     $(TEXI2PDF) -o $@ `test -f '%SOURCE%' || echo 
'$(srcdir)/'`%SOURCE%
 
 ## If we are using the generic rules, we need separate dependencies.

-- 
Alexandre Duret-Lutz





reply via email to

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