Patrick Georgi has uploaded this change for review.

View Change

util/ifdtool: Add coreboot build system support

When building as part of the coreboot build system, use the same
mechanism as other tools (cbfstool, amdfwtool, ...) so that abuild
builds ifdtool once into sharedutils instead of once per board (while
avoiding other race conditions, too).

Change-Id: I42c7b43cc0859916174d59cba6b62630e70287fd
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
---
M Makefile.inc
A util/ifdtool/Makefile.inc
2 files changed, 20 insertions(+), 4 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/49312/1
diff --git a/Makefile.inc b/Makefile.inc
index ae61c2e..72f5d24 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -85,6 +85,7 @@
subdirs-y += src/cpu src/vendorcode
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/pgtblgen util/amdfwtool
subdirs-y += util/futility util/marvell util/bincfg util/supermicro util/qemu
+subdirs-y += util/ifdtool
subdirs-y += $(wildcard src/arch/*)
subdirs-y += src/mainboard/$(MAINBOARDDIR)
subdirs-y += src/security
@@ -576,10 +577,6 @@
BINCFG:=$(objutil)/bincfg/bincfg

IFDTOOL:=$(objutil)/ifdtool/ifdtool
-$(IFDTOOL):
- @printf " Compile IFDTOOL\n"
- +$(MAKE) -C $(top)/util/ifdtool
- cp -a $(top)/util/ifdtool/ifdtool $@

AMDFWTOOL:=$(objutil)/amdfwtool/amdfwtool

diff --git a/util/ifdtool/Makefile.inc b/util/ifdtool/Makefile.inc
new file mode 100644
index 0000000..66f099e
--- /dev/null
+++ b/util/ifdtool/Makefile.inc
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+ifdtoolobj = ifdtool.o fmap.o kv_pair.o valstr.o
+
+IFDTOOLCFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror
+IFDTOOLCFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include
+IFDTOOLCFLAGS += -I$(top)/util/cbfstool/flashmap
+IFDTOOLCFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h
+
+$(objutil)/ifdtool/%.o: $(top)/util/ifdtool/%.c
+ $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+$(objutil)/ifdtool/%.o: $(top)/util/cbfstool/flashmap/%.c
+ $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+$(objutil)/ifdtool/ifdtool: $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj))
+ printf " IFDTOOL\n"
+ $(HOSTCC) $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj)) -o $@
+

To view, visit change 49312. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I42c7b43cc0859916174d59cba6b62630e70287fd
Gerrit-Change-Number: 49312
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi@google.com>
Gerrit-MessageType: newchange