mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
Refactor the doc building rules a bit, sensitize them to the presence or absence of xetex and luatex (for now).
This commit is contained in:
parent
5ac57d1891
commit
193279daa2
37
Makefile.in
37
Makefile.in
@ -133,39 +133,6 @@ ifdef CFG_BAD_VALGRIND
|
|||||||
CFG_VALGRIND :=
|
CFG_VALGRIND :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DOCS :=
|
|
||||||
ifeq ($(CFG_PANDOC),)
|
|
||||||
$(info cfg: no pandoc found, omitting doc/rust.html)
|
|
||||||
else
|
|
||||||
DOCS += doc/rust.html
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CFG_PANDOC),)
|
|
||||||
$(info cfg: no pandoc found, omitting doc/rust.pdf)
|
|
||||||
else
|
|
||||||
ifeq ($(CFG_PDFLATEX),)
|
|
||||||
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
|
|
||||||
else
|
|
||||||
DOCS += doc/rust.pdf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CFG_NODE),)
|
|
||||||
$(info cfg: no node found, omitting doc/tutorial/web)
|
|
||||||
else
|
|
||||||
DOCS += doc/tutorial/web/index.html
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CFG_NATURALDOCS),)
|
|
||||||
$(info cfg: no naturaldocs found, omitting library doc build)
|
|
||||||
else
|
|
||||||
DOCS += doc/core/index.html doc/std/index.html
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef CFG_DISABLE_DOCS
|
|
||||||
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
|
||||||
DOCS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Target-and-rule "utility variables"
|
# Target-and-rule "utility variables"
|
||||||
@ -431,7 +398,7 @@ CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***)
|
|||||||
CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
|
CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
|
||||||
CFG_INFO := $(info cfg:)
|
CFG_INFO := $(info cfg:)
|
||||||
|
|
||||||
all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS)
|
all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) docs
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -442,7 +409,7 @@ FUZZ := $(HBIN3_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
|
|||||||
CARGO := $(HBIN3_H_$(CFG_HOST_TRIPLE))/cargo$(X)
|
CARGO := $(HBIN3_H_$(CFG_HOST_TRIPLE))/cargo$(X)
|
||||||
RUSTDOC := $(HBIN3_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
|
RUSTDOC := $(HBIN3_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
|
||||||
|
|
||||||
all: rustc $(GENERATED) $(DOCS) $(FUZZ) $(CARGO) $(RUSTDOC)
|
all: rustc $(GENERATED) docs $(FUZZ) $(CARGO) $(RUSTDOC)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -289,6 +289,8 @@ probe CFG_NATURALDOCS naturaldocs
|
|||||||
probe CFG_LLNEXTGEN LLnextgen
|
probe CFG_LLNEXTGEN LLnextgen
|
||||||
probe CFG_PANDOC pandoc
|
probe CFG_PANDOC pandoc
|
||||||
probe CFG_PDFLATEX pdflatex
|
probe CFG_PDFLATEX pdflatex
|
||||||
|
probe CFG_XETEX xetex
|
||||||
|
probe CFG_LUATEX luatex
|
||||||
probe CFG_NODE node
|
probe CFG_NODE node
|
||||||
|
|
||||||
if [ -z "$CFG_NODE" ]
|
if [ -z "$CFG_NODE" ]
|
||||||
|
98
mk/docs.mk
98
mk/docs.mk
@ -2,16 +2,17 @@
|
|||||||
# Doc variables and rules
|
# Doc variables and rules
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
doc/version.md: $(MKFILE_DEPS) rust.md
|
DOCS :=
|
||||||
@$(call E, version-stamp: $@)
|
|
||||||
$(Q)echo "$(CFG_VERSION)" >>$@
|
|
||||||
|
|
||||||
doc/keywords.md: $(MKFILE_DEPS) rust.md
|
|
||||||
@$(call E, grep -v: $$@)
|
|
||||||
$(Q)grep -v '^#' $< >$@
|
|
||||||
|
|
||||||
ifdef CFG_PANDOC
|
######################################################################
|
||||||
|
# Pandoc (reference-manual related)
|
||||||
|
######################################################################
|
||||||
|
ifeq ($(CFG_PANDOC),)
|
||||||
|
$(info cfg: no pandoc found, omitting doc/rust.pdf)
|
||||||
|
else
|
||||||
|
|
||||||
|
DOCS += doc/rust.html
|
||||||
doc/rust.html: rust.md doc/version.md doc/keywords.md
|
doc/rust.html: rust.md doc/version.md doc/keywords.md
|
||||||
@$(call E, pandoc: $@)
|
@$(call E, pandoc: $@)
|
||||||
$(Q)$(CFG_PANDOC) \
|
$(Q)$(CFG_PANDOC) \
|
||||||
@ -26,8 +27,17 @@ doc/rust.html: rust.md doc/version.md doc/keywords.md
|
|||||||
-$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null
|
-$(Q)cp -a $(S)doc/rust.css doc/rust.css 2> /dev/null
|
||||||
|
|
||||||
|
|
||||||
ifdef CFG_PDFLATEX
|
ifeq ($(CFG_PDFLATEX),)
|
||||||
|
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
|
||||||
|
else
|
||||||
|
ifeq ($(CFG_XETEX),)
|
||||||
|
$(info cfg: no xetex found, disabling doc/rust.pdf)
|
||||||
|
else
|
||||||
|
ifeq ($(CFG_LUATEX),)
|
||||||
|
$(info cfg: lacking luatex, disabling pdflatex)
|
||||||
|
else
|
||||||
|
|
||||||
|
DOCS += doc/rust.pdf
|
||||||
doc/rust.tex: rust.md doc/version.md doc/keywords.md
|
doc/rust.tex: rust.md doc/version.md doc/keywords.md
|
||||||
@$(call E, pandoc: $@)
|
@$(call E, pandoc: $@)
|
||||||
$(Q)$(CFG_PANDOC) \
|
$(Q)$(CFG_PANDOC) \
|
||||||
@ -44,24 +54,20 @@ doc/rust.pdf: doc/rust.tex
|
|||||||
-output-directory=doc \
|
-output-directory=doc \
|
||||||
$<
|
$<
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifdef CFG_NODE
|
######################################################################
|
||||||
|
# LLnextgen (grammar analysis from refman)
|
||||||
|
######################################################################
|
||||||
|
ifeq ($(CFG_LLNEXTGEN),)
|
||||||
|
$(info cfg: no llnextgen found, omitting grammar-verification)
|
||||||
|
else
|
||||||
|
.PHONY: verify-grammar
|
||||||
|
|
||||||
doc/tutorial/web/index.html: \
|
|
||||||
$(wildcard $(S)doc/tutorial/*.md)
|
|
||||||
@$(call E, cp: $(S)doc/tutorial)
|
|
||||||
-$(Q)cp -a $(S)doc/tutorial doc/ 2> /dev/null
|
|
||||||
@$(call E, node: build.js)
|
|
||||||
$(Q)cd doc/tutorial && $(CFG_NODE) build.js
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
ifdef CFG_LLNEXTGEN
|
|
||||||
doc/rust.g: rust.md $(S)src/etc/extract_grammar.py
|
doc/rust.g: rust.md $(S)src/etc/extract_grammar.py
|
||||||
@$(call E, extract_grammar: $@)
|
@$(call E, extract_grammar: $@)
|
||||||
$(Q)$(S)src/etc/extract_grammar.py $< >$@
|
$(Q)$(S)src/etc/extract_grammar.py $< >$@
|
||||||
@ -73,11 +79,32 @@ verify-grammar: doc/rust.g
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
GENERATED += doc/keywords.md doc/version.md
|
######################################################################
|
||||||
|
# Node (tutorial related)
|
||||||
|
######################################################################
|
||||||
|
ifeq ($(CFG_NODE),)
|
||||||
|
$(info cfg: no node found, omitting doc/tutorial/web)
|
||||||
|
else
|
||||||
|
|
||||||
docsnap: doc/rust.pdf
|
DOCS += doc/tutorial/web/index.html
|
||||||
@$(call E, snap: doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf)
|
doc/tutorial/web/index.html: \
|
||||||
$(Q)mv $< doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf
|
$(wildcard $(S)doc/tutorial/*.md)
|
||||||
|
@$(call E, cp: $(S)doc/tutorial)
|
||||||
|
-$(Q)cp -a $(S)doc/tutorial doc/ 2> /dev/null
|
||||||
|
@$(call E, node: build.js)
|
||||||
|
$(Q)cd doc/tutorial && $(CFG_NODE) build.js
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Naturaldocs (library reference related)
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
ifeq ($(CFG_NATURALDOCS),)
|
||||||
|
$(info cfg: no naturaldocs found, omitting library doc build)
|
||||||
|
else
|
||||||
|
|
||||||
define libdoc
|
define libdoc
|
||||||
doc/$(1)/index.html: nd/$(1)/Languages.txt nd/$(1)/Topics.txt \
|
doc/$(1)/index.html: nd/$(1)/Languages.txt nd/$(1)/Topics.txt \
|
||||||
@ -103,10 +130,27 @@ GENERATED += nd/$(1)/Languages.txt \
|
|||||||
nd/$(1)/Data
|
nd/$(1)/Data
|
||||||
|
|
||||||
DOCS += doc/$(1)/index.html nd/$(1)/lib.css
|
DOCS += doc/$(1)/index.html nd/$(1)/lib.css
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
|
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
|
||||||
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))
|
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifdef CFG_DISABLE_DOCS
|
||||||
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
||||||
|
DOCS :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
doc/version.md: $(MKFILE_DEPS) rust.md
|
||||||
|
@$(call E, version-stamp: $@)
|
||||||
|
$(Q)echo "$(CFG_VERSION)" >>$@
|
||||||
|
|
||||||
|
doc/keywords.md: $(MKFILE_DEPS) rust.md
|
||||||
|
@$(call E, grep -v: $$@)
|
||||||
|
$(Q)grep -v '^#' $< >$@
|
||||||
|
|
||||||
|
GENERATED += doc/keywords.md doc/version.md
|
||||||
|
|
||||||
docs: $(DOCS)
|
docs: $(DOCS)
|
||||||
|
Loading…
Reference in New Issue
Block a user