On Sun, 15 May 2011, Vincent Torri wrote:

in a Makefile.am that is in the "$(top_builddir)/path1/path3" directory, the
library uses a file that is in the "$(top_builddir)/path1/path2" directory.
Is it better to use absolute path:

mylib_SOURCES = $(top_builddir)/path1/path2/file.c

or relative path

mylib_SOURCES = ../path2/file.c

?

Technically, both are relative (and defined by autoconf IIRC). Use abs_top_builddir for an absolute path. Note that builddir should only be used to point to sources actually created by the build (srcdir for the others).

Not sure what the official story is. I treat these as any other absolute/relative path issue. Absolute paths break if the target moves, relative paths break if either target moves relative to the other. I generally prefer the shorter form, also preferring absolute paths if they appear in several directories.

The variable dereference can also be preferrable when including another makefile; it prevents automake from doing the include early.

- Daniel

Reply via email to