www.delorie.com/gnu/docs/automake/automake_40.html   search  
Buy GNU books!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] Conditional compilation using _LDADD substitutions

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' or `hello-generic.c' were conditionally included in hello, the `Makefile.am' would contain:

bin_PROGRAMS = hello
hello_SOURCES = hello-common.c
EXTRA_hello_SOURCES = hello-linux.c hello-generic.c

You can then setup the @HELLO_SYSTEM@ substitution from `configure.in':

case $host in
  *linux*) HELLO_SYSTEM='hello-linux.$(OBJEXT)' ;;
  *)       HELLO_SYSTEM='hello-generic.$(OBJEXT)' ;;

In this case, HELLO_SYSTEM should be replaced by `hello-linux.o' or `hello-bsd.o', and added to hello_DEPENDENCIES and hello_LDADD in order to be built and linked in.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003