[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
First try
This first implementation will illustrate the bootstrap issue mentioned in the previous section (see section 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 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 |
In this example ‘bindir.h’ is not distributed, not installed, and
it is not even being built on-time. One may wonder what the
‘nodist_foo_SOURCES = bindir.h’ line has any use at all. This
line simply states that ‘bindir.h’ is a source of foo
, so
for instance, it should be inspected while generating tags
(see section Interfacing to etags
). In other words, it does not help our present problem,
and the build would fail identically without it.