123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #! /usr/bin/make -f
- #
- # Copyright © 2015–2016 Ben Finney <ben+python@benfinney.id.au>
- # Part of ‘manpage’, a Python library for making Unix manual documents.
- #
- # This is free software: you may copy, modify, and/or distribute this work
- # under the terms of the GNU General Public License as published by the
- # Free Software Foundation; version 3 of that license or any later version.
- # No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
- # Makefile for ‘manpage’ code base.
- PACKAGE_NAMES = manpage
- PY_MODULE_SUFFIX = .py
- PY_MODULE_BYTECODE_SUFFIX = .pyc
- package_modules = $(foreach package,${PACKAGE_NAMES}, \
- $(shell find ${CURDIR}/${package}/ -name '*${PY_MODULE_SUFFIX}'))
- python_modules = $(shell find ${CURDIR}/ -name '*${PY_MODULE_SUFFIX}')
- TOX_DIR = .tox
- GENERATED_FILES :=
- GENERATED_FILES += ${CURDIR}/${TOX_DIR}
- GENERATED_FILES += $(patsubst \
- %${PY_MODULE_SUFFIX},%${PY_MODULE_BYTECODE_SUFFIX}, \
- ${python_modules})
- GENERATED_FILES += ${CURDIR}/*.egg-info
- GENERATED_FILES += ${CURDIR}/build ${CURDIR}/dist
- DISTUTILS_SCRIPT = ${CURDIR}/setup.py
- PYTHON ?= /usr/bin/python3
- PYTHON_OPTS ?= -tt -bb
- PYTHON_UNITTEST = $(PYTHON) ${DISTUTILS_SCRIPT} test
- UNITTEST_OPTS ?= --quiet
- PYTHON_COVERAGE = $(PYTHON) -m coverage
- COVERAGE_RUN_OPTS ?= --branch
- COVERAGE_REPORT_OPTS ?=
- COVERAGE_TEXT_REPORT_OPTS ?=
- COVERAGE_HTML_REPORT_OPTS ?=
- .PHONY: all
- all:
- .PHONY: clean
- clean:
- $(RM) -r ${GENERATED_FILES}
- .PHONY: tags
- tags: TAGS
- GENERATED_FILES += TAGS
- TAGS: ${python_modules}
- etags --output "$@" --lang=python ${python_modules}
- .PHONY: test
- test: test-unittest
- .PHONY: test-unittest
- test-unittest:
- $(PYTHON_UNITTEST) ${UNITTEST_OPTS}
- .PHONY: test-coverage
- test-coverage: test-coverage-run test-coverage-html test-coverage-report
- GENERATED_FILES += .coverage
- .PHONY: test-coverage-run
- test-coverage-run: coverage_opts = ${COVERAGE_RUN_OPTS}
- test-coverage-run:
- $(PYTHON_COVERAGE) run ${coverage_opts} \
- ${DISTUTILS_SCRIPT} test ${UNITTEST_OPTS}
- GENERATED_FILES += htmlcov/
- .PHONY: test-coverage-html
- test-coverage-html: coverage_opts = ${COVERAGE_REPORT_OPTS}
- test-coverage-html: coverage_opts += ${COVERAGE_HTML_REPORT_OPTS}
- test-coverage-html:
- $(PYTHON_COVERAGE) html ${coverage_opts} ${package_modules}
- .PHONY: test-coverage-report
- test-coverage-report: coverage_opts = ${COVERAGE_REPORT_OPTS}
- test-coverage-report: coverage_opts += ${COVERAGE_TEXT_REPORT_OPTS}
- test-coverage-report:
- $(PYTHON_COVERAGE) report ${coverage_opts} ${package_modules}
- # Local variables:
- # coding: utf-8
- # mode: make
- # End:
- # vim: fileencoding=utf-8 filetype=make :
|