automake
[Top][All Lists]
Advanced

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

Re: 1st action before build


From: Raja R Harinath
Subject: Re: 1st action before build
Date: Fri, 17 Aug 2001 16:59:41 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.104

Sylvain GIL <address@hidden> writes:

> I have a little issue with Makefile.am. What I want to do is to insert
> an action before my program is compiled.
>
> bin_PROGRAMS = myprog
> myprog_SOURCES = myprog.c myfile.c
>
> will generate something like:
>
> myprog: $(myprog_OBJECTS) $(myprog_DEPENDENCIES)
>
> I would like to do some actions in the same directory just before the
> myprog_OBJECTS dependency is followed or more generally before myprog
> compile start. Is there a way to do so ?
>
> Without giving too much detail, my 1st source file _can't_ be compiled
> unless a pre-action is done.

OK.  Then express that dependency.

> I found a very ugly way to work around it by adding a "dumb" entry in
> bin_PROGRAMS before myprog and overriding its target but it looks like
> evil :)

It also won't work with parallel makes.

If you need to do something before compiling myprog.o, express that
dependency.  For examply, if 'foo.h' is a file that needs to exist
before myprog.c can be compiled, use the following line in your
Makefile. 

  myprog.o: foo.h

If there's a "pre-action" which is not a header file, you can do:

  stamp-pre-action:
        do pre-action stuff
        echo timestamp > stamp-pre-action

  myprog.o: stamp-pre-action

- Hari
-- 
Raja R Harinath ------------------------------ address@hidden
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



reply via email to

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