aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: be6287aac6f09cef19d8a8562b1d001b7687c1d7 (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
TARGET = libteukolskydata.so

CFLAGS = -std=c99 -D_XOPEN_SOURCE=700 -fPIC -g -I.
TARGET_LDFLAGS = -Wl,--version-script=libteukolskydata.v -shared -lm -llapacke
TEST_LIBS = -lm -llapacke -lcblas -lpthread

OBJS = basis.o               \
       bicgstab.o            \
       cpu.o                 \
       cpuid.o               \
       init.o                \
       log.o                 \
       nlsolve.o             \
       pssolve.o             \
       td_constraints.o      \
       threadpool.o          \

TESTPROGS = nlsolve          \
            pssolve

TESTPROGS := $(addprefix tests/,$(TESTPROGS))

all: $(TARGET)

$(TARGET): $(OBJS)
	cc ${TARGET_LDFLAGS} -o $@ $(OBJS)

%.o: %.c
	cc $(CFLAGS) -MMD -MF $(@:.o=.d) -MT $@ -c -o $@ $<

%.o: %.asm
	yasm -f elf -m amd64 -M $< > $(@:.o=.d)
	yasm -f elf -m amd64 -o $@ $<

clean:
	-rm -f *.o *.d *.pyc $(TARGET)

tests/%.o: tests/%.c
	cc $(CFLAGS) -MMD -MF $(@:.o=.d) -MT $@ -c -o $@ $<

tests/%: tests/%.o $(OBJS)
	cc -o $@ $(@:=.o) $(OBJS) $(TEST_LIBS)

test: $(TARGET) $(TESTPROGS)
	LD_LIBRARY_PATH=. PYTHONPATH=. ./tests/convergence.py

-include $(OBJS:.o=.d)

.PHONY: clean test