| 1 |
# This program is free software; you can redistribute it and/or modify |
| 2 |
# it under the terms of the GNU General Public License as published by |
| 3 |
# the Free Software Foundation; either version 3 of the License, or |
| 4 |
# (at your option) any later version. |
| 5 |
# |
| 6 |
# This program is distributed in the hope that it will be useful, |
| 7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 |
# GNU General Public License for more details. |
| 10 |
# |
| 11 |
# You should have received a copy of the GNU General Public License |
| 12 |
# along with this program; if not, write to the Free Software |
| 13 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 14 |
# MA 02110-1301, USA. |
| 15 |
|
| 16 |
# Note: required utilities: |
| 17 |
# - For test: pytest |
| 18 |
# - For cov: python-pytest-cov and python3-pytest-cov, also |
| 19 |
# python-coverage |
| 20 |
# - For docs: sphinx and recommonmark |
| 21 |
TEST = pytest-3 -m "not spamassassin" |
| 22 |
COV = pytest-3 -m "not spamassassin" --cov-append --cov isbg -m 2 |
| 23 |
COVREP = python3-coverage |
| 24 |
COVDIR = build/htmlcov |
| 25 |
|
| 26 |
.PHONY: help all test-clean test cov-clean cov docs clean \ |
| 27 |
distclean build build-clean man sphinx sphinx-clean |
| 28 |
|
| 29 |
help: |
| 30 |
@echo "Please use 'make <target>' where target is one of:" |
| 31 |
@echo " help to show this help message." |
| 32 |
@echo " " |
| 33 |
@echo " test to run the tests." |
| 34 |
@echo " cov to check test 'coverage'." |
| 35 |
@echo " " |
| 36 |
@echo " build build create a build dist 'python3 setup.py'." |
| 37 |
@echo " docs build the docs with 'sphinx'." |
| 38 |
@echo " html build only html pages" |
| 39 |
@echo " man build only manpages" |
| 40 |
@echo " " |
| 41 |
@echo " clean clean generates files." |
| 42 |
@echo " distclean clean all generates files." |
| 43 |
|
| 44 |
|
| 45 |
all: help |
| 46 |
|
| 47 |
# -------------------------------------------------------------------- # |
| 48 |
test-clean: |
| 49 |
rm -fr .pytest_cache |
| 50 |
rm -fr .cache |
| 51 |
|
| 52 |
test: |
| 53 |
@$(TEST) |
| 54 |
|
| 55 |
cov-clean: |
| 56 |
@$(COVREP) erase | true |
| 57 |
rm -f .coverage |
| 58 |
rm -fr $(COVDIR) |
| 59 |
|
| 60 |
cov: cov-clean |
| 61 |
@$(COV) |
| 62 |
@$(COVREP) html --directory $(COVDIR) |
| 63 |
|
| 64 |
# -------------------------------------------------------------------- # |
| 65 |
build-clean: |
| 66 |
python3 setup.py clean |
| 67 |
rm -fr build/build |
| 68 |
rm -fr .eggs |
| 69 |
|
| 70 |
build: |
| 71 |
python3 setup.py build -b build/build -t build/tmp |
| 72 |
python3 setup.py sdist -d build/dist --formats=bztar,zip |
| 73 |
python3 setup.py bdist -d build/dist |
| 74 |
python3 setup.py bdist_egg -d build/dist |
| 75 |
python3 setup.py bdist_wheel -d build/dist |
| 76 |
rm -fr isbg.egg-info |
| 77 |
rm -fr build/lib.* |
| 78 |
rm -fr build/bdist.* |
| 79 |
mv -f dist/* build/dist |
| 80 |
rmdir dist |
| 81 |
@echo " " |
| 82 |
@echo " See build/build for generated build files." |
| 83 |
@echo " See build/dist for generated dist files." |
| 84 |
|
| 85 |
# -------------------------------------------------------------------- # |
| 86 |
sphinx-clean: |
| 87 |
rm -fr build.sphinx |
| 88 |
|
| 89 |
sphinx: |
| 90 |
mkdir -p build.sphinx |
| 91 |
cp -fr docs/* build.sphinx |
| 92 |
# $(MAKE) -C build.sphinx apidoc # It's called from sphinx |
| 93 |
|
| 94 |
html: sphinx |
| 95 |
$(MAKE) -C build.sphinx html |
| 96 |
|
| 97 |
man: sphinx |
| 98 |
$(MAKE) -C build.sphinx man |
| 99 |
|
| 100 |
docs-clean: sphinx-clean |
| 101 |
$(MAKE) -C docs clean |
| 102 |
$(MAKE) -C docs clean-all |
| 103 |
|
| 104 |
docs: html man |
| 105 |
@echo " " |
| 106 |
@echo " See build/sphinx/html for generated html docs." |
| 107 |
@echo " See build/sphinx/man for generated manpages." |
| 108 |
|
| 109 |
# -------------------------------------------------------------------- # |
| 110 |
clean: test-clean sphinx-clean build-clean |
| 111 |
find . -name '*.pyc' -exec rm -f {} + |
| 112 |
rm -fr isbg/__pycache__ |
| 113 |
rm -fr tests/__pycache__ |
| 114 |
|
| 115 |
distclean: clean cov-clean docs-clean |
| 116 |
$(MAKE) -C docs clean-all |
| 117 |
rm -fr build |
| 118 |
rm -fr dist |
| 119 |
rm -fr sdist |
| 120 |
rm -fr isbg.egg-info |
| 121 |
rm -f installed_files.txt |