]> git.k1024.org Git - pylibacl.git/blob - Makefile
Add a fast-test target
[pylibacl.git] / Makefile
1 PYTHON        = python3
2 SPHINXOPTS    = -W
3 SPHINXBUILD   = $(PYTHON) -m sphinx
4 DOCDIR        = doc
5 DOCHTML       = $(DOCDIR)/html
6 DOCTREES      = $(DOCDIR)/doctrees
7 ALLSPHINXOPTS = -d $(DOCTREES) $(SPHINXOPTS) $(DOCDIR)
8 VERSION       = 0.5.4
9 FULLVER       = pylibacl-$(VERSION)
10 DISTFILE      = $(FULLVER).tar.gz
11
12 MODNAME = posix1e.so
13 RSTFILES = doc/index.rst doc/module.rst NEWS README.rst doc/conf.py
14
15 all: doc test
16
17 $(MODNAME): acl.c
18         $(PYTHON) ./setup.py build_ext --inplace
19
20 $(DOCHTML)/index.html: $(MODNAME) $(RSTFILES) acl.c
21         $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCHTML)
22         touch $@
23
24 doc: $(DOCHTML)/index.html
25
26 dist:
27         fakeroot $(PYTHON) ./setup.py sdist
28
29 distcheck: dist
30         set -e; \
31         TDIR=$$(mktemp -d) && \
32         trap "rm -rf $$TDIR" EXIT; \
33         tar xzf dist/$(DISTFILE) -C $$TDIR && \
34         (cd $$TDIR/$(FULLVER) && make doc && make test && make dist) && \
35         echo "All good, you can upload $(DISTFILE)!"
36
37 test:
38         @for ver in 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8; do \
39           for flavour in "" "-dbg"; do \
40             if type python$$ver$$flavour >/dev/null; then \
41               echo Testing with python$$ver$$flavour; \
42               python$$ver$$flavour ./setup.py test -q; \
43             fi; \
44           done; \
45         done; \
46         for pp in pypy pypy3; do \
47           if type $$pp >/dev/null; then \
48             echo Testing with $$pp; \
49             $$pp ./setup.py test -q; \
50           fi; \
51         done
52
53 fast-test:
54         python3 setup.py build_ext -i
55         python3 -m pytest tests -v
56
57 coverage:
58         $(MAKE) clean
59         $(MAKE) test CFLAGS="-coverage"
60         lcov --capture --directory . --output-file coverage.info
61         genhtml coverage.info --output-directory out
62
63 clean:
64         rm -rf $(DOCHTML) $(DOCTREES)
65         rm -f $(MODNAME)
66         rm -f *.so
67         rm -rf build
68
69 .PHONY: doc test clean dist coverage