automake
[Top][All Lists]
Advanced

[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

Hello,

        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:

VPATH=dir
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 Makefile.in):

saddress.lo: soap/saddress.cpp
@AMDEP_TRUE@    source='soap/saddress.cpp' object='saddress.lo' libtool=yes
@AMDEPBACKSLASH@
@AMDEP_TRUE@    depfile='$(DEPDIR)/saddress.Plo'
tmpdepfile='$(DEPDIR)/saddress.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@    $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
        $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES)
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o
saddress.lo `test -f soap/saddress.cpp || echo
'$(srcdir)/'`soap/saddress.cpp

        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/depend2.am, but I'm not familiar
with automake so it is not probably sufficient (i.e. there can be more
places to change).

        Regards
                Martin Frydl

Index: depend2.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/depend2.am,v
retrieving revision 1.39
diff -u -r1.39 depend2.am
--- depend2.am  2001/05/14 09:39:24     1.39
+++ depend2.am  2001/10/18 17:38:08
@@ -37,8 +37,8 @@
        depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo'
@AMDEPBACKSLASH@
        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
-?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f %SOURCE% || echo
'$(srcdir)/'`%SOURCE%
-?!-o?  %COMPILE% %-c% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
+?-o?   %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo
'$(srcdir)/'`%SOURCE%
+?!-o?  %COMPILE% %-c% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 
 ?GENERIC?.%EXT%.obj:
 ?!GENERIC?%OBJOBJ%: %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
'$(srcdir)/'`%SOURCE%
+       %LTCOMPILE% %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo
'$(srcdir)/'`%SOURCE%
 endif %?LIBTOOL%



reply via email to

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