File: Makefile

package info (click to toggle)
python-rtmidi 1.5.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,248 kB
  • sloc: cpp: 4,228; python: 2,853; makefile: 287; sh: 109; ansic: 19
file content (91 lines) | stat: -rw-r--r-- 2,631 bytes parent folder | download
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
.PHONY: clean-pyc clean-build clean coverage docs dist lint release release_upload requirements test

BUILDDIR ?= builddir
PREFIX ?= /usr/local
PYTHON ?= python3
SOURCES = src/_rtmidi.pyx src/rtmidi/RtMidi.cpp

help:
	@echo "build - build extension module (and place it in the rtmidi package)"
	@echo "check-docs - check docstrings with pycodestyle"
	@echo "clean-build - remove build artifacts"
	@echo "clean-docs - remove docs output"
	@echo "clean-pyc - remove Python file artifacts"
	@echo "coverage - check code coverage quickly with the default Python"
	@echo "dist - build distribution packages"
	@echo "docs - generate Sphinx HTML documentation, including API docs"
	@echo "lint - check style with flake8"
	@echo "release - package a release"
	@echo "release_upload - package a release and upload it to PyPI"
	@echo "requirements - generate 'requirement-dev.txt' from 'requirements-dev.in'"
	@echo "test - run tests with pytest"

build: $(SOURCES)
	if [[ -d "$(BUILDDIR)" ]]; then \
		meson setup --reconfigure "--prefix=$(PREFIX)" -Dbuildtype=plain $(BUILDDIR); \
	else \
		meson setup "--prefix=$(PREFIX)" -Dbuildtype=plain $(BUILDDIR); \
	fi
	meson compile -C $(BUILDDIR)

check-docs:
	$(PYTHON) -m pydocstyle rtmidi

clean: clean-build clean-docs clean-pyc
	rm -fr htmlcov/

clean-build:
	rm -fr dist/
	rm -fr *.egg-info
	rm -fr rtmidi/*.so
	rm -fr src/_rtmidi.cpp

clean-docs:
	rm -fr docs/_build

clean-pyc:
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +
	find . -name __pycache__ -type d -exec rm -rf {} +

coverage: build
	cp -f $(BUILDDIR)/rtmidi/_rtmidi.*.so rtmidi/
	cp -f $(BUILDDIR)/rtmidi/version.py rtmidi/
	$(PYTHON) -m coverage run --source rtmidi -m pytest tests
	$(PYTHON) -m coverage report -m
	$(PYTHON) -m coverage html
	-rm -f rtmidi/*.so rtmidi/version.py
	-xdg-open htmlcov/index.html

dist: clean release
	ls -l dist

docs: build
	cp -f $(BUILDDIR)/rtmidi/_rtmidi.*.so rtmidi/
	cp -f $(BUILDDIR)/rtmidi/version.py rtmidi/
	rm -f docs/rtmidi.rst
	rm -f docs/modules.rst
	sphinx-apidoc -o docs rtmidi
	cat docs/api.rst.inc >> docs/rtmidi.rst
	$(MAKE) -C docs clean
	$(MAKE) -C docs html
	-rm -f rtmidi/*.so rtmidi/version.py
	-xdg-open docs/_build/html/index.html

lint:
	$(PYTHON) -m flake8 rtmidi tests examples

release:
	$(PYTHON) -m build

release_upload: release
	$(PYTHON) -m twine upload --skip-existing dist/*.tar.gz dist/*.whl

requirements-dev.txt: requirements-dev.in
	pip-compile --quiet --resolver=backtracking --no-emit-index-url --strip-extras "$<" > "$@"

requirements: requirements-dev.txt

test:
	pytest -v tests