aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: ded6ddaa0bf0a29fcdbdcf4562c999dadc72fa78 (plain)
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
.PHONY: check build wheel install clean sphinx-apidoc documentation

PYTHON = python
BUILDER = $(PYTHON) -m build
INSTALLER = $(PYTHON) -m installer
VERSION = $(shell $(PYTHON) -c 'print(__import__("toml").load(open("pyproject.toml"))["project"]["version"])')
WHEEL = dist/rainbow_parenthesis-$(VERSION)-py3-none-any.whl
DOC_OUTPUT = doc.rendered

DESTDIR = /
PREFIX = /usr

INSTALL_FLAGS = --destdir=$(DESTDIR) \
				--prefix=$(PREFIX)

build: $(WHEEL)

$(WHEEL): pyproject.toml $(shell find rainbow_parenthesis -type f -name '*.py')
	$(BUILDER) --no-isolation --wheel

install: build
	@echo "WHEEL=$(WHEEL)"
	$(INSTALLER) $(INSTALL_FLAGS) $(WHEEL)

clean:
	-rm -r build
	-rm -r dist
	-rm -r rainbow_parenthesis.egg-info/

check:
	flake8 rainbow_parenthesis
	mypy -p rainbow_parenthesis

# Generate some rst files from our source code
sphinx-apidoc:
	sphinx-apidoc --separate --force -o doc rainbow_parenthesis

# Build the actual HTML documentation
$(DOC_OUTPUT)/index.html: sphinx-apidoc
	sphinx-build -b dirhtml doc $(DOC_OUTPUT)

documentation: sphinx-apidoc