From c2f0769338486cfbca0ed545b84bc1f516e1844e Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 26 Jun 2014 16:25:18 +0100 Subject: [build] Fix erroneous object name in version object Commit 8290a95 ("[build] Expose build timestamp, build name, and product names") introduced a regression in the build process which resulted in broken final binaries which had names based on object files (e.g. "undionly.kpxe" or "intel.rom") rather than on device IDs (e.g. "8086100e.mrom"). The underlying problem is the -DOBJECT= macro which is used to generate the obj_ symbols used to select objects required for the final binary. The macro definition is derived from the initial portion (up to the first dot) of the object being built. In the case of e.g. undionly.kpxe.version.o, this gives -DOBJECT=undionly. This results in undionly.kpxe.version.o claiming to be the "undionly" object; the real "undionly" object will therefore never get dragged in to the build. Fix by renaming $(BIN)/%.version.o to $(BIN)/version.%.o, so that the object is always built with -DOBJECT=version (as might be expected, since it is built from core/version.c). Final binaries which have names based on device IDs (such as "8086100e.mrom") are not affected by this problem, since the object name "8086100e" will not conflict with that of the underlying "intel" object. This problem was not detected by the per-commit smoke testing procedure, which happens to use the binary bin/8086100e.mrom. Reported-by: Christian Hesse Signed-off-by: Michael Brown --- src/Makefile.housekeeping | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 1b2a9b97..0dce8d06 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -998,7 +998,7 @@ 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) +$(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(GIT_INDEX) $(QM)$(ECHO) " [VERSION] $@" $(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \ -DVERSION_MAJOR=$(VERSION_MAJOR) \ @@ -1010,7 +1010,7 @@ $(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX) # Build an intermediate object file from the objects required for the # specified target. # -$(BIN)/%.tmp : $(BIN)/%.version.o $(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)` \ -- cgit v1.2.3-55-g7522