forked from scikit-hep/root_numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (91 loc) · 2.89 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# simple makefile to simplify repetitive build env management tasks under posix
PYTHON := $(shell which python)
CYTHON := $(shell which cython)
NOSETESTS := $(shell which nosetests)
CYTHON_PYX := root_numpy/src/_librootnumpy.pyx
CYTHON_CPP := root_numpy/src/_librootnumpy.cpp
CYTHON_SRC := $(filter-out $(CYTHON_PYX),$(filter-out $(CYTHON_CPP),$(wildcard root_numpy/src/*)))
CYTHON_PYX_SRC := $(filter-out $(CYTHON_PYX),$(wildcard root_numpy/src/*.pyx))
INTERACTIVE := $(shell ([ -t 0 ] && echo 1) || echo 0)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
OPEN := open
else
OPEN := xdg-open
endif
all: $(CYTHON_CPP) clean inplace test
clean-pyc:
@find . -name "*.pyc" -exec rm {} \;
clean-so:
@find root_numpy -name "*.so" -exec rm {} \;
clean-build:
@rm -rf build
clean-html:
@find root_numpy/src -name "*.html" -exec rm {} \;
clean: clean-build clean-pyc clean-so
$(CYTHON_PYX): $(CYTHON_SRC)
$(CYTHON_CPP): $(CYTHON_PYX)
@echo "compiling $< ..."
@$(CYTHON) --cplus --fast-fail --line-directives $<
cython:
@echo "compiling $(CYTHON_PYX) ..."
$(CYTHON) --cplus --fast-fail --line-directives $(CYTHON_PYX)
show-cython: clean-html
@tmp=`mktemp -d`; \
for pyx in $(CYTHON_PYX_SRC); do \
echo "compiling $$pyx ..."; \
name=`basename $$pyx`; \
cat root_numpy/src/setup.pxi $$pyx > $$tmp/$$name; \
$(CYTHON) -a --cplus --fast-fail --line-directives -Iroot_numpy/src $$tmp/$$name; \
done; \
mv $$tmp/*.html root_numpy/src/; \
rm -rf $$tmp; \
if [ "$(INTERACTIVE)" -eq "1" ]; then \
for html in root_numpy/src/*.html; do \
echo "opening $$html ..."; \
$(OPEN) $$html; \
done; \
fi;
in: inplace # just a shortcut
inplace:
@$(PYTHON) setup.py build_ext -i
install: clean
@$(PYTHON) setup.py install
install-user: clean
@$(PYTHON) setup.py install --user
sdist: clean
@$(PYTHON) setup.py sdist --release
register:
@$(PYTHON) setup.py register --release
upload: clean
@$(PYTHON) setup.py sdist upload --release
test-code: inplace
@$(NOSETESTS) -s -v root_numpy
test-installed:
@(mkdir -p nose && cd nose && \
$(NOSETESTS) -s -v --exe root_numpy && \
cd .. && rm -rf nose)
test-doc:
@$(NOSETESTS) -s --with-doctest --doctest-tests --doctest-extension=rst \
--doctest-extension=inc --doctest-fixtures=_fixture docs/
test-coverage: in
@rm -rf coverage .coverage
@$(NOSETESTS) -s -v -a '!slow' --with-coverage \
--cover-erase --cover-branches \
--cover-min-percentage=100 \
--cover-html --cover-html-dir=coverage root_numpy
@if [ "$(INTERACTIVE)" -eq "1" ]; then \
$(OPEN) coverage/index.html; \
fi;
test: test-code test-doc
trailing-spaces:
@find root_numpy -name "*.py" | xargs perl -pi -e 's/[ \t]*$$//'
doc-clean:
@make -C docs/ clean
doc: clean doc-clean inplace
@make -C docs/ html
check-rst:
@$(PYTHON) setup.py --long-description | rst2html.py > __output.html
@rm -f __output.html
gh-pages: doc
@./ghp-import -m "update docs" -r upstream -f -p docs/_build/html/