[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Force a file to be compiled always
From: |
Steffen Dettmer |
Subject: |
Re: Force a file to be compiled always |
Date: |
Wed, 10 Nov 2010 15:32:52 +0100 |
On Nov 4, 2010, Benjamin Bihler <address@hidden> wrote:
> 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?
We do fiddle with make targets, but in this way:
--[Makefile.am]---------------------------------------------------->8=======
some_SOURCES=app.c
# ensure to compile-in the current date
app.$(OBJEXT): $(LIBDEPS) $(address@hidden@_a_SOURCES) Makefile
=======8<-------------------------------------------------------------------
app.c includes some
--[app.c]---------------------------------------------------------->8=======
const char *const version = SYS_VERSION
#if defined(DEBUG)
" (DEBUG), compiled " __DATE__ " " __TIME__
#endif
/* non-debug (but release-) versions are guaranteed to have a
* unique dedicated SYS_VERSION */
;
=======8<-------------------------------------------------------------------
I'm not sure if this is best (correct), but seems to work well.
I think the big advantage over .PHONY is that is does not
re-genereate the binary (a new binary, actually!) if nothing was
changed at all, which IMHO would be a bad habit.
oki,
Steffen
- Force a file to be compiled always, Benjamin Bihler, 2010/11/03
- Re: Force a file to be compiled always, Ralf Wildenhues, 2010/11/03
- Re: Force a file to be compiled always, Benjamin Bihler, 2010/11/04
- Re: Force a file to be compiled always, Valentin David, 2010/11/04
- Re: Force a file to be compiled always, Ralf Wildenhues, 2010/11/04
- Re: Force a file to be compiled always, Benjamin Bihler, 2010/11/05
- Re: Force a file to be compiled always, Benjamin Bihler, 2010/11/05
- Re: Force a file to be compiled always, Benjamin Bihler, 2010/11/08
- Re: Force a file to be compiled always,
Steffen Dettmer <=