From 6a4978ef5ed2208a4e1f63d4fb12ef6bdb9ed7f3 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 11 May 2017 15:40:50 +0200 Subject: [PATCH] better EXTRALIBS --- makefile_include.mk | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/makefile_include.mk b/makefile_include.mk index 9984fad..ff89df7 100644 --- a/makefile_include.mk +++ b/makefile_include.mk @@ -28,6 +28,20 @@ ifndef MAKE MAKE:=make endif +ifndef INSTALL_CMD +$(error your makefile must define INSTALL_CMD) +endif + +ifndef EXTRALIBS +ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),) +EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config libtommath --libs) +else +ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),) +EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config tomsfastmath --libs) +endif +endif +endif + # Compilation flags. Note the += does not write over the user's CFLAGS! CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE @@ -314,14 +328,6 @@ $(OBJECTS): $(HEADERS) $(DOBJECTS): $(HEADERS) $(THEADERS) $(TOBJECTS): $(HEADERS) $(THEADERS) -ifndef INSTALL_CMD -$(error your makefile must define INSTALL_CMD) -endif - -ifndef EXTRALIBS -EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config libtommath --libs) -endif - bins: $(USEFUL_DEMOS) all_test: test tv_gen $(DEMOS)