about summary refs log tree commit diff
path: root/doc/manual/Makefile.am
blob: 42da3c8b0c09e073b649b191dd7c28886c920e99 (plain) (blame)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
XMLLINT = $(xmllint) --nonet $(xmlflags)
XSLTPROC = $(xsltproc) --nonet $(xmlflags) \
 --param section.autolabel 1 \
 --param section.label.includes.component.label 1 \
 --param html.stylesheet \'style.css\' \
 --param xref.with.number.and.title 1 \
 --param toc.section.depth 3 \
 --param admon.style \'\' \
 --param callout.graphics.extension \'.gif\' \
 --param contrib.inline.enabled 0

dblatex_opts = \
 -P doc.collab.show=0 \
 -P latex.output.revhistory=0

# Note: we use GIF for now, since the PNGs shipped with Docbook aren't
# transparent.

man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \
 nix-collect-garbage.1 nix-push.1 nix-pull.1 \
 nix-prefetch-url.1 nix-channel.1 \
 nix-install-package.1 nix-hash.1 nix-copy-closure.1

man5_MANS = nix.conf.5

man8_MANS = nix-worker.8

FIGURES = figures/user-environments.png

MANUAL_SRCS = manual.xml introduction.xml installation.xml \
 package-management.xml writing-nix-expressions.xml builtins.xml \
 build-farm.xml \
 $(man1_MANS:.1=.xml) $(man8_MANS:.8=.xml) \
 troubleshooting.xml bugs.xml opt-common.xml opt-common-syn.xml opt-inst-syn.xml \
 env-common.xml quick-start.xml nix-lang-ref.xml glossary.xml \
 conf-file.xml release-notes.xml \
 style.css images

# Do XInclude processing.
manual.xmli: $(MANUAL_SRCS) version.txt
	$(XMLLINT) --xinclude $< -o $@.tmp
	mv $@.tmp $@

# Note: RelaxNG validation requires xmllint >= 2.7.4.
manual.is-valid: manual.xmli
	$(XSLTPROC) --novalid --stringparam profile.condition manual \
	  $(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \
	  $(XMLLINT) --noout --relaxng $(docbookrng)/docbook.rng -
	touch $@

version.txt:
	echo -n $(VERSION) > version.txt

man $(MANS): manual.is-valid
	$(XSLTPROC) --stringparam profile.condition manpage \
	  $(docbookxsl)/profiling/profile.xsl manual.xmli 2> /dev/null | \
	  $(XSLTPROC) $(docbookxsl)/manpages/docbook.xsl -

manual.html: $(MANUAL_SRCS) manual.is-valid images
	$(XSLTPROC) --xinclude --stringparam profile.condition manual \
	  $(docbookxsl)/profiling/profile.xsl manual.xml | \
	  $(XSLTPROC) --output manual.html $(docbookxsl)/html/docbook.xsl -

manual.pdf: $(MANUAL_SRCS) manual.is-valid images
	if test "$(dblatex)" != ""; then \
		$(XSLTPROC) --xinclude --stringparam profile.condition manual \
		  $(docbookxsl)/profiling/profile.xsl manual.xml | \
		  $(dblatex) -o manual.pdf $(dblatex_opts) -; \
	else \
		echo "Please install dblatex and rerun configure."; \
		exit 1; \
	fi


NEWS_OPTS = \
 --stringparam generate.toc "article nop" \
 --stringparam section.autolabel.max.depth 0 \
 --stringparam header.rule 0

NEWS.html: release-notes.xml
	$(XSLTPROC) --xinclude --output $@ $(NEWS_OPTS) \
	  $(docbookxsl)/html/docbook.xsl release-notes.xml

NEWS.txt: release-notes.xml
	$(XSLTPROC) --xinclude quote-literals.xsl release-notes.xml | \
	  $(XSLTPROC) --output $@.tmp.html $(NEWS_OPTS) \
	  $(docbookxsl)/html/docbook.xsl -
	LANG=en_US $(w3m) -dump $@.tmp.html > $@
	rm $@.tmp.html


all-local: manual.html NEWS.html NEWS.txt

install-data-local: manual.html
	$(INSTALL) -d $(DESTDIR)$(docdir)/manual
	$(INSTALL_DATA) manual.html $(DESTDIR)$(docdir)/manual
	ln -sf manual.html $(DESTDIR)$(docdir)/manual/index.html
	$(INSTALL_DATA) style.css $(DESTDIR)$(docdir)/manual
	cp -r images $(DESTDIR)$(docdir)/manual/images
	$(INSTALL) -d $(DESTDIR)$(docdir)/manual/figures
	$(INSTALL_DATA) $(FIGURES) $(DESTDIR)$(docdir)/manual/figures
	$(INSTALL) -d $(DESTDIR)$(docdir)/release-notes
	$(INSTALL_DATA) NEWS.html $(DESTDIR)$(docdir)/release-notes/index.html
	$(INSTALL_DATA) style.css $(DESTDIR)$(docdir)/release-notes/

images:
	mkdir images
#	cp $(docbookxsl)/images/*.gif images
	mkdir images/callouts
	cp $(docbookxsl)/images/callouts/*.gif images/callouts
	chmod -R +w images

KEEP = manual.html manual.xmli manual.is-valid version.txt $(MANS) NEWS.html NEWS.txt

EXTRA_DIST = $(MANUAL_SRCS) $(FIGURES) $(KEEP)

DISTCLEANFILES = $(KEEP)