automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to build generated files?


From: Alexandre Duret-Lutz
Subject: Re: how to build generated files?
Date: Thu, 21 Feb 2002 11:01:51 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i386-debian-linux-gnu)

>>> "Gary" == Gary Hughes <address@hidden> writes:

[...]

 Gary> lib_LTLIBRARIES             =   liboimsg.la

 Gary> liboimsg_la_DEPENDENCIES    =   $(OI_DICTIONARY) \
 Gary> $(OI_COMPILER) \
 Gary> sourcefiles

 Gary> liboimsg_la_SOURCES         =   $(wildcard *.cpp)

 Gary> include_HEADERS             =   $(wildcard *.h)

 Gary> The problem is that during a 'make install' all the headers are picked
 Gary> up ok, during a make however none of the cpp files are being picked up
 Gary> even if I have run the compiler myself so they are sitting in the
 Gary> directory before make is run.

$(wildcard) is a GNU Make extension which Automake doesn't grok.
If you don't care about producing portable Makefiles, there are
some places where $(wildcard) is moderately safe to use
(e.g. _HEADERS), however _SOURCES is not one of them because
Automake must know its content.

There are at least two reasons why Automake needs to know the
content of liboimg_la_SOURCES:

1) it uses the sources extensions to decide which compiler and
   linker should be used
2) it also uses it to derive liboimg_la_OBJECTS, the list of
   objects that should be linked in liboimg.la

If you still want to go this way, here is a tricky setup that
may work (no garanty):

liboimsg_la_SOURCES         =   empty.cpp $(wildcard *.cpp)
liboimsg_la_LIBADD          =   $(liboimsg_la_SOURCES:.cpp=.lo)
include_HEADERS             =   $(wildcard *.h)
empty.cpp:
        touch empty.cpp

The empty.cpp file is to workaround 1), and the _LIBADD
definition is for 2).


A better setup, as far portability and Automake are concerned,
would be to expand manually all those $(wildcard) in your
Makefile.am (or have a script that generate your Makefile.am).

[...]
-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]