Use built-in “.INTERMEDIATE” target to declare intermediate build products.
[debian_xkcdpass.git] / debian / rules
blob8e17fc0f9cdd1033438057ac9fc1aa2ee62f345b
1 #! /usr/bin/make -f
3 # debian/rules
4 # Part of Debian ‘xkcdpass’ package.
6 # Copyright © 2010–2015 Ben Finney <ben+debian@benfinney.id.au>
7 # This is free software; you may copy, modify and/or distribute this work
8 # under the terms of the BSD 3-clause license.
9 # No warranty expressed or implied.
10 # See the file ‘xkcdpass/xkcd_password.py’ for details.
12 DOCUMENTATION_DIR = debian
13 MANPAGE_SUFFIX = .1
14 TEMPFILE_SUFFIX = .tmp
15 manpage_names = xkcdpass
16 .INTERMEDIATE: ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX}${TEMPFILE_SUFFIX}
18 manpage_paths = $(addprefix ${DOCUMENTATION_DIR}/,${manpage_names})
19 manpages = $(addsuffix ${MANPAGE_SUFFIX},${manpage_paths})
20 GENERATED_FILES += ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX}
22 INSTALL = install
24 # Send HTTP traffic to the “discard” service during packaging actions.
25 export http_proxy = http://127.0.1.1:9/
26 export https_proxy = ${http_proxy}
28 RST_SUFFIX = .txt
30 RST2MAN = rst2man
33 .PHONY: build
34 build: build-arch build-indep
35 build: ${manpages}
36 dh $@ --with python3 --buildsystem=pybuild
38 .PHONY: build-arch
39 build-arch:
40 dh $@ --with python3 --buildsystem=pybuild
42 .PHONY: build-indep
43 build-indep:
44 dh $@ --with python3 --buildsystem=pybuild
47 %.1: %.1${RST_SUFFIX}
48 $(RST2MAN) $< > $@${TEMPFILE_SUFFIX}
49 cat debian/manpage_encoding_declaration.UTF-8 $@${TEMPFILE_SUFFIX} > $@
52 .PHONY: clean
53 clean:
54 dh $@ --with python3 --buildsystem=pybuild
56 .PHONY: override_dh_auto_clean
57 override_dh_auto_clean:
58 dh_auto_clean
59 $(RM) -r ${GENERATED_FILES}
62 .PHONY: get-packaged-orig-source
63 get-packaged-orig-source:
64 $(uscan-download-source) --download-current-version
66 # Policy §4.9 strongly recommends the ‘get-orig-source’ target:
67 # “This target is optional, but providing it if possible is a good idea.”
69 # This target is an anomaly: per Policy §4.9, it fetches the *latest*
70 # upstream source, regardless of this package's version. To fetch the
71 # upstream source corresponding to this package's *declared* version
72 # in ‘debian/changelog’, use ‘get-packaged-orig-source’ instead.
73 .PHONY: get-orig-source
74 get-orig-source:
75 $(uscan-download-source)
77 get-orig-source get-packaged-orig-source: http_proxy =
78 get-orig-source get-packaged-orig-source: makefile_dir = $(abspath $(dir $(firstword ${MAKEFILE_LIST})))
79 get-orig-source get-packaged-orig-source: package_dir = $(abspath $(dir ${makefile_dir}))
81 define uscan-download-source
82 uscan --noconf --verbose \
83 --force-download \
84 --rename \
85 --destdir=$(CURDIR) \
86 --check-dirname-level=0 ${package_dir}
87 endef # uscan-download-source
90 .PHONY: install
91 install: build
92 dh $@ --with python3 --buildsystem=pybuild
95 .PHONY: binary-indep
96 binary-indep: build install
97 dh $@ --with python3 --buildsystem=pybuild
99 .PHONY: binary-arch
100 binary-arch: build install
102 .PHONY: binary
103 binary: build binary-indep binary-arch
106 # Local variables:
107 # mode: makefile
108 # coding: utf-8
109 # End:
110 # vim: filetype=make fileencoding=utf-8 :