summaryrefslogtreecommitdiff
path: root/doc/manual/Makefile.am
blob: ea885fb17c8fe00695813924716f00aaaa09ea81 (plain)
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
89
90
91
92
93
94
95
96
97
98
99
NULL =

BOOK_NAME = vala@PACKAGE_SUFFIX@

bookdir = $(datadir)/devhelp/books/$(BOOK_NAME)

if HAVE_XSLTPROC
book_DATA = \
	devhelp/* \
	$(NULL)
endif

$(builddir)/devhelp/*: devhelp
devhelp: manual.xml version.xml common.xsl devhelp.xsl xhtml.xsl default.css
	@$(MKDIR_P) $@
	$(AM_V_GEN)$(XSLTPROC) \
		--xinclude \
		--path $(srcdir) \
		--output $@/$(BOOK_NAME).devhelp2 \
		$(srcdir)/devhelp.xsl \
		$(srcdir)/manual.xml
	@$(XSLTPROC) \
		--xinclude \
		--path $(srcdir) \
		--output $@/index.html \
		$(srcdir)/xhtml.xsl \
		$(srcdir)/manual.xml
	@cp $(srcdir)/default.css $@
	@touch $@

html: manual.xml version.xml common.xsl xhtml.xsl default.css
	@$(MKDIR_P) $@
	$(AM_V_GEN)$(XSLTPROC) \
		--xinclude \
		--stringparam body-class u-center \
		--output $@/index.html \
		$(srcdir)/xhtml.xsl \
		$(srcdir)/manual.xml
	@cp $(srcdir)/default.css $@
	@touch $@

print: manual.html
manual.html: manual.xml version.xml common.xsl print.xsl default.css
	$(AM_V_GEN)$(XSLTPROC) \
		--xinclude \
		--path $(srcdir) \
		--output $@ \
		$(srcdir)/print.xsl \
		$(srcdir)/manual.xml

if HAVE_WEASYPRINT
pdf: manual.pdf
manual.pdf: manual.html default.css
	@echo Generating PDF version of manual, this may take some time...
	$(AM_V_GEN)$(WEASYPRINT) \
		manual.html \
		$@
else
pdf:
	@echo Install weasyprint and re-run ./configure to generate a PDF of the Vala manual
endif

mostlyclean-local:
	rm -rf devhelp
	rm -rf html

CLEANFILES = \
	manual.html \
	manual.pdf \
	version.xml \
	$(NULL)

EXTRA_DIST = \
	common.xsl \
	default.css \
	devhelp.xsl \
	manual.xml \
	print.xsl \
	xhtml.xsl \
	README \
	$(NULL)

MANUAL_DOCBOOK_URL=https://wiki.gnome.org/Projects/Vala/Manual/Export?action=format\&mimetype=text/docbook

$(srcdir)/manual.xml:
	@echo "Generating $@ from $(MANUAL_DOCBOOK_URL)"
	@curl --silent $(MANUAL_DOCBOOK_URL) | \
		sed -e 's/<articleinfo>.*<\/articleinfo>//g' | \
		sed -e 's/<section>/\n\n<section>/g' | \
		sed -e 's/<\/section>/\n<\/section>/g' | \
		sed -e 's/<title>/\n<title>/g' | \
		sed -e 's/<para>/\n<para>/g' \
		> $@

update-manual-from-wiki:
	@rm $(srcdir)/manual.xml
	$(MAKE) $(AM_MAKEFLAGS) manual.xml
	$(MAKE) $(AM_MAKEFLAGS)