util/amdfwtool: Check for pkg-config presence

Check for pkg-config presence and fail out with actionable message.

BUG=b:302521446
TEST=Build successfully with working pkg-config and failed build with no
pkg-config

Change-Id: I5d604145c919e7f71680d1e095dc68cb21868319
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78191
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian
2023-09-29 17:35:22 +00:00
committed by Felix Held
parent e486082dfb
commit ff63106dec
2 changed files with 8 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ TOOL_OBJ = $(TOOL_SRC:%.c=%.o)
HEADER=amdfwtool.h HEADER=amdfwtool.h
TARGETS = amdfwread amdfwtool TARGETS = amdfwread amdfwtool
WERROR=-Werror WERROR=-Werror
CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR} CFLAGS :=-O2 -Wall -Wextra -Wshadow ${WERROR}
CFLAGS += -I $(top)/src/commonlib/bsd/include CFLAGS += -I $(top)/src/commonlib/bsd/include
CFLAGS += -D_GNU_SOURCE # memmem() from string.h CFLAGS += -D_GNU_SOURCE # memmem() from string.h
@@ -24,6 +24,9 @@ else
HOSTPKGCONFIG ?= pkg-config HOSTPKGCONFIG ?= pkg-config
endif endif
CFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) CFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto)
ifneq ($(.SHELLSTATUS),0)
$(error "Ensure that pkg-config is installed.")
endif
LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto) LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
all: $(TARGETS) all: $(TARGETS)

View File

@@ -3,13 +3,16 @@
amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o
amdfwreadobj = amdfwread.o amdfwreadobj = amdfwread.o
AMDFWTOOLCFLAGS=-O2 -Wall -Wextra -Wshadow -Werror AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow -Werror
AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include
AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h
HOSTPKGCONFIG ?= pkg-config HOSTPKGCONFIG ?= pkg-config
AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto)
ifneq ($(.SHELLSTATUS),0)
$(error "Ensure that pkg-config is installed.")
endif
LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto) LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER) $(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER)