aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2020-03-09 16:27:26 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2020-03-09 16:27:26 +0000
commit601cff702c33cded7e251a474a38fd03c31b4c71 (patch)
treededc0e46307ce1ea183de22f499841e1703107a6
parentMinor improvements to readme (diff)
downloadgensvm-601cff702c33cded7e251a474a38fd03c31b4c71.tar.gz
gensvm-601cff702c33cded7e251a474a38fd03c31b4c71.zip
Try to detect the linear algebra package automatically
-rw-r--r--Makefile20
-rw-r--r--tests/Makefile9
2 files changed, 23 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6f0385c..300cdc4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,14 @@
+# Makefile for GenSVM
+#
+# Author: G.J.J. van den Burg
+# Copyright (c) 2016 G.J.J. van den Burg
+# License: GPLv2
+#
+
+SHELL := bash
+.SHELLFLAGS := -eu -o pipefail -c
+MAKEFLAGS += --warn-undefined-variables --no-builtin-rules
+
VERSION=0.2.2
CC=gcc
CFLAGS=-Wall -Wno-unused-result -Wsign-compare -Wstrict-prototypes \
@@ -9,6 +20,7 @@ DOCDIR=doc
DOXYFILE=$(DOCDIR)/Doxyfile
LCOV=lcov
GENHTML=genhtml
+LDFLAGS+=-lcblas -llapack -lm
EXECS=gensvm gensvm_grid
@@ -21,10 +33,12 @@ OBJ=$(patsubst %.c,%.o,$(SRC))
all: lib/libgensvm.a $(EXECS)
-ifdef NOATLAS
-override LDFLAGS+=-lcblas -llapack -lm -lopenblas
+ifneq ($(strip $(shell ldconfig -p | grep libopenblas)),)
+override LDFLAGS+=-lopenblas
+else ifneq ($(shell ldconfig -p | grep libatlas),)
+override LDFLAGS+=-latlas
else
-override LDFLAGS+=-lcblas -llapack -lm -latlas
+$(error No OpenBLAS or ATLAS found, please install either or alter this Makefile. If you believe this is a bug please open an issue at https://www.github.com/GjjvdBurg/GenSVM)
endif
debug: CFLAGS += -DDEBUG
diff --git a/tests/Makefile b/tests/Makefile
index 8d00c35..dc6001a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,11 +2,14 @@ CC=gcc
CFLAGS=-Wall -Wno-unused-result -Wsign-compare -g -rdynamic -DNDEBUG $(OPTFLAGS)
INCLUDE=-I../include/ -I./include
LIB=-L../lib
+LDFLAGS+=-lcblas -llapack -lm -lgensvm
-ifdef NOATLAS
-override LDFLAGS+=-lm -lcblas -llapack -lgensvm
+ifneq ($(strip $(shell ldconfig -p | grep libopenblas)),)
+override LDFLAGS+=-lopenblas
+else ifneq ($(shell ldconfig -p | grep libatlas),)
+override LDFLAGS+=-latlas
else
-override LDFLAGS+=-lm -lcblas -llapack -latlas -lgensvm
+$(error No OpenBLAS or ATLAS found, please install either or alter this Makefile)
endif
TEST_SRC=$(wildcard src/test_*.c)