1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

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 <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58623
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Thomas Heijligen
2021-10-21 12:58:07 +02:00
committed by Nico Huber
parent 073e205e3b
commit 22e5af78fe
3 changed files with 57 additions and 59 deletions

View File

@ -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 <stdlib.h>
#include <ftdi.h>
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 <ftdi.h>
enum ftdi_chip_type type = TYPE_232H;
endef
export FTDI_232H_TEST
define NI845X_TEST
#include <ni845x.h>