user1159290
user1159290

Reputation: 1003

AC_SUBST macro usage in Makefile.am SUBDIRS

In configure.ac, I have:

AC_SUBST([with_dir2],[dir2])

In some Makefile.am, I have:

SUBDIRS = @with_dir2@

which seems to work.

But using

SUBDIRS = dir1/@with_dir2@/dir3

does not work (the string @with_dir2@ goes straight in the makefile without any substitution)... why? and what is the workaround :-) ...

Upvotes: 1

Views: 1270

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22519

Automake automatically emits all AC_SUBST variables as Makefile variables as well. So you can rewrite that to:

SUBDIRS = dir1/$(with_dir2)/dir3

I always preferred this approach anyhow because it is nicer for debugging -- you can override the variable on the make command line for testing.

Upvotes: 1

Related Questions