aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.inc
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2015-02-12 19:32:41 -0700
committerMartin Roth <gaumless@gmail.com>2015-03-06 20:33:43 +0100
commite236204d537808180ace7b78c1dc293ed59d9878 (patch)
tree9fcf048547cb6627eab64d52ed1eacc468baf082 /Makefile.inc
parentaab66b1dc7908366f35ed58b774bb2dbe214278c (diff)
downloadcoreboot-e236204d537808180ace7b78c1dc293ed59d9878.tar.gz
coreboot-e236204d537808180ace7b78c1dc293ed59d9878.tar.xz
coreboot-e236204d537808180ace7b78c1dc293ed59d9878.zip
Move generation of build.h into a shell script
Moving the routines that create build.h into a script offers several advantages. We can create more complex functions to run and we don't have to deal with both bash and Make at the same time. This script combines what is currently in Makefile.inc with a couple of updates. - Update how it determines whether to use git for the timestamp - Move the git revision string generation inside the routine that checks to see if we have git. - Add a timeout for the domain name check. Change-Id: I93c131e8d01a0099eb13db720fa865c627985750 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: http://review.coreboot.org/8428 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc28
1 files changed, 2 insertions, 26 deletions
diff --git a/Makefile.inc b/Makefile.inc
index eb8b6014f..89a05534d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -243,7 +243,7 @@ CBFS_PAYLOAD_COMPRESS_FLAG:=LZMA
endif
ifneq ($(CONFIG_LOCALVERSION),"")
-COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
+export COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
endif
CPPFLAGS_common := -Isrc -Isrc/include -I$(obj)
@@ -274,31 +274,7 @@ additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool \
$(obj)/build.h: .xcompile
@printf " GEN build.h\n"
rm -f $(obj)/build.h
- printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
- printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
- printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
- printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" >> $(obj)/build.ht
- if git update-index -q --refresh >/dev/null; ! git diff-index --quiet HEAD; then \
- printf "/* `LANG= TZ=UTC git log --date=local --pretty=format:%cd -1` UTC */\n" >> $(obj)/build.ht; \
- printf "#define COREBOOT_VERSION_TIMESTAMP `LANG= git log --pretty=format:%ct -1`\n" >> $(obj)/build.ht; \
- else \
- printf "/* `LANG= TZ=UTC date` */\n" >> $(obj)/build.ht; \
- printf "#define COREBOOT_VERSION_TIMESTAMP `LANG= date +%s`\n" >> $(obj)/build.ht; \
- fi
- printf "#define COREBOOT_ORIGIN_GIT_REVISION \"`LANG= git log remotes/origin/master -1 --format=format:%h`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_YEAR_BCD 0x`LANG= date +"%y"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_MONTH_BCD 0x`LANG= date +"%m"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_DAY_BCD 0x`LANG= date +"%d"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x`LANG= date +"%w"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_DMI_DATE \"`LANG= date +"%m/%d/%Y"`\"\n" >> $(obj)/build.ht
- printf "\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s 2>/dev/null || hostname 2>/dev/null)\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname 2>/dev/null)\"\n" >> $(obj)/build.ht
- printf "#endif\n" >> $(obj)/build.ht
+ util/genbuild_h/genbuild_h.sh > $(obj)/build.ht
mv $(obj)/build.ht $(obj)/build.h
$(obj)/ldoptions: $(obj)/config.h