Use descriptive name for the name of the hash algorithm.
[dput.git] / Makefile
blobb05bb3e4190b83e4d9280f334716626aef4909f2
1 #! /usr/bin/make -f
3 # Copyright © 2015 Ben Finney <ben+python@benfinney.id.au>
5 # This is free software: you may copy, modify, and/or distribute this work
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; version 3 of that license or any later version.
8 # No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
10 # Makefile for ‘dput’ code base.
12 PYTHON ?= /usr/bin/python2
14 UNITTEST2 = /usr/bin/unit2
16 PY_MODULE_SUFFIX = .py
17 PY_MODULE_BYTECODE_SUFFIX = .pyc
18 package_modules = $(shell find ${CURDIR}/dput/ -name '*${PY_MODULE_SUFFIX}')
19 python_modules = $(shell find ${CURDIR}/ -name '*${PY_MODULE_SUFFIX}')
21 GENERATED_FILES :=
22 GENERATED_FILES += $(patsubst \
23 %${PY_MODULE_SUFFIX},%${PY_MODULE_BYTECODE_SUFFIX}, \
24 ${python_modules})
25 GENERATED_FILES += ${CURDIR}/*.egg-info
26 GENERATED_FILES += ${CURDIR}/build ${CURDIR}/dist
28 UNITTEST_OPTS ?= --buffer
30 PYTHON_COVERAGE = $(PYTHON) -m coverage
31 COVERAGE_RUN_OPTS ?= --branch
32 COVERAGE_REPORT_OPTS ?=
33 COVERAGE_TEXT_REPORT_OPTS ?=
34 COVERAGE_HTML_REPORT_OPTS ?=
37 .PHONY: all
38 all:
41 .PHONY: clean
42 clean:
43 $(RM) -r ${GENERATED_FILES}
46 .PHONY: tags
47 tags: TAGS
49 GENERATED_FILES += TAGS
51 TAGS: ${python_modules}
52 etags --output "$@" --lang=python ${python_modules}
55 .PHONY: test
56 test: test-unittest
58 .PHONY: test-unittest
59 test-unittest:
60 $(PYTHON) -m unittest discover ${UNITTEST_OPTS}
62 .PHONY: test-coverage
63 test-coverage: test-coverage-run test-coverage-html test-coverage-report
65 GENERATED_FILES += .coverage
67 .PHONY: test-coverage-run
68 test-coverage-run: coverage_opts = ${COVERAGE_RUN_OPTS}
69 test-coverage-run:
70 $(PYTHON) -m coverage run ${coverage_opts} \
71 $(UNITTEST2) discover ${UNITTEST_OPTS}
73 GENERATED_FILES += htmlcov/
75 .PHONY: test-coverage-html
76 test-coverage-html: coverage_opts = ${COVERAGE_REPORT_OPTS} ${COVERAGE_HTML_REPORT_OPTS}
77 test-coverage-html:
78 $(PYTHON_COVERAGE) html ${coverage_opts} ${package_modules}
80 .PHONY: test-coverage-report
81 test-coverage-report: coverage_opts = ${COVERAGE_REPORT_OPTS} ${COVERAGE_TEXT_REPORT_OPTS}
82 test-coverage-report:
83 $(PYTHON_COVERAGE) report ${coverage_opts} ${package_modules}
86 # Local variables:
87 # coding: utf-8
88 # mode: make
89 # End:
90 # vim: fileencoding=utf-8 filetype=make :