default: tags go3 test-bloom-filter
	/bin/true

go3: tags
	./example

.PHONY: tags
tags:
	ctags *.py test-bloom-filter example

.PHONY: go2
go2: tags test-bloom-filter

go: performance-graph.pdf
	evince performance-graph.pdf

performance-graph.pdf: performance-numbers.db gen-performance-graph
	# I suspect pychart, on which this is based, does not support Python 3.x.
	./gen-performance-graph

.PHONY: test-bloom-filter
test-bloom-filter:
	./this-pylint --which-2 None --to-pylint bloom_filter_mod.py test-bloom-filter
	rm -f seek.txt array.txt hybrid.txt mmap.txt
	/usr/local/cpython-3.10/bin/python3 ./test-bloom-filter
	/usr/local/pypy3-7.3.9/bin/pypy3 ./test-bloom-filter
	/usr/local/cpython-3.6/bin/python3 ./test-bloom-filter

clean:
	rm -f *.pyc *.class
	rm -rf __pycache__
	rm -f bloom-filter-rm-me
	rm -f *.ps *.pdf
	rm -f seek.txt array.txt
	rm -rf dist build drs_bloom_filter.egg-info
	rm -f performance-numbers
	rm -f bloom-filter.bin*
	rm -f tags

veryclean: clean
	rm -f performance-numbers.db
	rm -f performance-numbers
	
install-dependencies:
	./install-via-pip \
		--pip-path pip \
		--python-path python3 \
		--module-to-import pychart \
		--pip-package Python-Chart
	# The rpm package name is untested.
	./install-package \
		--deb-packages python3-tk \
		--rpm-packages python3-tkinter

publish:
	# Each new version
	python3 setup.py sdist
	python3 -m twine upload --verbose dist/*

test-publish: clean
	# python3 setup.py sdist  bdist_wheel
	python3 setup.py sdist
	python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*