File: Makefile

package info (click to toggle)
diffoscope 240%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,036 kB
  • sloc: python: 16,298; sh: 113; makefile: 97; xml: 36; javascript: 2
file content (38 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/make -f
# This file is also present in reprotest, please update that as well if you
# make fixes here.

PACKAGE = diffoscope
VERSION = $$(cd .. && python3 setup.py -V)
SED_fix_package_quirks = -e 's,bin/diffoscope,diffoscope,g'
SED_fix_README_quirks = \
  -e '/^\.\. raw:: /d' \
  -e '/^\.\. image:: /d' \
  -e '/ :target: /d'

SED_rm_python_usage_msg = -e '/end_of_description_header/,/positional arguments/{d}'
SED_fix_rst2man_quirks = \
  -e 's,^ \\- ,,' \
  -e 's,^\[,\\[char91],g' \
  -e 's,\.TH *"" "" "",,g'
SED_rst2man_output_to_h2m_input = \
  -e 's,\.SH \(.*\),[\1],g' \
  -e 's,\[$(PACKAGE)\],[DESCRIPTION],gi'

all: $(PACKAGE).1

$(PACKAGE).1: $(PACKAGE).h2m ../$(PACKAGE)/__init__.py
	help2man --version-string=$(VERSION) ../bin/$(PACKAGE) -N --include="$<" | \
	  sed $(SED_rm_python_usage_msg) > "$@"

$(PACKAGE).h2m: $(PACKAGE).h2m.0 ../README.rst Makefile
	{ cat $(PACKAGE).h2m.0; cat ../README.rst | \
	  sed $(SED_fix_README_quirks) | tee out.txt | \
	  rst2man -q --no-doc-title | \
	  sed $(SED_fix_rst2man_quirks) \
	      $(SED_fix_package_quirks) \
	      $(SED_rst2man_output_to_h2m_input); } > "$@"

.PHONY: clean
clean:
	$(RM) $(PACKAGE).1 $(PACKAGE).h2m