automake
[Top][All Lists]
Advanced

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

Re: compiling in the build time


From: n.g.
Subject: Re: compiling in the build time
Date: Fri, 4 Nov 2005 20:07:46 +0800

how about this ? :
builddate.c: geoidx.c
        echo $date > buildate.c


On 11/4/05, David Byron <address@hidden> wrote:
> This feels like a faq, but I couldn't find anything related so here
> goes.
>
> I'd like to compile in the build time into my application.  I have a
> recipe like this:
>
> BUILDTIME   = $(shell TZ=UTC date --utc)
> builddate.c:
>       echo "#include <builddate.h>" >$@
>       echo >>$@
>       echo "const char *BuildDate = \"$(BUILDTIME)\";" >>$@
>
> What I'm having trouble with is getting the builddate.c recipe to happen
> at the right time.  I don't want to make it .PHONY since I don't want to
> re-generate, re-compile, and re-link unless something else has actually
> changed.
>
> In Makefile.am I have the above, preceded by:
>
> bin_PROGRAMS = geoidx
> geoidx_SOURCES = geoidx.c
> nodist_geoidx_SOURCES = builddate.c
>
> This happily gets me builddate.c generated and compiled once, but never
> updated.
>
> If I was writing my own makefile, I'd have a recipe like this:
>
> geoidx: $(OBJS)
>   <generate builddate.c -- the three echo lines from above>
>   <compile buliddate.c>
>   <link geoidx with $(OBJS) and builddate.o>
>
> But I'm not sure how to get automake to generate a Makefile like this.
> Can someone point me in the right direction, or suggest another approach
> to get this done?
>
> Thanks much.
>
> -DB
>
>
>


--
all born, to be dying




reply via email to

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