diff options
author | Michael Brown | 2014-06-19 01:35:04 +0200 |
---|---|---|
committer | Michael Brown | 2014-06-24 16:32:35 +0200 |
commit | 8290a955130e0a6d6112ad8f269d8f617103e070 (patch) | |
tree | 9a3b124dacb036cbf6359fb4ef27fbce3f898fd6 /src/Makefile.housekeeping | |
parent | [debug] Allow debug message colours to be customised via DBGCOL=... (diff) | |
download | ipxe-8290a955130e0a6d6112ad8f269d8f617103e070.tar.gz ipxe-8290a955130e0a6d6112ad8f269d8f617103e070.tar.xz ipxe-8290a955130e0a6d6112ad8f269d8f617103e070.zip |
[build] Expose build timestamp, build name, and product names
Expose the build timestamp (measured in seconds since the Epoch) and
the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the
product name and product short name in a single centralised location.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r-- | src/Makefile.housekeeping | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index e40e7132..1b2a9b97 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -697,19 +697,6 @@ $(BIN)/embedded.% : override CC := env CCACHE_DISABLE=1 $(CC) $(BIN)/certstore.% : override CC := env CCACHE_DISABLE=1 $(CC) $(BIN)/privkey.% : override CC := env CCACHE_DISABLE=1 $(CC) -# Version number -# -CFLAGS_version += -DVERSION_MAJOR=$(VERSION_MAJOR) \ - -DVERSION_MINOR=$(VERSION_MINOR) \ - -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION="\"$(VERSION)\"" -# Make sure the version number gets updated on every git checkout -ifneq ($(GITVERSION),) -ifneq ($(wildcard ../.git/index),) -$(BIN)/version.o : ../.git/index -endif -endif - # Debug message autocolourisation range # DBGCOL_LIST := $(BIN)/.dbgcol.list @@ -1004,13 +991,31 @@ blib : $(BLIB) # BUILD_ID_CMD := perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );' +# Build timestamp +# +BUILD_TIMESTAMP := $(shell date +%s) + +# Build version +# +GIT_INDEX := $(if $(GITVERSION),$(if $(wildcard ../.git/index),../.git/index)) +$(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX) + $(QM)$(ECHO) " [VERSION] $@" + $(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \ + -DVERSION_MAJOR=$(VERSION_MAJOR) \ + -DVERSION_MINOR=$(VERSION_MINOR) \ + -DVERSION_PATCH=$(VERSION_PATCH) \ + -DVERSION="\"$(VERSION)\"" \ + -c $< -o $@ + # Build an intermediate object file from the objects required for the # specified target. # -$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT) +$(BIN)/%.tmp : $(BIN)/%.version.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT) $(QM)$(ECHO) " [LD] $@" - $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \ - --defsym _build_id=`$(BUILD_ID_CMD)` -Map $(BIN)/$*.tmp.map + $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $< $(BLIB) -o $@ \ + --defsym _build_id=`$(BUILD_ID_CMD)` \ + --defsym _build_timestamp=$(BUILD_TIMESTAMP) \ + -Map $(BIN)/$*.tmp.map $(Q)$(OBJDUMP) -ht $@ | $(PERL) $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map # Keep intermediate object file (useful for debugging) |