| 1 |
#************************************************************************** |
| 2 |
#* * |
| 3 |
#* OCaml * |
| 4 |
#* * |
| 5 |
#* Florian Angeletti, projet Cambium, Inria Paris * |
| 6 |
#* * |
| 7 |
#* Copyright 2020 Institut National de Recherche en Informatique et * |
| 8 |
#* en Automatique. * |
| 9 |
#* * |
| 10 |
#* All rights reserved. This file is distributed under the terms of * |
| 11 |
#* the GNU Lesser General Public License version 2.1, with the * |
| 12 |
#* special exception on linking described in the file LICENSE. * |
| 13 |
#* * |
| 14 |
#************************************************************************** |
| 15 |
# Used by included Makefiles |
| 16 |
ROOTDIR = ../.. |
| 17 |
include ../Makefile.common |
| 18 |
vpath %.mli ../../stdlib $(DOC_COMPILERLIBS_DIRS) $(DOC_STDLIB_DIRS) |
| 19 |
|
| 20 |
|
| 21 |
man: build/man/Stdlib.3o |
| 22 |
latex: build/latex/Stdlib.tex |
| 23 |
html: \ |
| 24 |
build/html/libref/Stdlib.html \ |
| 25 |
build/html/compilerlibref/Compiler_libs.html |
| 26 |
texi: build/texi/stdlib.texi |
| 27 |
|
| 28 |
DOC_STDLIB_INCLUDES= $(addprefix -I , $(DOC_STDLIB_DIRS)) |
| 29 |
|
| 30 |
DOC_ALL_INCLUDES = \ |
| 31 |
$(DOC_STDLIB_INCLUDES) \ |
| 32 |
$(addprefix -I ,$(DOC_COMPILERLIBS_DIRS)) |
| 33 |
|
| 34 |
libref=$(stdlib_UNPREFIXED) $(otherlibref) |
| 35 |
|
| 36 |
ALL_MAN= $(ALL_DOC:%=build/man/%.3o) |
| 37 |
ALL_LATEX= $(ALL_DOC:%=build/latex/%.tex) |
| 38 |
|
| 39 |
build/latex/ifocamldoc.tex: | build/latex |
| 40 |
$(V_GEN)printf '\\newif\\ifocamldoc\\ocamldoctrue\n' > $@ |
| 41 |
|
| 42 |
$(libref:%=build/libref/%.odoc): build/libref/%.odoc: %.mli | build/libref |
| 43 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \ |
| 44 |
-pp \ |
| 45 |
"$(AWK) -v ocamldoc=true -f ../../stdlib/expand_module_aliases.awk" \ |
| 46 |
$(DOC_STDLIB_INCLUDES) -hide-warnings $< -dump $@ |
| 47 |
|
| 48 |
$(compilerlibref:%=build/compilerlibref/%.odoc):\ |
| 49 |
build/compilerlibref/%.odoc: %.mli | build/compilerlibref |
| 50 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -nostdlib -hide Stdlib \ |
| 51 |
$(DOC_ALL_INCLUDES) -hide-warnings $< -dump $@ |
| 52 |
|
| 53 |
$(compilerlibref_TEXT:%=build/compilerlibref/%.odoc):\ |
| 54 |
build/compilerlibref/%.odoc: build/%.mld | build/compilerlibref |
| 55 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -hide-warnings $(DOC_ALL_INCLUDES) -text $< -dump $@ |
| 56 |
|
| 57 |
$(libref_TEXT:%=build/libref/%.odoc):\ |
| 58 |
build/libref/%.odoc: build/%.mld | build/libref |
| 59 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -hide-warnings $(DOC_STDLIB_INCLUDES) -text $< -dump $@ |
| 60 |
|
| 61 |
ALL_COMPILED_DOC=$(ALL_DOC:%=build/%.odoc) |
| 62 |
build/man/Stdlib.3o: $(ALL_COMPILED_DOC) | build/man |
| 63 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -man -d build/man -man-mini \ |
| 64 |
-nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \ |
| 65 |
$(addprefix -load , $(ALL_COMPILED_DOC)) |
| 66 |
|
| 67 |
HTML_OPTIONS= -charset="utf8" -colorize-code -nonavbar |
| 68 |
|
| 69 |
build/html/libref/Stdlib.html: $(ALL_LIBREF:%=build/%.odoc) | build/html/libref |
| 70 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -html -d build/html/libref \ |
| 71 |
$(HTML_OPTIONS) \ |
| 72 |
-nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \ |
| 73 |
$(addprefix -load , $(ALL_LIBREF:%=build/%.odoc)) |
| 74 |
|
| 75 |
build/html/compilerlibref/Compiler_libs.html: \ |
| 76 |
$(ALL_COMPILERLIBREF:%=build/%.odoc) | build/html/compilerlibref |
| 77 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -html -d build/html/compilerlibref \ |
| 78 |
-nostdlib -hide Stdlib -t "OCaml compiler library" \ |
| 79 |
$(HTML_OPTIONS) \ |
| 80 |
-intro build/Compiler_libs.mld \ |
| 81 |
$(addprefix -load , $(ALL_COMPILERLIBREF:%=build/%.odoc)) |
| 82 |
|
| 83 |
build/texi/stdlib.texi: $(ALL_COMPILED_DOC) | build/texi |
| 84 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -texi -o $@ \ |
| 85 |
-nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \ |
| 86 |
$(addprefix -load , $(ALL_COMPILED_DOC)) |
| 87 |
|
| 88 |
build/latex/Stdlib.tex: $(ALL_COMPILED_DOC) | build/latex |
| 89 |
$(V_OCAMLDOC)$(OCAMLDOC_RUN) -latex -o build/latex/all.tex \ |
| 90 |
-hide Stdlib -lib Stdlib $(DOC_ALL_INCLUDES) \ |
| 91 |
-sepfiles \ |
| 92 |
-latex-escape-underscore "false" \ |
| 93 |
-latextitle "1,subsection*" \ |
| 94 |
-latextitle "2,subsubsection*" \ |
| 95 |
-latex-type-prefix "TYP" \ |
| 96 |
-latex-module-prefix "" \ |
| 97 |
-latex-module-type-prefix "" \ |
| 98 |
-latex-value-prefix "" \ |
| 99 |
-nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \ |
| 100 |
$(addprefix -load , $(ALL_COMPILED_DOC)) |
| 101 |
|
| 102 |
build/latex/alldoc.pdf: build/latex/Stdlib.tex build/latex/alldoc.tex \ |
| 103 |
| build/latex |
| 104 |
cd build/latex && \ |
| 105 |
TEXINPUTS=$${TEXINPUTS}:../../ocamldoc pdflatex alldoc |
| 106 |
cd build/latex && \ |
| 107 |
TEXINPUTS=$${TEXINPUTS}:../../ocamldoc pdflatex alldoc |
| 108 |
|
| 109 |
stdlib_INPUT=$(foreach module,\ |
| 110 |
$(filter-out stdlib.mli camlinternal%,$(stdlib_UNPREFIXED)),\ |
| 111 |
\\input{$(call capitalize,$(module)).tex}\ |
| 112 |
) |
| 113 |
build/latex/stdlib_input.tex: | build/latex |
| 114 |
$(V_GEN)echo $(stdlib_INPUT) > $@ |
| 115 |
|
| 116 |
compilerlibs_INPUT=$(foreach module,\ |
| 117 |
$(filter-out camlinternal%,$(compilerlibref)),\ |
| 118 |
\\input{$(call capitalize,$(module)).tex}) |
| 119 |
build/latex/compilerlibs_input.tex: | build/latex |
| 120 |
$(V_GEN)echo $(compilerlibs_INPUT) > $@ |
| 121 |
|
| 122 |
.PHONY: install |
| 123 |
install: |
| 124 |
$(MKDIR) "$(INSTALL_LIBRARIES_MAN_DIR)" |
| 125 |
if test -d build/man; then \ |
| 126 |
$(INSTALL_DATA) build/man/*.3o "$(INSTALL_LIBRARIES_MAN_DIR)"; \ |
| 127 |
fi |