util/liveiso/nixos: Install various extractor tools
[coreboot.git] / util / amdfwtool / Makefile.mk
blob0b9cc1b644b8cc6498a252b71f222a5908d698db
1 # SPDX-License-Identifier: BSD-3-Clause
3 ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)
5 amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o opts.o
6 amdfwreadobj = amdfwread.o
7 amdfwheader = amdfwtool.h
9 WERROR ?= -Werror
10 AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow $(WERROR)
11 AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include
12 AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h
14 ifneq ($(PKG_CONFIG),)
15 HOSTPKGCONFIG ?= $(PKG_CONFIG)
16 else
17 HOSTPKGCONFIG ?= pkg-config
18 endif
20 AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto)
21 ifneq ($(.SHELLSTATUS),0)
22 $(error "Ensure that pkg-config is installed.")
23 endif
24 LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
26 $(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c $(dir)/$(amdfwheader)
27 printf " AMDFW $@\n"
28 $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
30 $(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(dir)/$(amdfwheader)
31 printf " AMDFWTOOL $@\n"
32 $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@
34 $(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(dir)/$(amdfwheader)
35 printf " AMDFWREAD $@\n"
36 $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@
38 endif # ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)