aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2017-11-16 13:11:07 +0100
committerAnton Khirnov <anton@khirnov.net>2017-11-19 16:30:14 +0100
commit0007a0b0c11fa7c12b228883453368f105a4324b (patch)
treea5ac8016c58c13668bf87931dd921bea933cf07f /Makefile
Initial commit.
The following code is present: * the basis API * the BiCGSTAB solver * the pseudospectral linear system solver * helper APIs: - threadpool - logging - cpuid
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6affc77
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+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 \
+ log.o \
+ pssolve.o \
+ threadpool.o \
+
+TESTPROGS = 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