From f6ddd64c3a7e16de9395be2f037cd9f1fba3fce1 Mon Sep 17 00:00:00 2001 From: Luigi Semenzato Date: Thu, 24 Jun 2010 08:11:24 -0700 Subject: [PATCH] Automated version generation for vboot firmware. Review URL: http://codereview.chromium.org/2817025 --- firmware/Makefile | 14 ++++++++++++-- firmware/version.c | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 firmware/version.c diff --git a/firmware/Makefile b/firmware/Makefile index 2dc804801a..952a1b6bd7 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -39,12 +39,22 @@ STUB_SRCS = \ ./stub/tlcl.c \ ./stub/utility_stub.c -ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} +ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c -test : $(FWLIB) +test : $(FWLIB) update-version $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ $(TESTDIR)/main.c $(FWLIB) +# This is executed at every make, to see if anything has changed +update-version : + find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ + | sort | xargs cat | md5sum | cut -c 25-32 > x.tmp + echo "char* VbootVersion = \"VBOOv=$$(cat x.tmp)\";" > version.tmp + cmp -s version.tmp version.c || \ + ( echo "** Updating version.c **" && \ + cp version.tmp version.c ) + + include ../common.mk $(FWLIB) : $(ALL_OBJS) diff --git a/firmware/version.c b/firmware/version.c new file mode 100644 index 0000000000..f3ff0eda49 --- /dev/null +++ b/firmware/version.c @@ -0,0 +1 @@ +char* VbootVersion = "VBOOv=8078f71c";