aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-08-20 12:50:37 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-08-20 12:50:37 +0200
commit87bf94a704c175c4c90de1dd77b9456728521e6c (patch)
treeb180c6edc9df9663bdf1b4887c39cc6c5e595daf /Makefile
parentSwitch to using a generator. (diff)
downloadrainbow-parenthesis-87bf94a704c175c4c90de1dd77b9456728521e6c.tar.gz
rainbow-parenthesis-87bf94a704c175c4c90de1dd77b9456728521e6c.tar.xz
Made project packable.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 39 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 595a7c2..ded6dda 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,42 @@
-.PHONY: check
+.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
+ 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