forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.tests
64 lines (49 loc) · 3.02 KB
/
Makefile.tests
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
TESTS = tests/test_sample tests/test_su3 tests/test_buffers tests/test_qpx tests/test_linalg tests/test_clover tests/test_rat
TEMP = $(patsubst %.c,%,$(wildcard $(top_srcdir)/tests/*.c))
TESTMODULES = $(patsubst $(top_srcdir)/%,%,$(TEMP))
TESTFLAGS = -L$(top_builddir)/cu/ -lcu
$(addsuffix .o,$(TESTMODULES)): %.o : $(top_srcdir)/%.c
${COMPILE} -c $(OPTARGS) ${DEFS} $<
# The linking stage needs to be differentiated because different tests rely on
# different modules from the codebase
# Each test itself consists of a number of modules that need to be linked.
# when used as a prerequisite, the wildcard with "tests/test_sample*.c" replaced by "$@*.c" is not evaluated
# correctly, even though it works perfectly in an echo statement, it results in make
# trying to compile all objects in top_srcdir
# we therefore evaluate the wildcard into a variable
TEST_SAMPLE_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_sample*.c))
TEST_SAMPLE_FLAGS:=
TEST_SAMPLE_LIBS:=$(top_builddir)/cu/libcu.a
tests/test_sample: $(TEST_SAMPLE_OBJECTS) $(TEST_SAMPLE_LIBS)
${LINK} $(TEST_SAMPLE_OBJECTS) $(TESTFLAGS) $(TEST_SAMPLE_FLAGS)
TEST_SU3_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_su3*.c)) expo.o
TEST_SU3_FLAGS:=-lm
TEST_SU3_LIBS:=$(top_builddir)/cu/libcu.a
tests/test_su3: $(TEST_SU3_OBJECTS) $(TEST_SU3_LIBS)
${LINK} $(TEST_SU3_OBJECTS) $(TESTFLAGS) $(TEST_SU3_FLAGS)
TEST_QPX_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_qpx*.c))
TEST_QPX_FLAGS:=-lm
TEST_QPX_LIBS:=$(top_builddir)/cu/libcu.a
tests/test_qpx: $(TEST_QPX_OBJECTS) $(TEST_QPX_LIBS)
${LINK} $(TEST_QPX_OBJECTS) $(TESTFLAGS) $(TEST_QPX_FLAGS)
TEST_LINALG_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_linalg*.c))
TEST_LINALG_FLAGS:=-lm
TEST_LINALG_LIBS:=$(top_builddir)/cu/libcu.a $(top_builddir)/linalg/liblinalg.a
tests/test_linalg: $(TEST_LINALG_OBJECTS) $(TEST_LINALG_LIBS)
${LINK} $(TEST_LINALG_OBJECTS) $(TEST_LINALG_LIBS) $(TESTFLAGS) $(TEST_LINALG_FLAGS)
TEST_BUFFERS_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_buffers*.c)) fatal_error.o
TEST_BUFFERS_FLAGS:=-lbuffers -L$(top_builddir)/buffers/
TEST_BUFFERS_LIBS:=$(top_builddir)/cu/libcu.a $(top_builddir)/buffers/libbuffers.a
tests/test_buffers: $(TEST_BUFFERS_OBJECTS) $(TEST_BUFFERS_LIBS)
${LINK} $(TEST_BUFFERS_OBJECTS) $(TESTFLAGS) $(TEST_BUFFERS_FLAGS)
TEST_CLOVER_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_clover*.c)) operator/clover_leaf.o
TEST_CLOVER_FLAGS:=-lm -lhmc -llinalg
TEST_CLOVER_LIBS:=$(top_builddir)/cu/libcu.a
tests/test_clover: $(TEST_CLOVER_OBJECTS) $(TEST_CLOVER_LIBS)
${LINK} $(TEST_CLOVER_OBJECTS) $(TESTFLAGS) $(TEST_CLOVER_FLAGS)
TEST_RAT_OBJECTS:=$(patsubst $(top_srcdir)/%.c,%.o,$(wildcard $(top_srcdir)/tests/test_rat*.c))
TEST_RAT_FLAGS:=-lm -lrational
TEST_RAT_LIBS:=$(top_builddir)/cu/libcu.a
tests/test_rat: $(TEST_RAT_OBJECTS) $(TEST_RAT_LIBS)
${LINK} $(TEST_RAT_OBJECTS) $(TESTFLAGS) $(TEST_RAT_FLAGS)
tests: ${TESTS}