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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49312
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrick Georgi
2021-01-11 15:17:59 +01:00
parent 83bdb45116
commit 227055bdeb
2 changed files with 19 additions and 4 deletions

18
util/ifdtool/Makefile.inc Normal file
View File

@@ -0,0 +1,18 @@
# 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 $@