From dbefb9730b6b68643dc8e44aeae3ac77a628f93e Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Mon, 31 Jan 2022 23:27:52 +0100 Subject: Makefile: use pkg-config --libs --static for LDFLAGS The --static flag of pkg-config returns also the LDFLAGS which are required to link the library static. Use this flag to successfully link against static libraries when the shared variant is not available. This is the case in OpenBSD with libpci. Change-Id: I6029a096c1ceca625789d18c88119d912d79bc0e Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/61524 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Angel Pons --- Makefile | 1 - Makefile.include | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f9280198b..66a699581 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,6 @@ override LDFLAGS += -L$(LIBS_BASE)/lib -Wl,-rpath -Wl,$(LIBS_BASE)/lib endif ifeq ($(CONFIG_STATIC),yes) -override PKG_CONFIG += --static override LDFLAGS += -static endif diff --git a/Makefile.include b/Makefile.include index 2316b30c4..fbd845699 100644 --- a/Makefile.include +++ b/Makefile.include @@ -53,5 +53,5 @@ $(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIB endef define dependency_ldflags -$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --libs $1 2>/dev/null) +$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --libs --static $1 2>/dev/null) endef -- cgit v1.2.3