-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGNUmakefile
More file actions
75 lines (58 loc) · 2.3 KB
/
Copy pathGNUmakefile
File metadata and controls
75 lines (58 loc) · 2.3 KB
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
65
66
67
68
69
70
71
72
73
74
75
# set to python2 for python2 install
PYTHON ?= python3
# set to pip2 for python2 install
PIP ?= pip3
SAGE ?= sage
PREFIX = /usr/local
SOLLYA_DIR ?= /opt/homebrew
# overload on command line if you do not want a system wide
# install or if your local pip version does not support "--system" option
INSTALL_OPTIONS = --system --target=${PREFIX}
CPPFLAGS = -I${SOLLYA_DIR}/include
LDFLAGS = -L${SOLLYA_DIR}/lib
PYTHONPATH = $(shell PYTHONUSERBASE=${PREFIX} ${PYTHON} -c "import site; \
print(site.getusersitepackages())")
export LDFLAGS CPPFLAGS PYTHONPATH
.PHONY: install build clean generated srctarball test test-extra test-sage
GEN_DEPS := sollya_func.pxi sollya_settings.pxi sollya_ops.pxi csollya_ops.pxd
DEPS := csollya.pxd sollya.pyx sollya_extra_functions.pyx ${GEN_DEPS}
SOBJ := sollya.so sagesollya.so sollya_extra_functions.so
sollya.so sollya_extra_functions.so: ${DEPS}
${PYTHON} setup.py build_ext --inplace
build: sollya.so sollya_extra_functions.so
sagesollya.so: ${DEPS}
WITH_SAGE=foo ${SAGE} -python setup.py build_ext --inplace
csollya_ops.pxd sollya_ops.pxi: gen_ops.py
> /dev/null echo '#include <sollya.h>' | cpp "${CPPFLAGS}" && \
echo '#include <sollya.h>' | cpp "${CPPFLAGS}" \
| grep SOLLYA_BASE_FUNC_ \
| ${PYTHON} $< csollya_ops.pxd sollya_ops.pxi
sollya_%.pxi: gen_%.py
PATH="${SOLLYA_DIR}:${PATH}" ${PYTHON} $< > $@
# Target called by setup.py (so that, when running "make" without arguments, the
# makefile calls setup.py which calls the makefile)
generated: ${GEN_DEPS}
install: sollya.so sollya_extra_functions.so
$(PIP) install ${INSTALL_OPTIONS} .
clean:
${PYTHON} setup.py clean
rm -rf ${GEN_DEPS} ${SOBJ} ${SOBJ:.so=.c}
gitrev = $(shell git rev-parse --short HEAD)
srctarball:
git archive -o cythonsollya-$(gitrev).tar.gz HEAD
TESTS=${wildcard examples/*.py}
TESTS_EXTRA=${wildcard examples/extras/*.py}
test: sollya.so ${TESTS}
@for f in ${TESTS}; do \
echo Testing $$f; \
LD_LIBRARY_PATH=${SOLLYA_DIR}/lib:${LD_LIBRARY_PATH} \
${PYTHON} -m doctest $$f || exit -1; \
done
test-extra: sollya.so ${TESTS_EXTRA}
@for f in ${TESTS_EXTRA}; do \
echo Testing $$f; \
LD_LIBRARY_PATH=${SOLLYA_DIR}/lib:${LD_LIBRARY_PATH} \
${PYTHON} -m doctest $$f || exit -1; \
done
test-sage: examples/sagesollya.sage sagesollya.so test
PYTHONPATH=. ${SAGE} -t $<