[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can't put a configure substitution (e.g., `@FOO@') into a `_SOURCES' variable. The reason for this is a bit hard to explain, but suffice to say that it simply won't work. Automake will give an error if you try to do this.
Automake must know all the source files that could possibly go into a
program, even if not all the files are built in every circumstance.
Any files which are only conditionally built should be listed in the
appropriate `EXTRA_' variable. For instance, if
`hello-linux.c' were conditionally included in hello
, the
`Makefile.am' would contain:
EXTRA_hello_SOURCES = hello-linux.c |
In this case, `hello-linux.o' would be added, via a
`configure' substitution, to hello_LDADD
in order to cause
it to be built and linked in.
An often simpler way to compile source files conditionally is to use Automake conditionals. For instance, you could use this construct to conditionally use `hello-linux.c' or `hello-generic.c' as the basis for your program `hello':
if LINUX hello_SOURCES = hello-linux.c else hello_SOURCES = hello-generic.c endif |
When using conditionals like this you don't need to use the `EXTRA_' variable, because Automake will examine the contents of each variable to construct the complete list of source files.
Sometimes it is useful to determine the programs that are to be built at
configure time. For instance, GNU cpio
only builds mt
and
rmt
under special circumstances.
In this case, you must notify Automake of all the programs that can
possibly be built, but at the same time cause the generated
`Makefile.in' to use the programs specified by configure
.
This is done by having configure
substitute values into each
`_PROGRAMS' definition, while listing all optionally built programs
in EXTRA_PROGRAMS
.
Of course you can use Automake conditionals to determine the programs to be built.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |