automake
[Top][All Lists]
Advanced

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

Re: performing pre-build shell commands with automake


From: John Calcote
Subject: Re: performing pre-build shell commands with automake
Date: Sun, 20 Jun 2010 13:18:03 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5

Hi Wesley,

You could use BUILT_SOURCES to accomplish this. Any sources listed in
BUILT_SOURCES are built before any other rules are executed. Automake
does this by making BUILT_SOURCES a dependency of "all", "check" and
"install", so that when you run "make all", "make check" or "make
install", the files listed in BUILT_SOURCES are updated first.

However, that said, the correct way to do what you want is to place a
make dependency between the sources you want to generate, and the
consumers of those sources. Automake generates normal makefiles (or
rather makefile.in templates for Autotconf) from Makefile.am files. Some
of the code in a Makefile.am file contain directives for automake. The
rest is just make script that is passed through from Makefile.am to
(ultimately) Makefile.

Just write rules like this:

consumer.o: resource.qt

and resource.qt will get built before consumer.o tries to consume it.
Ultimately, this is the effect of BUILT_SOURCES, but the dependencies
aren't managed as well as they could be with BUILT_SOURCES - your qt
files will only get built if the user types "make all", "make check", or
"make install". But if a user types "make somefile.o" or attempts to
build the executable or library directly, then any qt files that
somefile (or that executable or library) happens to require will not get
built beforehand.

John

On 6/20/2010 12:56 PM, Wesley Smith wrote:
> I've been looking through the automake docs trying to figure out how
> to execute shell commands as part of the build process but before
> anything actually gets compiled.  Is this possible?  I need this for
> things like Qt's 'moc' and some other script-based code generation
> utilities.  thanks in advance!
>
> wes
>
>
>   




reply via email to

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