$(top_srcdir) in Makefile.am

Adriaan de Groot adridg at cs.kun.nl
Tue Oct 29 16:45:19 GMT 2002

In many Makefile.am's I see constructions like the following:

AM_CPPFLAGS = -DSRCDIR="\"$(shell (cd $(top_srcdir)/kdoctools && pwd))\""

all other considerations [1,2,3] aside, it seems like $abs_top_srcdir which 
autoconf sets is just the thing to use here. My autoconf:

bash-2.05$ autoconf --version
autoconf (GNU Autoconf) 2.53

has it, documented as

 - Variable: abs_top_srcdir
     Absolute path of `top_srcdir'.

Is there any particular reason besides [4] that this isn't used instead of the 
$(shell) construction? Could we change this around?


[1] It's ugly.
[2] Why aren't backticks `(cd $(top_srcdir)/kdoctools && pwd)` sufficient?
[3] It doesn't work with bmake.
[4] Unfortunately, it doesn't work that easily. It doesn't get substituted 
automatically, as far as i can tell, and adding an AC_SUBST(abs_top_srcdir) 
gives me blanks instead of what I expect. I can _see_ code in configure 
assigning a value to the variables, and when I print them later they're empty 

A little axiom goes a long way.

More information about the kde-core-devel mailing list