Zheng Bao | 7698a55 | 2020-09-29 17:32:36 +0800 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-3-Clause |
| 2 | |
Martin Roth | 5ff6bf3 | 2024-02-22 16:23:20 -0700 | [diff] [blame] | 3 | ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),) |
| 4 | |
Zheng Bao | e35c502 | 2023-10-11 16:08:44 +0800 | [diff] [blame] | 5 | amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o opts.o |
Karthikeyan Ramasubramanian | 7835861 | 2022-08-16 17:30:06 -0600 | [diff] [blame] | 6 | amdfwreadobj = amdfwread.o |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 7 | amdfwheader = amdfwtool.h |
Zheng Bao | 7698a55 | 2020-09-29 17:32:36 +0800 | [diff] [blame] | 8 | |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 9 | WERROR ?= -Werror |
| 10 | AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow $(WERROR) |
Karthikeyan Ramasubramanian | 236245e | 2022-09-06 14:02:41 -0600 | [diff] [blame] | 11 | AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include |
Karthikeyan Ramasubramanian | abaca2a | 2023-07-13 17:24:13 -0600 | [diff] [blame] | 12 | AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h |
Zheng Bao | 7698a55 | 2020-09-29 17:32:36 +0800 | [diff] [blame] | 13 | |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 14 | ifneq ($(PKG_CONFIG),) |
| 15 | HOSTPKGCONFIG ?= $(PKG_CONFIG) |
| 16 | else |
Kangheui Won | 5b84dfd | 2021-12-21 15:45:06 +1100 | [diff] [blame] | 17 | HOSTPKGCONFIG ?= pkg-config |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 18 | endif |
Kangheui Won | 5b84dfd | 2021-12-21 15:45:06 +1100 | [diff] [blame] | 19 | |
| 20 | AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) |
Karthikeyan Ramasubramanian | ff63106 | 2023-09-29 17:35:22 +0000 | [diff] [blame] | 21 | ifneq ($(.SHELLSTATUS),0) |
| 22 | $(error "Ensure that pkg-config is installed.") |
| 23 | endif |
Kangheui Won | 5b84dfd | 2021-12-21 15:45:06 +1100 | [diff] [blame] | 24 | LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto) |
| 25 | |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 26 | $(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c $(dir)/$(amdfwheader) |
| 27 | printf " AMDFW $@\n" |
Zheng Bao | 9c8ce3e | 2020-09-28 10:36:29 +0800 | [diff] [blame] | 28 | $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Zheng Bao | 7698a55 | 2020-09-29 17:32:36 +0800 | [diff] [blame] | 29 | |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 30 | $(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(dir)/$(amdfwheader) |
| 31 | printf " AMDFWTOOL $@\n" |
Kangheui Won | 5b84dfd | 2021-12-21 15:45:06 +1100 | [diff] [blame] | 32 | $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@ |
Karthikeyan Ramasubramanian | 7835861 | 2022-08-16 17:30:06 -0600 | [diff] [blame] | 33 | |
Martin Roth | 10291e8 | 2024-02-22 19:04:26 -0700 | [diff] [blame] | 34 | $(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(dir)/$(amdfwheader) |
| 35 | printf " AMDFWREAD $@\n" |
Karthikeyan Ramasubramanian | 7835861 | 2022-08-16 17:30:06 -0600 | [diff] [blame] | 36 | $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@ |
Martin Roth | 5ff6bf3 | 2024-02-22 16:23:20 -0700 | [diff] [blame] | 37 | |
| 38 | endif # ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),) |