2
0
Эх сурвалжийг харах

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 <[email protected]>
Steffen Jaeckel 10 сар өмнө
parent
commit
87ff205c8b
2 өөрчлөгдсөн 11 нэмэгдсэн , 9 устгасан
  1. 2 0
      makefile
  2. 9 9
      makefile_include.mk

+ 2 - 0
makefile

@@ -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/_.*//')

+ 9 - 9
makefile_include.mk

@@ -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