Skip to content

Commit 0c2007e

Browse files
author
root
committed
Update Makefile for docs
1 parent aa1473b commit 0c2007e

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

Makefile

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1+
DOCCRATES = itertools
12

2-
docs: VERSION
3-
cargo doc --no-deps
3+
# deps to delete the generated docs
4+
RMDOCS =
5+
6+
FEATURES =
7+
8+
VERSIONS = $(patsubst %,target/VERS/%,$(DOCCRATES))
9+
10+
docs: mkdocs subst $(RMDOCS)
11+
12+
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
13+
$(VERSIONS): Cargo.toml
14+
mkdir -p $(@D)
15+
cargo pkgid $(@F) | sed -e "s/.*#\(\|.*:\)//" > "$@"
16+
17+
$(DOCCRATES): %: target/VERS/%
18+
# Put in the crate version into the docs
19+
find ./doc/$@ -name "*.html" -exec sed -i -e "s/<title>\(.*\) - Rust/<title>$@ $(shell cat $<) - \1 - Rust/g" {} \;
20+
21+
subst: $(DOCCRATES)
22+
23+
mkdocs: Cargo.toml
24+
cargo doc --features=$(FEATURES)
425
rm -rf ./doc
526
cp -r ./target/doc ./doc
6-
# Put in the crate version into the docs
7-
find ./doc -name "*.html" -exec sed -i -e "s/<title>\(.*\) - Rust/<title>itertools $(shell cat VERSION) - \1 - Rust/g" {} \;
8-
-cat ./custom.css >> doc/main.css
27+
- cat ./custom.css >> doc/main.css
28+
29+
$(RMDOCS): mkdocs
30+
rm -r ./doc/$@
31+
sed -i "/searchIndex\['$@'\]/d" doc/search-index.js
932

10-
VERSION: Cargo.toml
11-
cargo pkgid | sed -e "s/.*#//" > VERSION
1233

13-
.PHONY: docs
34+
.PHONY: docs mkdocs subst $(DOCCRATES) $(RMDOCS)

0 commit comments

Comments
 (0)