File: Makefile

package info (click to toggle)
plinth 19.1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,292 kB
  • sloc: python: 22,066; xml: 12,007; sh: 568; javascript: 406; pascal: 74; makefile: 49; php: 11
file content (88 lines) | stat: -rw-r--r-- 2,979 bytes parent folder | download
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
85
86
87
88
#!/usr/bin/make -f
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
MANUAL_URL="https://wiki.debian.org/FreedomBox/Manual?action=show&mimetype=text%2Fdocbook"

OUTPUTS=freedombox-manual.pdf plinth.1 manual-pages

# In order to debug various problems with the documents especially
# intermediate LaTeX state, run make as follows:
#
#   $ make DEBUG=true
#   or
#   $ make DEBUG=true <target>
#
XMLTO_DEBUG_FLAGS=
ifneq ($(DEBUG),)
    XMLTO_DEBUG_FLAGS=--noclean -p '--debug'
endif

all: $(OUTPUTS)

# Do not edit the manual page in this directory.  The manual is
# maintained as separate pages on the FreedomBox wiki and aggregated
# into a single page using the MoinMoin include feature.  Then it is
# exported as Docbook format and kept here.
#
# It is important to keep a copy of the manual in this source tree
# because Debian packages promise an entire source tree including the
# documentation.
#
# Use 'make fetch' to retrieve the latest manual from the wiki and
# commit it to the repository.  The wiki page is already reviewed, so
# commits that update the manual just using the 'fetch' target do not
# require further reviews.
.PHONY: fetch
fetch:
	wget --quiet -O - $(MANUAL_URL) | \
	  xmllint --format --output freedombox-manual.raw.xml -
	xsltproc fetch-images.xslt freedombox-manual.raw.xml | sort -u | \
	  awk '{print "wget --quiet -O images/" $$1 " " $$2}' | sh
	./fetch-manual-pages

.PHONY: manual-pages
manual-pages-list:=$(shell cat manual-pages.list) freedombox-manual
manual-pages-part-html:=$(patsubst %, %.part.html, $(manual-pages-list))
manual-pages-html:=$(patsubst %, %.html, $(manual-pages-list))
manual-pages-xml:=$(patsubst %, %.xml, $(manual-pages-list))

manual-pages: $(manual-pages-part-html)

%.pdf: %.xml
	xmlto $(XMLTO_DEBUG_FLAGS) --with-dblatex pdf $<

%.part.html: %.html
	perl -pe 'BEGIN {undef $$/} s/.*<body[^>]*>(.*)<\/body\s*>.*/$$1/si' $< > $@

freedombox-manual.xml: freedombox-manual.raw.xml fixes.xslt
	xsltproc --output $@ fixes.xslt $<

%.xml: %.raw.xml manual-page-fixes.xslt
	xsltproc --output $@ manual-page-fixes.xslt $<
	./post-processor remove-footer $@
	./post-processor fix-wiki-urls $@

%.html: %.xml
	docbook2html --nochunks $<

%.1: %.xml
	xmlto man $<

.PHONY: clean
clean:
	rm -f $(manual-pages-html) $(manual-pages-part-html) $(manual-pages-xml)
	rm -f $(OUTPUTS)