Browse Source

[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=<name> macro which is used to
generate the obj_<name> 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 <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
c2f0769338
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/Makefile.housekeeping

+ 2
- 2
src/Makefile.housekeeping View File

@@ -998,7 +998,7 @@ BUILD_TIMESTAMP := $(shell date +%s)
998 998
 # Build version
999 999
 #
1000 1000
 GIT_INDEX := $(if $(GITVERSION),$(if $(wildcard ../.git/index),../.git/index))
1001
-$(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
1001
+$(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
1002 1002
 	$(QM)$(ECHO) "  [VERSION] $@"
1003 1003
 	$(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \
1004 1004
 		-DVERSION_MAJOR=$(VERSION_MAJOR) \
@@ -1010,7 +1010,7 @@ $(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
1010 1010
 # Build an intermediate object file from the objects required for the
1011 1011
 # specified target.
1012 1012
 #
1013
-$(BIN)/%.tmp : $(BIN)/%.version.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
1013
+$(BIN)/%.tmp : $(BIN)/version.%.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
1014 1014
 	$(QM)$(ECHO) "  [LD] $@"
1015 1015
 	$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $< $(BLIB) -o $@ \
1016 1016
 		--defsym _build_id=`$(BUILD_ID_CMD)` \

Loading…
Cancel
Save