[Top][All Lists]

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

Automake and Sun's make

From: Martin Frydl
Subject: Automake and Sun's make
Date: Thu, 18 Oct 2001 19:42:14 +0200


        I've encountered problem when using automake generated makefiles with
Sun's make.

        When VPATH is used with Sun's make, it changes filenames in rules. Lets
have a makefile like this:

file.y: file.x
        echo file.x

        We have file.x in directory dir so that make is able to find it using
VPATH. Now GNU make will print 'file.x' when run, but Sun's make will
print 'dir/file.x'! They say this in man page:

     If a target or a dependency file is found using VPATH,  then
     any  occurrences  of the word that is the same as the target
     name in the subsequent  rules  will  be  replaced  with  the
     actual name of the target derived from VPATH.

        The possible workaround is to put the string in '...' or "...".

        Now where is problem with automake. It generates rules like this one
for files which are located in subdirectories (part of

saddress.lo: soap/saddress.cpp
@AMDEP_TRUE@    source='soap/saddress.cpp' object='saddress.lo' libtool=yes
@AMDEP_TRUE@    depfile='$(DEPDIR)/saddress.Plo'
tmpdepfile='$(DEPDIR)/saddress.TPlo' @AMDEPBACKSLASH@
        $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES)
saddress.lo `test -f soap/saddress.cpp || echo

        The problem is in 'soap/saddress.cpp' strings. In the first case (in
test -f) Sun's make will rewrite it to exact location (test will
succeed) while in the second case it will leave it as is because it is
not word (there is some string right before it). All this will result in
incorrect command line for C++ compiler - it will not find the file.

        Probably the file after 'test -f' should be put in quotes. Here is
simple patch which does this in lib/am/, but I'm not familiar
with automake so it is not probably sufficient (i.e. there can be more
places to change).

                Martin Frydl

RCS file: /cvs/automake/automake/lib/am/,v
retrieving revision 1.39
diff -u -r1.39
---  2001/05/14 09:39:24     1.39
+++  2001/10/18 17:38:08
@@ -37,8 +37,8 @@
        depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo'
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
-?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo
-?!-o?  %COMPILE% %-c% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo
+?!-o?  %COMPILE% %-c% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
@@ -59,5 +59,5 @@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif  %AMDEP%
 ## We can always use `-o' with Libtool.
-       %LTCOMPILE% %-c% -o %LTOBJ% `test -f %SOURCE% || echo
+       %LTCOMPILE% %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo
 endif %?LIBTOOL%

reply via email to

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