Handle potential pkg-config failures

There are cases where we want to use an MPI provider, but the package is
not installed in the system, so `pkg-config` can't find it.
To solve this simply ignore the errors created and only print something
if the user asks us to by passing `V=1`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel 2024-12-11 11:57:08 +01:00
parent 54a16fb672
commit 87ff205c8b
2 changed files with 11 additions and 9 deletions

View file

@ -13,9 +13,11 @@ endif
ifeq ($V,1)
silent=
silent_stdout=
silent_stderr=
else
silent=@
silent_stdout= > /dev/null
silent_stderr= 2> /dev/null
endif
PLATFORM := $(shell uname | sed -e 's/_.*//')

View file

@ -55,13 +55,13 @@ endif
ifndef EXTRALIBS
ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath)
else
ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath)
endif
endif
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath ${silent_stderr} || true)
else ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath ${silent_stderr} || true)
else ifneq ($(shell echo $(CFLAGS) | grep USE_GMP),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs gmp ${silent_stderr} || true)
endif
endif # EXTRALIBS
need-help := $(filter help,$(MAKECMDGOALS))
define print-help
@ -77,13 +77,13 @@ endef
# make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
#
ifneq ($(shell echo $(CFLAGS) | grep LTM_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath ${silent_stderr} || true)
endif
ifneq ($(shell echo $(CFLAGS) | grep TFM_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath ${silent_stderr} || true)
endif
ifneq ($(shell echo $(CFLAGS) | grep GMP_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp ${silent_stderr} || true)
endif
LTC_CFLAGS += -I./src/headers/ -DLTC_SOURCE -Wall -Wsign-compare -Wshadow