| 1 |
# simple makefile to simplify repetitive build env management tasks under posix |
| 2 |
|
| 3 |
# caution: testing won't work on windows, see README |
| 4 |
|
| 5 |
PYTHON ?= python |
| 6 |
CYTHON ?= cython |
| 7 |
PYTEST ?= pytest |
| 8 |
CTAGS ?= ctags |
| 9 |
|
| 10 |
# skip doctests on 32bit python |
| 11 |
BITS := $(shell python -c 'import struct; print(8 * struct.calcsize("P"))') |
| 12 |
|
| 13 |
all: clean inplace test |
| 14 |
|
| 15 |
clean-ctags: |
| 16 |
rm -f tags |
| 17 |
|
| 18 |
clean: clean-ctags |
| 19 |
$(PYTHON) setup.py clean |
| 20 |
rm -rf dist |
| 21 |
|
| 22 |
in: inplace # just a shortcut |
| 23 |
inplace: |
| 24 |
$(PYTHON) setup.py build_ext -i |
| 25 |
|
| 26 |
test-code: in |
| 27 |
$(PYTEST) --showlocals -v skopt --durations=20 |
| 28 |
test-sphinxext: |
| 29 |
$(PYTEST) --showlocals -v doc/sphinxext/ |
| 30 |
test-doc: |
| 31 |
ifeq ($(BITS),64) |
| 32 |
$(PYTEST) $(shell find doc -name '*.rst' | sort) |
| 33 |
endif |
| 34 |
test-code-parallel: in |
| 35 |
$(PYTEST) -n auto --showlocals -v skopt --durations=20 |
| 36 |
|
| 37 |
test-coverage: |
| 38 |
rm -rf coverage .coverage |
| 39 |
$(PYTEST) skopt --showlocals -v --cov=skopt --cov-report=html:coverage |
| 40 |
test-coverage-parallel: |
| 41 |
rm -rf coverage .coverage .coverage.* |
| 42 |
$(PYTEST) skopt -n auto --showlocals -v --cov=skopt --cov-report=html:coverage |
| 43 |
|
| 44 |
test: test-code test-sphinxext test-doc |
| 45 |
|
| 46 |
trailing-spaces: |
| 47 |
find skopt -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \; |
| 48 |
|
| 49 |
ctags: |
| 50 |
# make tags for symbol based navigation in emacs and vim |
| 51 |
# Install with: sudo apt-get install exuberant-ctags |
| 52 |
$(CTAGS) --python-kinds=-i -R skopt |
| 53 |
|
| 54 |
doc: inplace |
| 55 |
$(MAKE) -C doc html |
| 56 |
|
| 57 |
doc-noplot: inplace |
| 58 |
$(MAKE) -C doc html-noplot |