Skip to content

Commit 87ff205

Browse files
committed
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>
1 parent 54a16fb commit 87ff205

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ endif
1313
ifeq ($V,1)
1414
silent=
1515
silent_stdout=
16+
silent_stderr=
1617
else
1718
silent=@
1819
silent_stdout= > /dev/null
20+
silent_stderr= 2> /dev/null
1921
endif
2022

2123
PLATFORM := $(shell uname | sed -e 's/_.*//')

makefile_include.mk

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ endif
5555

5656
ifndef EXTRALIBS
5757
ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),)
58-
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath)
59-
else
60-
ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),)
61-
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath)
62-
endif
63-
endif
58+
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath ${silent_stderr} || true)
59+
else ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),)
60+
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath ${silent_stderr} || true)
61+
else ifneq ($(shell echo $(CFLAGS) | grep USE_GMP),)
62+
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs gmp ${silent_stderr} || true)
6463
endif
64+
endif # EXTRALIBS
6565

6666
need-help := $(filter help,$(MAKECMDGOALS))
6767
define print-help
@@ -77,13 +77,13 @@ endef
7777
# make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
7878
#
7979
ifneq ($(shell echo $(CFLAGS) | grep LTM_DESC),)
80-
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath)
80+
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath ${silent_stderr} || true)
8181
endif
8282
ifneq ($(shell echo $(CFLAGS) | grep TFM_DESC),)
83-
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath)
83+
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath ${silent_stderr} || true)
8484
endif
8585
ifneq ($(shell echo $(CFLAGS) | grep GMP_DESC),)
86-
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp)
86+
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp ${silent_stderr} || true)
8787
endif
8888
LTC_CFLAGS += -I./src/headers/ -DLTC_SOURCE -Wall -Wsign-compare -Wshadow
8989

0 commit comments

Comments
 (0)