blob: 0b9cc1b644b8cc6498a252b71f222a5908d698db [file] [log] [blame]
Zheng Bao7698a552020-09-29 17:32:36 +08001# SPDX-License-Identifier: BSD-3-Clause
2
Martin Roth5ff6bf32024-02-22 16:23:20 -07003ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)
4
Zheng Baoe35c5022023-10-11 16:08:44 +08005amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o opts.o
Karthikeyan Ramasubramanian78358612022-08-16 17:30:06 -06006amdfwreadobj = amdfwread.o
Martin Roth10291e82024-02-22 19:04:26 -07007amdfwheader = amdfwtool.h
Zheng Bao7698a552020-09-29 17:32:36 +08008
Martin Roth10291e82024-02-22 19:04:26 -07009WERROR ?= -Werror
10AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow $(WERROR)
Karthikeyan Ramasubramanian236245e2022-09-06 14:02:41 -060011AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include
Karthikeyan Ramasubramanianabaca2a2023-07-13 17:24:13 -060012AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h
Zheng Bao7698a552020-09-29 17:32:36 +080013
Martin Roth10291e82024-02-22 19:04:26 -070014ifneq ($(PKG_CONFIG),)
15HOSTPKGCONFIG ?= $(PKG_CONFIG)
16else
Kangheui Won5b84dfd2021-12-21 15:45:06 +110017HOSTPKGCONFIG ?= pkg-config
Martin Roth10291e82024-02-22 19:04:26 -070018endif
Kangheui Won5b84dfd2021-12-21 15:45:06 +110019
20AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto)
Karthikeyan Ramasubramanianff631062023-09-29 17:35:22 +000021ifneq ($(.SHELLSTATUS),0)
22$(error "Ensure that pkg-config is installed.")
23endif
Kangheui Won5b84dfd2021-12-21 15:45:06 +110024LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
25
Martin Roth10291e82024-02-22 19:04:26 -070026$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c $(dir)/$(amdfwheader)
27 printf " AMDFW $@\n"
Zheng Bao9c8ce3e2020-09-28 10:36:29 +080028 $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
Zheng Bao7698a552020-09-29 17:32:36 +080029
Martin Roth10291e82024-02-22 19:04:26 -070030$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(dir)/$(amdfwheader)
31 printf " AMDFWTOOL $@\n"
Kangheui Won5b84dfd2021-12-21 15:45:06 +110032 $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@
Karthikeyan Ramasubramanian78358612022-08-16 17:30:06 -060033
Martin Roth10291e82024-02-22 19:04:26 -070034$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(dir)/$(amdfwheader)
35 printf " AMDFWREAD $@\n"
Karthikeyan Ramasubramanian78358612022-08-16 17:30:06 -060036 $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@
Martin Roth5ff6bf32024-02-22 16:23:20 -070037
38endif # ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)