2
2
# Doc variables and rules
3
3
# #####################################################################
4
4
5
- doc/version.md : $(MKFILE_DEPS ) rust.md
6
- @$(call E, version-stamp: $@ )
7
- $(Q ) echo " $( CFG_VERSION) " >> $@
5
+ DOCS :=
8
6
9
- doc/keywords.md : $(MKFILE_DEPS ) rust.md
10
- @$(call E, grep -v: $$@ )
11
- $(Q ) grep -v ' ^#' $< > $@
12
7
13
- ifdef CFG_PANDOC
8
+ # #####################################################################
9
+ # Pandoc (reference-manual related)
10
+ # #####################################################################
11
+ ifeq ($(CFG_PANDOC ) ,)
12
+ $(info cfg : no pandoc found, omitting doc/rust.pdf)
13
+ else
14
14
15
+ DOCS += doc/rust.html
15
16
doc/rust.html : rust.md doc/version.md doc/keywords.md
16
17
@$(call E, pandoc: $@ )
17
18
$(Q )$(CFG_PANDOC ) \
@@ -26,8 +27,17 @@ doc/rust.html: rust.md doc/version.md doc/keywords.md
26
27
-$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null
27
28
28
29
29
- ifdef CFG_PDFLATEX
30
+ ifeq ($(CFG_PDFLATEX),)
31
+ $(info cfg : no pdflatex found, omitting doc/rust.pdf)
32
+ else
33
+ ifeq ($(CFG_XETEX),)
34
+ $(info cfg : no xetex found, disabling doc/rust.pdf)
35
+ else
36
+ ifeq ($(CFG_LUATEX),)
37
+ $(info cfg : lacking luatex, disabling pdflatex)
38
+ else
30
39
40
+ DOCS += doc/rust.pdf
31
41
doc/rust.tex : rust.md doc/version.md doc/keywords.md
32
42
@$(call E, pandoc: $@ )
33
43
$(Q )$(CFG_PANDOC ) \
@@ -44,13 +54,39 @@ doc/rust.pdf: doc/rust.tex
44
54
-output-directory=doc \
45
55
$<
46
56
57
+ endif
58
+ endif
59
+ endif
47
60
endif
48
61
62
+
63
+ # #####################################################################
64
+ # LLnextgen (grammar analysis from refman)
65
+ # #####################################################################
66
+ ifeq ($(CFG_LLNEXTGEN ) ,)
67
+ $(info cfg : no llnextgen found, omitting grammar-verification)
68
+ else
69
+ .PHONY : verify-grammar
70
+
71
+ doc/rust.g : rust.md $(S ) src/etc/extract_grammar.py
72
+ @$(call E, extract_grammar: $@ )
73
+ $(Q )$(S ) src/etc/extract_grammar.py $< > $@
74
+
75
+ verify-grammar : doc/rust.g
76
+ @$(call E, LLnextgen: $< )
77
+ $(Q )$(CFG_LLNEXTGEN ) --generate-lexer-wrapper=no $< > $@
78
+ $(Q ) rm -f doc/rust.c doc/rust.h
49
79
endif
50
80
51
81
52
- ifdef CFG_NODE
82
+ # #####################################################################
83
+ # Node (tutorial related)
84
+ # #####################################################################
85
+ ifeq ($(CFG_NODE ) ,)
86
+ $(info cfg : no node found, omitting doc/tutorial/web)
87
+ else
53
88
89
+ DOCS += doc/tutorial/web/index.html
54
90
doc/tutorial/web/index.html : \
55
91
$(wildcard $(S)doc/tutorial/*.md)
56
92
@$(call E, cp: $(S)doc/tutorial)
@@ -61,23 +97,14 @@ doc/tutorial/web/index.html: \
61
97
endif
62
98
63
99
64
- ifdef CFG_LLNEXTGEN
65
- doc/rust.g : rust.md $(S ) src/etc/extract_grammar.py
66
- @$(call E, extract_grammar: $@ )
67
- $(Q )$(S ) src/etc/extract_grammar.py $< > $@
68
100
69
- verify-grammar : doc/rust.g
70
- @$(call E, LLnextgen: $< )
71
- $(Q )$(CFG_LLNEXTGEN ) --generate-lexer-wrapper=no $< > $@
72
- $(Q ) rm -f doc/rust.c doc/rust.h
73
- endif
74
-
75
-
76
- GENERATED += doc/keywords.md doc/version.md
101
+ # #####################################################################
102
+ # Naturaldocs (library reference related)
103
+ # #####################################################################
77
104
78
- docsnap : doc/rust.pdf
79
- @ $( call E, snap: doc/rust- $( shell date +" % Y- % m- % d") -snap.pdf )
80
- $( Q ) mv $< doc/rust- $( shell date +" % Y- % m- % d") -snap.pdf
105
+ ifeq ( $( CFG_NATURALDOCS ) ,)
106
+ $( info cfg : no naturaldocs found, omitting library doc build )
107
+ else
81
108
82
109
define libdoc
83
110
doc/$(1 ) /index.html: nd/$(1 ) /Languages.txt nd/$(1 ) /Topics.txt \
@@ -103,10 +130,27 @@ GENERATED += nd/$(1)/Languages.txt \
103
130
nd/$(1 ) /Data
104
131
105
132
DOCS += doc/$(1 ) /index.html nd/$(1 ) /lib.css
106
-
107
133
endef
108
134
109
135
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
110
136
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))
137
+ endif
138
+
139
+
140
+ ifdef CFG_DISABLE_DOCS
141
+ $(info cfg : disabling doc build (CFG_DISABLE_DOCS))
142
+ DOCS :=
143
+ endif
144
+
145
+
146
+ doc/version.md : $(MKFILE_DEPS ) rust.md
147
+ @$(call E, version-stamp: $@ )
148
+ $(Q ) echo " $( CFG_VERSION) " >> $@
149
+
150
+ doc/keywords.md : $(MKFILE_DEPS ) rust.md
151
+ @$(call E, grep -v: $$@ )
152
+ $(Q ) grep -v ' ^#' $< > $@
153
+
154
+ GENERATED += doc/keywords.md doc/version.md
111
155
112
156
docs : $(DOCS )
0 commit comments