-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
35 lines (28 loc) · 1.02 KB
/
Makefile
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
PYTHON=python3
INC=-Ilib -I${CONDA_PREFIX}/include
EXTRA=-O3
VERSION=$(shell git show -s --pretty="%h %ad %d")
CFLAGS=-fPIC -std=c++11 -Wall -g -fopenmp ${INC}
SO=_sib$(shell ${PYTHON}-config --extension-suffix)
LINK=-lgomp -lm -DVERSION="\"${VERSION}\""
PYINC=$(shell ${PYTHON} -m pybind11 --includes)
DEP=$(wildcard *.h)
DOCTEST=$(wildcard test/*.doctest)
CXX=g++
all: sib ${SO}
params.o: params.cpp ${DEP}
${CXX} ${CFLAGS} ${EXTRA} -c params.cpp -o $@
bp.o: bp.cpp ${DEP}
${CXX} ${CFLAGS} ${EXTRA} -c bp.cpp -o $@
sib: bp.o params.o sib.cpp ${DEP}
${CXX} ${CFLAGS} ${EXTRA} params.o bp.o sib.cpp ${LINK} -o $@
drop.o: drop.cpp ${DEP}
${CXX} ${CFLAGS} ${EXTRA} -c drop.cpp -o $@
${SO}: bp.o params.o drop.o pysib.cpp ${DEP}
${CXX} -shared ${CFLAGS} ${PYINC} ${LINK} ${EXTRA} params.o bp.o drop.o pysib.cpp -o $@
test: ${DOCTEST}
${DOCTEST}: sib ${SO}
@${PYTHON} -c "import sys, doctest; (f,t) = doctest.testfile(\"$@\"); print(f'DOCTEST $@: PASSED {t-f}/{t}'); sys.exit(int(f > 0))"
clean:
rm -f sib ${SO} *.o
.PHONY: ${DOCTEST}