1515DOCS :=
1616CDOCS :=
1717DOCS_L10N :=
18- HTML_DEPS :=
18+ HTML_DEPS := doc/
1919
2020BASE_DOC_OPTS := --standalone --toc --number-sections
2121HTML_OPTS = $(BASE_DOC_OPTS ) --to=html5 --section-divs --css=rust.css \
2222 --include-before-body=doc/version_info.html --include-in-header=doc/favicon.inc
2323TEX_OPTS = $(BASE_DOC_OPTS ) --include-before-body=doc/version.md --to=latex
2424EPUB_OPTS = $(BASE_DOC_OPTS ) --to=epub
2525
26+ D := $(S ) src/doc
27+
2628# #####################################################################
2729# Rust version
2830# #####################################################################
2931
30- doc/version.md : $(MKFILE_DEPS ) $(wildcard $(S ) doc /* .* )
32+ doc/version.md : $(MKFILE_DEPS ) $(wildcard $(D ) /* .* ) | doc/
3133 @$(call E, version-stamp: $@ )
3234 $(Q ) echo " $( CFG_VERSION) " > $@
3335
3436HTML_DEPS += doc/version_info.html
35- doc/version_info.html : version_info.html.template $(MKFILE_DEPS ) \
36- $(wildcard $(S)doc /*.*)
37+ doc/version_info.html : $( D ) / version_info.html.template $(MKFILE_DEPS ) \
38+ $(wildcard $(D) /*.*) | doc/
3739 @$(call E, version-info: $@)
3840 sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
3941 $(CFG_VER_HASH) | head -c 8)/;\
@@ -45,17 +47,20 @@ GENERATED += doc/version.md doc/version_info.html
4547# Docs, from pandoc, rustdoc (which runs pandoc), and node
4648# #####################################################################
4749
50+ doc/ :
51+ @mkdir -p $@
52+
4853HTML_DEPS += doc/rust.css
49- doc/rust.css : rust.css
54+ doc/rust.css : $( D ) / rust.css | doc/
5055 @$(call E, cp: $@ )
5156 $(Q ) cp -a $< $@ 2> /dev/null
5257
53- doc/full-toc.inc : full-toc.inc
58+ doc/full-toc.inc : $( D ) / full-toc.inc | doc/
5459 @$(call E, cp: $@ )
5560 $(Q ) cp -a $< $@ 2> /dev/null
5661
5762HTML_DEPS += doc/favicon.inc
58- doc/favicon.inc : favicon.inc
63+ doc/favicon.inc : $( D ) / favicon.inc | doc/
5964 @$(call E, cp: $@ )
6065 $(Q ) cp -a $< $@ 2> /dev/null
6166
@@ -72,52 +77,52 @@ endif
7277ifneq ($(NO_DOCS ) ,1)
7378
7479DOCS += doc/rust.html
75- doc/rust.html : rust.md doc/full-toc.inc $(HTML_DEPS )
80+ doc/rust.html : $( D ) / rust.md doc/full-toc.inc $(HTML_DEPS ) | doc/
7681 @$(call E, pandoc: $@ )
77- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
82+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
7883 $(CFG_PANDOC ) $(HTML_OPTS ) --include-in-header=doc/full-toc.inc --output=$@
7984
8085DOCS += doc/rust.tex
81- doc/rust.tex : rust.md doc/version.md
86+ doc/rust.tex : $( D ) / rust.md doc/version.md | doc/
8287 @$(call E, pandoc: $@ )
83- $(Q )$(CFG_NODE ) $(S ) doc /prep.js $< | \
88+ $(Q )$(CFG_NODE ) $(D ) /prep.js $< | \
8489 $(CFG_PANDOC ) $(TEX_OPTS ) --output=$@
8590
8691DOCS += doc/rust.epub
87- doc/rust.epub : rust.md
92+ doc/rust.epub : $( D ) / rust.md | doc/
8893 @$(call E, pandoc: $@ )
89- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
94+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
9095 $(CFG_PANDOC ) $(EPUB_OPTS ) --output=$@
9196
9297DOCS += doc/rustdoc.html
93- doc/rustdoc.html : rustdoc.md $(HTML_DEPS )
98+ doc/rustdoc.html : $( D ) / rustdoc.md $(HTML_DEPS )
9499 @$(call E, pandoc: $@ )
95- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
100+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
96101 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
97102
98103DOCS += doc/tutorial.html
99- doc/tutorial.html : tutorial.md $(HTML_DEPS )
104+ doc/tutorial.html : $( D ) / tutorial.md $(HTML_DEPS )
100105 @$(call E, pandoc: $@ )
101- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
106+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
102107 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
103108
104109DOCS += doc/tutorial.tex
105- doc/tutorial.tex : tutorial.md doc/version.md
110+ doc/tutorial.tex : $( D ) / tutorial.md doc/version.md
106111 @$(call E, pandoc: $@ )
107- $(Q )$(CFG_NODE ) $(S ) doc /prep.js $< | \
112+ $(Q )$(CFG_NODE ) $(D ) /prep.js $< | \
108113 $(CFG_PANDOC ) $(TEX_OPTS ) --output=$@
109114
110115DOCS += doc/tutorial.epub
111- doc/tutorial.epub : tutorial.md
116+ doc/tutorial.epub : $( D ) / tutorial.md
112117 @$(call E, pandoc: $@ )
113- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
118+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
114119 $(CFG_PANDOC ) $(EPUB_OPTS ) --output=$@
115120
116121
117122DOCS_L10N += doc/l10n/ja/tutorial.html
118123doc/l10n/ja/tutorial.html : doc/l10n/ja/tutorial.md doc/version_info.html doc/rust.css
119124 @$(call E, pandoc: $@ )
120- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight doc/l10n/ja/tutorial.md | \
125+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight doc/l10n/ja/tutorial.md | \
121126 $(CFG_PANDOC) --standalone --toc \
122127 --section-divs --number-sections \
123128 --from =markdown --to=html5 --css=../../rust.css \
@@ -127,95 +132,95 @@ doc/l10n/ja/tutorial.html: doc/l10n/ja/tutorial.md doc/version_info.html doc/rus
127132# Complementary documentation
128133#
129134DOCS += doc/index.html
130- doc/index.html : index.md $(HTML_DEPS )
135+ doc/index.html : $( D ) / index.md $(HTML_DEPS )
131136 @$(call E, pandoc: $@ )
132- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
137+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
133138 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
134139
135140DOCS += doc/complement-lang-faq.html
136- doc/complement-lang-faq.html : $(S ) doc /complement-lang-faq.md doc/full-toc.inc $(HTML_DEPS )
141+ doc/complement-lang-faq.html : $(D ) /complement-lang-faq.md doc/full-toc.inc $(HTML_DEPS )
137142 @$(call E, pandoc: $@ )
138- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
143+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
139144 $(CFG_PANDOC ) $(HTML_OPTS ) --include-in-header=doc/full-toc.inc --output=$@
140145
141146DOCS += doc/complement-project-faq.html
142- doc/complement-project-faq.html : $(S ) doc /complement-project-faq.md $(HTML_DEPS )
147+ doc/complement-project-faq.html : $(D ) /complement-project-faq.md $(HTML_DEPS )
143148 @$(call E, pandoc: $@ )
144- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
149+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
145150 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
146151
147152DOCS += doc/complement-usage-faq.html
148- doc/complement-usage-faq.html : $(S ) doc /complement-usage-faq.md $(HTML_DEPS )
153+ doc/complement-usage-faq.html : $(D ) /complement-usage-faq.md $(HTML_DEPS )
149154 @$(call E, pandoc: $@ )
150- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
155+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
151156 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
152157
153158DOCS += doc/complement-cheatsheet.html
154- doc/complement-cheatsheet.html : $(S ) doc /complement-cheatsheet.md doc/full-toc.inc $(HTML_DEPS )
159+ doc/complement-cheatsheet.html : $(D ) /complement-cheatsheet.md doc/full-toc.inc $(HTML_DEPS )
155160 @$(call E, pandoc: $@ )
156- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
161+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
157162 $(CFG_PANDOC ) $(HTML_OPTS ) --include-in-header=doc/full-toc.inc --output=$@
158163
159164DOCS += doc/complement-bugreport.html
160- doc/complement-bugreport.html : $(S ) doc /complement-bugreport.md $(HTML_DEPS )
165+ doc/complement-bugreport.html : $(D ) /complement-bugreport.md $(HTML_DEPS )
161166 @$(call E, pandoc: $@ )
162- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
167+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
163168 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
164169
165170# Guides
166171
167172DOCS += doc/guide-macros.html
168- doc/guide-macros.html : $(S ) doc /guide-macros.md $(HTML_DEPS )
173+ doc/guide-macros.html : $(D ) /guide-macros.md $(HTML_DEPS )
169174 @$(call E, pandoc: $@ )
170- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
175+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
171176 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
172177
173178DOCS += doc/guide-container.html
174- doc/guide-container.html : $(S ) doc /guide-container.md $(HTML_DEPS )
179+ doc/guide-container.html : $(D ) /guide-container.md $(HTML_DEPS )
175180 @$(call E, pandoc: $@ )
176- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
181+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
177182 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
178183
179184DOCS += doc/guide-ffi.html
180- doc/guide-ffi.html : $(S ) doc /guide-ffi.md $(HTML_DEPS )
185+ doc/guide-ffi.html : $(D ) /guide-ffi.md $(HTML_DEPS )
181186 @$(call E, pandoc: $@ )
182- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
187+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
183188 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
184189
185190DOCS += doc/guide-testing.html
186- doc/guide-testing.html : $(S ) doc /guide-testing.md $(HTML_DEPS )
191+ doc/guide-testing.html : $(D ) /guide-testing.md $(HTML_DEPS )
187192 @$(call E, pandoc: $@ )
188- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
193+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
189194 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
190195
191196DOCS += doc/guide-lifetimes.html
192- doc/guide-lifetimes.html : $(S ) doc /guide-lifetimes.md $(HTML_DEPS )
197+ doc/guide-lifetimes.html : $(D ) /guide-lifetimes.md $(HTML_DEPS )
193198 @$(call E, pandoc: $@ )
194- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
199+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
195200 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
196201
197202DOCS += doc/guide-tasks.html
198- doc/guide-tasks.html : $(S ) doc /guide-tasks.md $(HTML_DEPS )
203+ doc/guide-tasks.html : $(D ) /guide-tasks.md $(HTML_DEPS )
199204 @$(call E, pandoc: $@ )
200- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
205+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
201206 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
202207
203208DOCS += doc/guide-conditions.html
204- doc/guide-conditions.html : $(S ) doc /guide-conditions.md $(HTML_DEPS )
209+ doc/guide-conditions.html : $(D ) /guide-conditions.md $(HTML_DEPS )
205210 @$(call E, pandoc: $@ )
206- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
211+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
207212 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
208213
209214DOCS += doc/guide-pointers.html
210- doc/guide-pointers.html : $(S ) doc /guide-pointers.md $(HTML_DEPS )
215+ doc/guide-pointers.html : $(D ) /guide-pointers.md $(HTML_DEPS )
211216 @$(call E, pandoc: $@ )
212- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
217+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
213218 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
214219
215220DOCS += doc/guide-runtime.html
216- doc/guide-runtime.html : $(S ) doc /guide-runtime.md $(HTML_DEPS )
221+ doc/guide-runtime.html : $(D ) /guide-runtime.md $(HTML_DEPS )
217222 @$(call E, pandoc: $@ )
218- $(Q )$(CFG_NODE ) $(S ) doc /prep.js --highlight $< | \
223+ $(Q )$(CFG_NODE ) $(D ) /prep.js --highlight $< | \
219224 $(CFG_PANDOC ) $(HTML_OPTS ) --output=$@
220225
221226 ifeq ($(CFG_PDFLATEX),)
@@ -274,8 +279,10 @@ endif
274279# Rustdoc (libstd/extra)
275280# #####################################################################
276281
277- # The rustdoc executable
278- RUSTDOC = $(HBIN2_H_$(CFG_BUILD ) ) /rustdoc$(X_$(CFG_BUILD ) )
282+ # The rustdoc executable, rpath included in case --disable-rpath was provided to
283+ # ./configure
284+ RUSTDOC = $(RPATH_VAR2_T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) \
285+ $(HBIN2_H_$(CFG_BUILD ) ) /rustdoc$(X_$(CFG_BUILD ) )
279286
280287# The library documenting macro
281288#
0 commit comments