summaryrefslogtreecommitdiffstats
path: root/Makefile.include
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.com>2021-10-21 12:58:07 +0200
committerNico Huber <nico.h@gmx.de>2021-12-22 12:30:23 +0000
commit22e5af78fe1329facee9b843d500dba8385e1d0f (patch)
tree7a365ba85d09b2220d5142fda1dea35dd7125e00 /Makefile.include
parent073e205e3bc0542910b7abd3f57b25e125dbcbfb (diff)
downloadflashrom-22e5af78fe1329facee9b843d500dba8385e1d0f.tar.gz
flashrom-22e5af78fe1329facee9b843d500dba8385e1d0f.tar.bz2
flashrom-22e5af78fe1329facee9b843d500dba8385e1d0f.zip
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>
Diffstat (limited to 'Makefile.include')
-rw-r--r--Makefile.include37
1 files changed, 15 insertions, 22 deletions
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 <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>