1DOCCRATES = petgraph fixedbitset 2 3# deps to delete the generated docs 4RMDOCS = 5 6FEATURES = unstable 7 8VERSIONS = $(patsubst %,target/VERS/%,$(DOCCRATES)) 9 10docs: mkdocs mksvgs 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 21subst: $(DOCCRATES) 22 23mkdocs: Cargo.toml 24 cargo doc --features=$(FEATURES) 25 rm -rf ./doc 26 cp -r ./target/doc ./doc 27 - cat ./custom.css >> doc/main.css 28 29$(RMDOCS): mkdocs 30 rm -r ./doc/$@ 31 sed -i "/searchIndex\['$@'\]/d" doc/search-index.js 32 33mksvgs: mkdocs graph-example.dot 34 dot -Tsvg < ./graph-example.dot > graph-example.svg 35 mv graph-example.svg ./doc/petgraph/graph/ 36 37 38.PHONY: docs mkdocs mksvgs subst $(DOCCRATES) $(RMDOCS) 39