Makefile 1.56 KB
Newer Older
Jerome Flesch's avatar
Jerome Flesch committed
1
VERSION_FILE = src/pyocr/_version.py
2
PYTHON = python3
Jerome Flesch's avatar
Jerome Flesch committed
3 4 5 6 7 8 9 10

build: build_c build_py

install: install_py install_c

uninstall: uninstall_py

build_py: ${VERSION_FILE}
11
	${PYTHON} ./setup.py build
Jerome Flesch's avatar
Jerome Flesch committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

build_c:

${VERSION_FILE}:
	echo -n "version = \"" >| $@
	echo -n $(shell git describe --always) >> $@
	echo "\"" >> $@

version: ${VERSION_FILE}

doc: install_py
	(cd doc && make html)
	cp doc/index.html doc/build/index.html

check:
	flake8
28
# 	pydocstyle src/pyocr
Jerome Flesch's avatar
Jerome Flesch committed
29 30 31 32

test: ${VERSION_FILE}
	tox

33 34 35
linux_exe:

windows_exe:
Jerome Flesch's avatar
Jerome Flesch committed
36 37 38 39 40 41 42

release:
ifeq (${RELEASE}, )
	@echo "You must specify a release version (make release RELEASE=1.2.3)"
else
	@echo "Will release: ${RELEASE}"
	@echo "Checking release is in ChangeLog ..."
Jerome Flesch's avatar
Jerome Flesch committed
43
	grep ${RELEASE} ChangeLog | grep -v "/xx"
Jerome Flesch's avatar
Jerome Flesch committed
44 45 46 47 48
	@echo "Releasing ..."
	git tag -a ${RELEASE} -m ${RELEASE}
	git push origin ${RELEASE}
	make clean
	make version
49
	${PYTHON} ./setup.py sdist upload
Jerome Flesch's avatar
Jerome Flesch committed
50 51 52 53 54 55 56 57 58 59
	@echo "All done"
endif

clean:
	rm -rf doc/build
	rm -rf build dist *.egg-info
	rm -rf src/pyocr/__pycache__
	rm -f ${VERSION_FILE}

install_py: ${VERSION_FILE}
60
	${PYTHON} ./setup.py install ${PIP_ARGS}
Jerome Flesch's avatar
Jerome Flesch committed
61 62 63 64

install_c:

uninstall_py:
Jerome Flesch's avatar
Jerome Flesch committed
65
	pip3 uninstall -y pyocr
Jerome Flesch's avatar
Jerome Flesch committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

uninstall_c:

help:
	@echo "make build || make build_py"
	@echo "make check"
	@echo "make doc"
	@echo "make help: display this message"
	@echo "make install || make install_py"
	@echo "make release"
	@echo "make test"
	@echo "make uninstall || make uninstall_py"

.PHONY: \
	build \
	build_c \
	build_py \
	check \
	doc \
85 86
	linux_exe \
	windows_exe \
Jerome Flesch's avatar
Jerome Flesch committed
87 88 89 90 91 92 93 94 95
	help \
	install \
	install_c \
	install_py \
	release \
	test \
	uninstall \
	uninstall_c \
	version