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


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

First try

This first implementation will illustrate the bootstrap issue mentioned in the previous section (see section 10.4 Built sources).

Here is a tentative `Makefile.am'.

# This won't work.
bin_PROGRAMS = foo
foo_SOURCES = foo.c
nodist_foo_SOURCES = bindir.h
CLEANFILES = bindir.h
bindir.h: Makefile
        echo '#define bindir "$(bindir)"' >$@

This setup doesn't work, because Automake doesn't know that `foo.c' includes `bindir.h'. Remember, automatic dependency tracking works as a side-effect of compilation, so the dependencies of `foo.o' will be known only after `foo.o' has been compiled (see section 9.14 Automatic dependency tracking). The symptom is as follows.

% make
source='foo.c' object='foo.o' libtool=no \
depfile='.deps/foo.Po' tmpdepfile='.deps/foo.TPo' \
depmode=gcc /bin/sh ./depcomp \
gcc -I. -I. -g -O2 -c `test -f 'foo.c' || echo './'`foo.c
foo.c:2: bindir.h: No such file or directory
make: *** [foo.o] Error 1

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