Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# A Makefile for miscmaths unit tests.
include ${FSLCONFDIR}/default.mk
PROJNAME = test-miscmaths
TESTXFILES = test-miscmaths
USRINCFLAGS = -DMISCMATHS_TEST_DIRECTORY=\"$(realpath .)\"
LIBS = -lfsl-miscmaths -lfsl-NewNifti -lfsl-cprob
# The test program can be run against
# an in-source checkout, or against
# an installed version of the
# libfsl-miscmaths.so library.
#
# If the former, the miscmaths library
# must have been compiled before the
# test can be compiled.
# The test program uses the Boost unit
# testing framework, which needs librt
# # on linux.
SYSTYPE := $(shell uname -s)
ifeq ($(SYSTYPE), Linux)
LIBS += -lrt
RPATH := -Wl,-rpath,'$$ORIGIN/..'
endif
ifeq ($(SYSTYPE), Darwin)
RPATH := -Wl,-rpath,'@executable_path/..'
endif
all: ${TESTXFILES}
OBJS := $(wildcard test_*.cc)
OBJS := $(OBJS:%.cc=%.o)
# We add -I.., -L.., -Wl,-rpath so that
# in-source builds take precedence over
# $FSLDEVDIR/$FSLDIR
%.o: %.cc
$(CXX) -I.. ${CXXFLAGS} -c -o $@ $<
test-miscmaths: ${OBJS}
$(CXX) ${CXXFLAGS} -o $@ $^ -L.. ${RPATH} ${LDFLAGS}