From 22e5af78fe1329facee9b843d500dba8385e1d0f Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Thu, 21 Oct 2021 12:58:07 +0200 Subject: Makefile: Make pkg-config mandatory to find libftdi1 Use `make HAS_LIBFTDI1=yes/no` to override the pkg-config detection and `CONFIG_LIBFTDI1_CFLAGS` and `CONFIG_LIBFTDI1_LDFLAGS` to set cflags and ldflags manually. Change-Id: I41f5186d9f3e063c12c8c6eea888d0b0bf534259 Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/58623 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- Makefile.include | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'Makefile.include') diff --git a/Makefile.include b/Makefile.include index dccc69d05..cd8ae7d73 100644 --- a/Makefile.include +++ b/Makefile.include @@ -33,11 +33,23 @@ endef # Run the C Preprocessor with file $1 and return the last line, removing quotes. define c_macro_test -$(strip $(shell $(CC) -E $1 2>/dev/null | tail -1 | tr -d '"')) +$(strip $(call debug_shell, $(CC) -E $1 | tail -1 | tr -d '"')) endef -define c_compile_test -$(shell $(CC) -c -Wall -Werror -o /dev/null $1 2>/dev/null && echo yes || echo no) +define c_compile_test # $1: files to compile, $2: cflags +$(call debug_shell, $(CC) -c -Wall -Werror $2 $1 -o /dev/null && echo yes || echo no) +endef + +define find_dependency +$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --exists $1 && echo yes || echo no) +endef + +define dependency_cflags +$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --cflags $1 2>/dev/null) +endef + +define dependency_ldflags +$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --libs $1 2>/dev/null) endef define LIBPCI_TEST @@ -111,25 +123,6 @@ int main(int argc, char **argv) endef export LIBJAYLINK_TEST -define FTDI_TEST -#include -#include -struct ftdi_context *ftdic = NULL; -int main(int argc, char **argv) -{ - (void) argc; - (void) argv; - return ftdi_init(ftdic); -} -endef -export FTDI_TEST - -define FTDI_232H_TEST -#include -enum ftdi_chip_type type = TYPE_232H; -endef -export FTDI_232H_TEST - define NI845X_TEST #include -- cgit v1.2.3