[Top][All Lists]

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

RE: compiling in the build time

From: David Byron
Subject: RE: compiling in the build time
Date: Fri, 4 Nov 2005 08:37:41 -0800

On Friday, November 4th, Ralf Wildenhues wrote:

> Can't you just make it depend on the other source files?
>   builddate.c: $(geoidx_SOURCES)
>           echo ...
> Don't forget to mention the header file somewhere, by the
> way (in geoidx_SOURCES would be fine).

I could, but what about any other libraries (explicitly added by me or
system libraries) that my executable depends on?

I send this to Warren privately by mistake yesterday, but I did come up
with something that works.  Not sure if it's a good idea though.  It
seems risky somehow.

geoidx_LINK = rm -f builddate.c;\
  echo '\#include <builddate.h>' >builddate.c; \
  echo >>builddate.c; \
  echo 'const char *BuildDate = "$(BUILDTIME)";' >>builddate.c; \
  $(COMPILE) -c builddate.c builddate.$(OBJEXT); \
  $(LINK) -o $@ builddate.$(OBJEXT)

> Side note: if you want to be portable to non-GNU make (I
> don't know whether that is interesting for you), you can
> replace
> | BUILDTIME   = $(shell TZ=UTC date --utc)
> with
> | BUILDTIME   = `TZ=UTC date --utc`

Thanks.  I'll do this.


reply via email to

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