automake
[Top][All Lists]
Advanced

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

building without $(top_builddir) in LDADD (was Re: libtool libraries, d


From: Václav Zeman
Subject: building without $(top_builddir) in LDADD (was Re: libtool libraries, dependencies and parallel builds)
Date: Sat, 03 Nov 2012 00:16:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

On 11/02/2012 09:43 AM, Stefano Lattarini wrote:
> On 11/02/2012 09:18 AM, Václav Zeman wrote:
>> On 1 November 2012 17:42, Diego Elio Pettenò wrote:
>>> On 01/11/2012 09:18, Vincent Torri wrote:
>>>> lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la
>>>
>>> Don't use $(top_builddir) and it should work just fine.
>> Is there a rationale behind this? I am not saying it is wrong, I just
>> want to better understand how things work.
>>
> My guess is that, albeit having a rule to build 'lib/eina/libeina.la'
> -- rule generated by Automake from the
> 
>   lib_LTLIBRARIES = lib/eina/libeina.la lib/eo/libeo.la
> 
> assignment -- make is not "smart enough" to recognize that, in
> this Makefile (where '$(top_builddir)' expands to '..'),
> '$(top_builddir)/src/lib/eina/libeina.la' points in fact to
> 'lib/eina/libeina.la'.
> 
> So, when asked to build '$(top_builddir)/src/lib/eina/libeina.la'
> as a dependency for 'lib/eo/libeo.la' -- dependency derived from
> the
> 
>   lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la
> 
> assignment --  make doesn't know how to proceed, and bails out.
> 
> So better to just remove the useless extra '$(top_builddir)/src'
> indirection.  Not only this fixes the error, but is also clearer
> to human readers IMNSHO.

I have tried to change my Makefile.am for a test executable by removing
the $(top_builddir). But I am getting errors in libtool invocation:

--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--
amber2::wilx:~/log4cplus-bzr/work-trunk/objdir/tests/appender_test> make
/bin/bash ../../libtool --tag=CXX   --mode=link g++  -save-temps
-fverbose-asm -march=native -g3 -ggdb -Wall -Wextra -pedantic
-Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual
-Wold-style-cast -Wc++0x-compat -Wc++11-compat -Wundef -Wshadow -Wformat
-Wsuggest-attribute=noreturn -Wno-variadic-macros
-fkeep-inline-functions -fstack-check -fstack-protector -ftrapv
-fvisibility=hidden -pthread   -o appender_test main.o
src/liblog4cplus.la  -lrt
libtool: link: cannot find the library `src/liblog4cplus.la' or
unhandled argument `src/liblog4cplus.la'
make: *** [appender_test] Error 1
--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--


The resulting Makefile.am looks (almost, becuse I use include to factor
out common stuff for multiple tests) like this:

--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include

address@hidden@

address@hidden@

address@hidden@:@top_builddir@

noinst_PROGRAMS = appender_test

appender_test_SOURCES = main.cxx

appender_test_LDADD = src/liblog4cplus.la
--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--

The VPATH bit is there because I have tried to fix the error using it.

How can I make this work as you have suggested without $(top_builddir)?

-- 
VZ


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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