This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Makefile
125 lines (95 loc) · 3.1 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
122
123
124
125
# simple makefile to simplify repetitive build env management tasks under posix
PYTHON := $(shell which python)
CYTHON := $(shell which cython)
NOSETESTS := $(shell which nosetests)
CYTHON_CORE_PYX := root_numpy/src/_librootnumpy.pyx
CYTHON_TMVA_PYX := root_numpy/tmva/src/_libtmvanumpy.pyx
CYTHON_CORE_CPP := $(CYTHON_CORE_PYX:.pyx=.cpp)
CYTHON_TMVA_CPP := $(CYTHON_TMVA_PYX:.pyx=.cpp)
CYTHON_PYX_SRC := $(filter-out $(CYTHON_CORE_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: clean cython inplace test
clean-examples:
@find examples -name "*.root" -exec rm {} \;
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-examples clean-build clean-pyc clean-so
.SECONDEXPANSION:
%.cpp: %.pyx $$(filter-out $$@,$$(wildcard $$(@D)/*))
@echo "compiling $< ..."
$(CYTHON) --cplus --fast-fail --line-directives $<
cython: $(CYTHON_CORE_CPP) $(CYTHON_TMVA_CPP)
clean-cython:
@rm -f $(CYTHON_CORE_CPP)
@rm -f $(CYTHON_TMVA_CPP)
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
valgrind: inplace
valgrind --log-file=valgrind.log --tool=memcheck --leak-check=full \
--suppressions=etc/valgrind-python.supp \
--suppressions=etc/valgrind-root-python.supp \
--suppressions=etc/valgrind-root.supp $(NOSETESTS) -s -v root_numpy
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-html --cover-html-dir=coverage --cover-package=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: 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/