[Top][All Lists]

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

Re: Force a file to be compiled always

From: Valentin David
Subject: Re: Force a file to be compiled always
Date: Thu, 4 Nov 2010 14:46:54 +0100

You probably want to have one object that has symbols for the date and
the time, and this object to be depending on other objects.

I am not an expert of Automake. But my solution seems to work. And this is:
libfoo_la_SOURCES=foo.c bar.c
$(liball_la_OBJECTS): $(libfoo_la_OBJECTS)

time.c contains something like:
const char build_time[] = __TIME__;
const char build_date[] = __DATE__;

And then, the date and time in the .rodata of your library should
always be more recent than the build of the last object in libfoo.

On Thu, Nov 4, 2010 at 9:33 AM, Benjamin Bihler
<address@hidden> wrote:
> Hi Ralf,
> your first suggestion (with the phony target) works great. The second one
> does not force compilation here (but that doesn't matter anymore since I
> use the phony target now).
> As to the third suggestion: I use the __DATE__ and __TIME__ macros in my
> code as a kind of version information. Therefore the compilation result
> differs with every compilation, although my source file does not change. Is
> there yet a better method to store the compilation time stamp in a library
> without fiddling with make targets?
> Thank you very much and bye,
> Benjamin

Valentin David

reply via email to

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