automake
[Top][All Lists]
Advanced

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

Re: using VPATH in depend2.am?


From: Harald Dunkel
Subject: Re: using VPATH in depend2.am?
Date: Wed, 19 Oct 2005 15:04:05 +0200
User-agent: Debian Thunderbird 1.0.2 (X11/20050402)

Hi folks,

Ralf Wildenhues wrote:
> 
> What exactly does not work for you? 

I tried to use

        VPATH = $(srcdir):$(top_srcdir)/some/common/dir

in Makefile.am.

> In what circumstances? 

I am not sure what you mean by "circumstances". I am trying to
build a C++ library (no libtool) using both local sources and
source files in a common directory for the whole project.
Creating symbolic links to the common sources is no option here.

> On which
> system, which `make', which automake version,

RedHat 8, Autoconf 2.59, Automake 1.9.6, GNU make 3.80, m4 1.4.3,
gcc 2.95.3

> where's the reproducible
> example, 

See the attachement. To reproduce

        tar xpfz example.tar.gz
        cd example
        autoreconf -i
        mkdir build
        cd build
        ../configure
        make

You will get an error message saying

        gcc: ../output.c: No such file or directory

If you kick out hello_CPPFLAGS from Makefile.am, then some
different build rules are included in the generated Makefile,
VPATH suddenly works, and the error message is gone.

which part of depend2.am are you actually talking about?

See the attached patch. Using this new version VPATH works
for the test case. Probably a very similar patch could be
applied to the libtool and Windows sections in depend2.am.

> Have
> you studied the Autoconf manual section about portability yet?
> 

Yes.

I hope this patch (or maybe an easier version) could be included
into Automake.


Many thanx

Harri
diff -ur am/depend2.am am.new/depend2.am
--- am/depend2.am       Tue Sep 20 19:49:59 2005
+++ am.new/depend2.am   Wed Oct 19 13:56:34 2005
@@ -65,7 +65,8 @@
 if %FASTDEP%
 ## In fast-dep mode, we can always use -o.
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC?     if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o 
%OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
+## ?!GENERIC?  if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o 
%OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
+?!GENERIC?     if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o 
%OBJ% `test -f '%SOURCE%' || (VPATH=$(VPATH); test "$$VPATH" || 
VPATH=$(srcdir); for i in \`IFS=:; set $$VPATH; unset IFS; echo "$$@"\`; do 
test -f $$i/'%SOURCE%' && echo $$i/ && break; done)`%SOURCE%; \
 ?SUBDIROBJ??GENERIC?   depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \
 ?GENERIC?      if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o 
%OBJ% %SOURCE%; \
        then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; 
exit 1; fi
@@ -79,8 +80,10 @@
 ?!-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%
+##?-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%' || (VPATH=$(VPATH); test 
"$$VPATH" || VPATH=$(srcdir); for i in \`IFS=:; set $$VPATH; unset IFS; echo 
"$$@"\`; do test -f $$i/'%SOURCE%' && echo $$i/ && break; done)`%SOURCE%
+?!-o?  %COMPILE% %-c% `test -f '%SOURCE%' || (VPATH=$(VPATH); test "$$VPATH" 
|| VPATH=$(srcdir); for i in \`IFS=:; set $$VPATH; unset IFS; echo "$$@"\`; do 
test -f $$i/'%SOURCE%' && echo $$i/ && break; done)`%SOURCE%
 endif !%?GENERIC%
 endif !%FASTDEP%
 
Only in am.new: depend2.am~

Attachment: example.tar.gz
Description: application/gzip


reply via email to

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