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 AM_LDFLAGS=@LOG4CPLUS_PROFILING_LDFLAGS@ AM_CXXFLAGS=@LOG4CPLUS_PROFILING_CXXFLAGS@ VPATH=@srcdir@:@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
signature.asc
Description: OpenPGP digital signature