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

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

OBJS = basis.o               \
       bicgstab.o            \
       eval.o                \
       init.o                \
       log.o                 \
       nlsolve.o             \
       pssolve.o             \
       td_constraints.o      \

TESTPROGS = nlsolve          \
            pssolve

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

all: $(TARGET)

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

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

%.o: %.asm
	nasm -f elf64 -M $< > $(@:.o=.d)
	nasm -f elf64 -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