blob: 12849462c9a0c46c38aa7ae0b580c4ea015815ab (
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
ROOTDIR = ../..
include $(ROOTDIR)/Makefile.common
TEXQUOTE = $(ROOTDIR)/runtime/ocamlrun ../tools/texquote2
DIRS = infoman texstuff textman
FILES = allfiles.tex biblio.tex foreword.tex version.tex cmds/warnings-help.etex ifocamldoc.tex
TEXINPUTS = ".:..:../refman:../refman/extensions:../library:../cmds:../tutorials:../../styles:"
RELEASE = $$HOME/release/$${RELEASENAME}
HEVEA = hevea
HACHA = hacha
# We suppress warnings in info and text mode (with -s) because hevea listings emit
# DIV blocks that the text modes do not know how to interpret.
INFO_FLAGS = -fix -exec xxdate.exe -info -w 79 -s
HTML_FLAGS = -fix -exec xxdate.exe -O
TEXT_FLAGS = -fix -exec xxdate.exe -text -w 79 -s
# Copy the documentation files from ROOTDIR/api_docgen
APIDOC=$(ROOTDIR)/api_docgen
.PHONY: html_files
.PHONY: latex_files
ifeq ($(DOCUMENTATION_TOOL),odoc)
latex_files:
make -C $(APIDOC) latex
cp $(APIDOC)/odoc/build/latex/*/*.tex library
html_files:
make -C $(APIDOC) html
cp -r $(APIDOC)/odoc/build/html/* htmlman
ifocamldoc.tex: $(ROOTDIR)/Makefile.build_config
$(MAKE) -C $(APIDOC)/odoc build/latex/ifocamldoc.tex
cp $(APIDOC)/odoc/build/latex/ifocamldoc.tex $@
else
latex_files:
$(MAKE) -C $(APIDOC) latex
cp $(APIDOC)/ocamldoc/build/latex/*.tex library
html_files:
$(MAKE) -C $(APIDOC) html
mkdir -p htmlman/libref
cp -r $(APIDOC)/ocamldoc/build/html/libref htmlman
cp -r $(APIDOC)/ocamldoc/build/html/compilerlibref htmlman
cp style.css htmlman/libref
cp style.css htmlman/compilerlibref
ifocamldoc.tex: $(ROOTDIR)/Makefile.build_config
$(MAKE) -C $(APIDOC)/ocamldoc build/latex/ifocamldoc.tex
cp $(APIDOC)/ocamldoc/build/latex/ifocamldoc.tex $@
endif
$(DIRS):
$(MKDIR) $@
pdf: files latex_files | texstuff
cd texstuff \
&& TEXINPUTS=$(TEXINPUTS) pdflatex manual.tex
index: | texstuff
cd texstuff \
&& sh ../../tools/fix_index.sh manual.idx \
&& makeindex manual.idx \
&& makeindex manual.kwd.idx
# libref/style.css and comilerlibref/style.css are used as witness
# for the generation of the html stdlib and compilerlibs reference.
html: etex-files html_files
cd htmlman \
&& $(HEVEA) $(HTML_FLAGS) \
-I .. -I ../cmds -I ../library -I ../refman \
-I ../refman/extensions -I ../tutorials \
-I ../../styles -I ../texstuff \
manual.hva -e macros.tex ../manual.tex \
&& $(HACHA) -tocter manual.html
info: files latex_files | infoman
cd infoman \
&& rm -f ocaml.info* \
&& $(HEVEA) $(INFO_FLAGS) -o ocaml.info.body \
-I .. -I ../cmds -I ../library -I ../refman \
-I ../refman/extensions -I ../tutorials \
-I ../../styles -I ../texstuff \
../manual.inf -e macros.tex ../manual.tex
cat manual.info.header infoman/ocaml.info.body > infoman/ocaml.info
cd infoman \
&& rm -f ocaml.info.tmp ocaml.info.body \
&& gzip -9 ocaml.info*
text: files latex_files | textman
cd textman \
&& $(HEVEA) $(TEXT_FLAGS) \
-I .. -I ../cmds -I ../library -I ../refman \
-I ../refman/extensions -I ../tutorials \
-I ../../styles -I ../texstuff \
../manual.inf -e macros.tex ../manual.tex
.PHONY: all
all:
$(MAKE) html
$(MAKE) text
$(MAKE) info
$(MAKE) pdf
$(MAKE) index
$(MAKE) pdf
release: all
cp htmlman/manual.html $(RELEASE)refman.html
rm -f htmlman/manual.{html,haux,hmanual*,htoc}
tar zcf $(RELEASE)refman-html.tar.gz \
htmlman/*.* htmlman/libref htmlman/compilerlibref htmlman/fonts
zip -8 $(RELEASE)refman-html.zip \
htmlman/*.* htmlman/libref/*.* htmlman/compilerlibref/*.* \
htmlman/fonts/*.*
cp texstuff/manual.pdf $(RELEASE)refman.pdf
cp textman/manual.txt $(RELEASE)refman.txt
tar cf - infoman/ocaml.info* | gzip > $(RELEASE)refman.info.tar.gz
web: html
$(MAKE) -C html_processing all
files: $(FILES)
$(MAKE) -C cmds all
$(MAKE) -C library all
$(MAKE) -C refman all
$(MAKE) -C tutorials all
etex-files: $(FILES)
$(MAKE) -C cmds etex-files
$(MAKE) -C library etex-files
$(MAKE) -C refman etex-files
$(MAKE) -C tutorials etex-files
%.tex: %.etex
$(TEXQUOTE) < $< > $*.texquote_error.tex
mv $*.texquote_error.tex $@
cmds/warnings-help.etex: $(ROOTDIR)/utils/warnings.ml $(ROOTDIR)/ocamlc
(echo "% This file is generated from (ocamlc -warn-help)";\
echo "% according to a rule in manual/src/Makefile.";\
echo "% In particular, the reference to documentation sections";\
echo "% are inserted through the Makefile, which should be updated";\
echo "% when a new warning is documented.";\
echo "%";\
$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/ocamlc -warn-help \
| LC_ALL=C sed -e 's/^ *\([0-9][0-9]*\) *\[\([a-z][a-z-]*\)\]\(.*\)/\\item[\1 "\2"] \3/' \
-e 's/^ *\([0-9A-Z][0-9]*\) *\([^]].*\)/\\item[\1] \2/'\
| sed -e 's/@/\\@/g' \
) >$@
# sed --inplace is not portable, emulate
for i in 52 57; do\
sed\
s'/\\item\[\('$$i'[^]]*\)\]/\\item\[\1 (see \\ref{ss:warn'$$i'})\]/'\
$@ > $@.tmp;\
mv $@.tmp $@;\
done
.PHONY: clean
clean:
rm -f $(filter-out version.tex,$(FILES)) *.texquote_error
$(MAKE) -C cmds clean
$(MAKE) -C html_processing clean
$(MAKE) -C library clean
$(MAKE) -C refman clean
$(MAKE) -C tutorials clean
cd htmlman; rm -rf libref compilerlibref *.htoc *.html *.haux *.hind *.svg \
fonts/KaTeX* katex.min.css katex.min.js highlight.pack.js \
manual.hmanual manual.hmanual.kwd manual.css odoc.css
rm -rf $(DIRS)
.PHONY: distclean
distclean: clean
rm -f version.tex
$(MAKE) -C cmds distclean
$(MAKE) -C html_processing distclean
$(MAKE) -C library distclean
$(MAKE) -C refman distclean
$(MAKE) -C tutorials distclean
|