File: Makefile

package info (click to toggle)
apt-listchanges 4.8%2Bnmu1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,340 kB
  • sloc: python: 3,477; xml: 693; makefile: 167; sh: 71; perl: 61
file content (84 lines) | stat: -rw-r--r-- 2,753 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# vim:set ts=2:noet:
include ../common.mk
bdir=generated

.PHONY: all install clean

all: $(bdir)/manpages.stamp

install:: $(bdir)/manpages.stamp
	for man in $(bdir)/apt-listchanges*.1; do \
		test -s "$$f"; \
		lang=`echo $$man | sed -e 's/^.*apt-listchanges\.*// ; s/\.*1//'`; \
		install -d $(DESTDIR)/usr/share/man/$$lang/man1;                \
		install -m 644 $$man $(DESTDIR)/usr/share/man/$$lang/man1/apt-listchanges.1; \
	done

install:: $(bdir)/what_to_display.html
	mkdir -p $(DESTDIR)/usr/share/doc/apt-listchanges
	install -m 444 $< $(DESTDIR)/usr/share/doc/apt-listchanges/

$(bdir)/what_to_display.html: design_notes/what_to_display.md
	rm -f $@.tmp
	markdown $< > $@.tmp
	mv $@.tmp $@

clean:
	rm -rf $(bdir) mantmp

PO4A := PERL_HASH_SEED=0 PERL_PERTURB_KEYS=0 po4a $(XGETTEXT_COMMON_OPTIONS) --previous

# params: input output

# Note that the output file name passed into this function needs to match the
# output file name determined automatically by xsltproc.
#
# We are creating the output file in a temporary directory and then
# transforming it into its final location with a sed command because there is
# a bug in the DocBook XSL stylesheets which cause the apostrophes in section
# headers to be turned into invalid macros. First, the stylesheet converts the
# apostrophe into \*(Aq, which is a valid macro, but then it upper-cases the
# entire header, turning the macro into \*(AQ, which is invalid. See
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082554.
define xml2man
	set -- xmllint --valid --noout --noent --nonet "$(1)"; \
	echo "$$@"; \
	"$$@"; \
	lang="`echo "$(1)" | sed -e 's/^.*apt-listchanges//; s/\.xml$$// ;s/^\.//'`"; \
	[ "$$lang" ] && langparam="--stringparam l10n.gentext.default.language $$lang" || langparam=""; \
	set -- xsltproc --nonet --xinclude \
						$$langparam \
						--stringparam man.authors.section.enabled 0 \
						--stringparam man.output.lang.in.name.enabled 1 \
						--stringparam man.charmap.enabled 0 \
						--stringparam man.hyphenate 0 \
						--stringparam man.justify 0 \
						--output "mantmp/" \
					/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
					"$(1)"; \
	echo "$$@"; \
	"$$@"; \
	sed -e 's/\\\*(AQ/\\*(Aq/g' < "mantmp/$(2)" > "$(bdir)/$(2).tmp"; \
	mv "$(bdir)/$(2).tmp" "$(bdir)/$(2)"; \
	rm -f "mantmp/$(2)"; \
	echo
endef


update-po:
	$(PO4A) --force -v po4a.cfg

$(bdir)/po4a.stamp:  apt-listchanges.xml po/*.po po/*.add po4a.cfg
	$(PO4A)  -v po4a.cfg
	touch "$@"

$(bdir)/manpages.stamp: $(bdir)/po4a.stamp
	mkdir -p mantmp
	@ set -e; \
	for f in apt-listchanges.xml $(bdir)/apt-listchanges.*.xml; do \
		test -f "$$f" || continue; \
		g="`basename $$f .xml`.1"; \
		$(call xml2man,$$f,$$g) ;  \
	done
	rm -rf mantmp
	touch "$@"