summaryrefslogtreecommitdiff
path: root/relapack/Makefile
blob: 1e81b54231dfed0956112630a067c0dedad9f899 (plain)
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
64
TOPDIR  = ..
include $(TOPDIR)/Makefile.system



SRC = $(wildcard src/*.c)
OBJS = $(SRC:%.c=%.o)

TEST_SUITS = \
	slauum dlauum clauum zlauum \
	spotrf dpotrf cpotrf zpotrf \
	spbtrf dpbtrf cpbtrf zpbtrf \
	ssygst dsygst chegst zhegst \
	ssytrf dsytrf csytrf chetrf zsytrf zhetrf \
	sgetrf dgetrf cgetrf zgetrf \
	sgbtrf dgbtrf cgbtrf zgbtrf \
	strsyl dtrsyl ctrsyl ztrsyl \
	stgsyl dtgsyl ctgsyl ztgsyl \
	sgemmt dgemmt cgemmt zgemmt
TESTS = $(TEST_SUITS:%=test/%.pass)  # dummies
TEST_EXES = $(TEST_SUITS:%=test/%.x)

LINK_TEST = -L$(TOPDIR) -lopenblas -lgfortran -lm

.SECONDARY: $(TEST_EXES)
.PHONY: test

# ReLAPACK compilation

libs:	$(OBJS)
	@echo "Building ReLAPACK library $(LIBNAME)"
	$(AR) -r  $(TOPDIR)/$(LIBNAME) $(OBJS)
	$(RANLIB) $(TOPDIR)/$(LIBNAME)

%.o: %.c config.h
	$(CC) $(CFLAGS) -c $< -o $@


# ReLAPACK testing

test: $(TEST_EXES) $(TESTS)
	@echo "passed all tests"

test/%.pass: test/%.x
	@echo -n $*:
	@./$< > /dev/null && echo " pass" || (echo " FAIL" && ./$<)

test/s%.x: test/x%.c test/util.o $(TOPDIR)/$(LIBNAME) test/config.h test/test.h
	$(CC) $(CFLAGS) -DDT_PREFIX=s $< test/util.o -o $@ $(LINK_TEST) $(TOPDIR)/$(LIBNAME) $(LINK_TEST)

test/d%.x: test/x%.c test/util.o $(TOPDIR)/$(LIBNAME) test/config.h test/test.h
	$(CC) $(CFLAGS) -DDT_PREFIX=d $< test/util.o -o $@ $(LINK_TEST) $(TOPDIR)/$(LIBNAME) $(LINK_TEST)

test/c%.x: test/x%.c test/util.o $(TOPDIR)/$(LIBNAME) test/config.h test/test.h
	$(CC) $(CFLAGS) -DDT_PREFIX=c $< test/util.o -o $@ $(LINK_TEST) $(TOPDIR)/$(LIBNAME) $(LINK_TEST)

test/z%.x: test/x%.c test/util.o $(TOPDIR)/$(LIBNAME) test/config.h test/test.h
	$(CC) $(CFLAGS) -DDT_PREFIX=z $< test/util.o -o $@ $(LINK_TEST) $(TOPDIR)/$(LIBNAME) $(LINK_TEST)


# cleaning up

clean:
	rm -f  $(OBJS) test/util.o test/*.x