Commit 5d4ef29f authored by Alessandro Rubini's avatar Alessandro Rubini

revision: change revision generation, no effect on output

This doesn't change the behavior of any command, but adds revision.c
as a real source file rather than something created by make using
"echo ... > revision.c".  In any case, the file is recompiled
each time you call "make", so the date and time reflect the last
build.

However, this introduces CONFIG_DETERMINISTIC_BINARY (that nobody
sets at this point in time) to build a binary withouth __DATE__
and __TIME__ strings, so it is the same at every rebuild. See
next commit.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 6c5c7358
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*.bin *.bin
*.*~ *.*~
include/board.h include/board.h
revision.c
tools/zpu-loader tools/zpu-loader
tools/vuart_console tools/vuart_console
tools/genraminit tools/genraminit
......
...@@ -83,9 +83,7 @@ REVISION=$(shell git describe --dirty --always) ...@@ -83,9 +83,7 @@ REVISION=$(shell git describe --dirty --always)
all: tools wrc all: tools wrc
wrc: silentoldconfig $(OBJS) wrc: silentoldconfig $(OBJS)
echo "const char *build_revision = \"$(REVISION)\";" > revision.c $(CC) $(CFLAGS) -DGIT_REVISION=\"$(REVISION)\" -c revision.c
echo "const char *build_date = __DATE__ \" \" __TIME__;" >> revision.c
$(CC) $(CFLAGS) -c revision.c
$(SIZE) -t $(OBJS) $(SIZE) -t $(OBJS)
${CC} -o $(OUTPUT).elf revision.o $(OBJS) $(LDFLAGS) ${CC} -o $(OUTPUT).elf revision.o $(OBJS) $(LDFLAGS)
${OBJCOPY} -O binary $(OUTPUT).elf $(OUTPUT).bin ${OBJCOPY} -O binary $(OUTPUT).elf $(OUTPUT).bin
......
const char *build_revision = GIT_REVISION;
#ifdef CONFIG_DETERMINISTIC_BINARY
const char *build_date = "";
#else
const char *build_date = ", compiled on: " __DATE__ " " __TIME__;
#endif
...@@ -5,7 +5,7 @@ extern const char *build_revision, *build_date; ...@@ -5,7 +5,7 @@ extern const char *build_revision, *build_date;
int cmd_version(const char *args[]) int cmd_version(const char *args[])
{ {
mprintf("WR Core build: %s, compiled on: %s (memory size: %d kB)\n", mprintf("WR Core build: %s%s (memory size: %d kB)\n",
build_revision, build_date, sysc_get_memsize()); build_revision, build_date, sysc_get_memsize());
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment