| 1 | .PHONY: all |
| 2 | all: |
| 3 | @echo 'Try `cargo build` instead.' |
| 4 | |
| 5 | .PHONY: authors |
| 6 | authors: |
| 7 | echo 'Encoding is mainly written by Kang Seonghoon <[email protected]>,' > AUTHORS.txt |
| 8 | echo 'and also the following people (in ascending order):' >> AUTHORS.txt |
| 9 | echo >> AUTHORS.txt |
| 10 | git log --format='%aN <%aE>' | grep -v 'Kang Seonghoon' | sort -u >> AUTHORS.txt |
| 11 | |
| 12 | .PHONY: test |
| 13 | test: |
| 14 | cargo test -v |
| 15 | cargo test -v -p encoding-index-singlebyte |
| 16 | cargo test -v -p encoding-index-korean |
| 17 | cargo test -v -p encoding-index-japanese |
| 18 | cargo test -v -p encoding-index-simpchinese |
| 19 | cargo test -v -p encoding-index-tradchinese |
| 20 | |
| 21 | .PHONY: readme |
| 22 | readme: README.md |
| 23 | |
| 24 | README.md: src/lib.rs |
| 25 | # really, really sorry for this mess. |
| 26 | awk '/^\/\/! # Encoding /{print "[Encoding][doc]",$$4}' $< > $@ |
| 27 | awk '/^\/\/! # Encoding /{print "[Encoding][doc]",$$4}' $< | sed 's/./=/g' >> $@ |
| 28 | echo >> $@ |
| 29 | echo '[![Encoding on Travis CI][travis-image]][travis]' >> $@ |
| 30 | echo >> $@ |
| 31 | echo '[travis-image]: https://travis-ci.org/lifthrasiir/rust-encoding.png' >> $@ |
| 32 | echo '[travis]: https://travis-ci.org/lifthrasiir/rust-encoding' >> $@ |
| 33 | awk '/^\/\/! # Encoding /,/^\/\/! ## /' $< | cut -b 5- | grep -v '^# ' >> $@ |
| 34 | echo >> $@ |
| 35 | echo '[Complete Documentation][doc]' >> $@ |
| 36 | echo >> $@ |
| 37 | echo '[doc]: https://lifthrasiir.github.io/rust-encoding/' >> $@ |
| 38 | echo >> $@ |
| 39 | awk '/^\/\/! ## /,!/^\/\/!/' $< | cut -b 5- | grep -v '^# ' >> $@ |
| 40 | |
| 41 | .PHONY: doc |
| 42 | doc: authors readme |
| 43 | cargo doc |
| 44 | |
| 45 | .PHONY: doc-publish |
| 46 | doc-publish: doc |
| 47 | ( \ |
| 48 | PKGID="$$(cargo pkgid)"; \ |
| 49 | PKGNAMEVER="$${PKGID#*#}"; \ |
| 50 | PKGNAME="$${PKGNAMEVER%:*}"; \ |
| 51 | REMOTE="$$(git config --get remote.origin.url)"; \ |
| 52 | cd target/doc && \ |
| 53 | rm -rf .git && \ |
| 54 | git init && \ |
| 55 | git checkout --orphan gh-pages && \ |
| 56 | echo '<!doctype html><html><head><meta http-equiv="refresh" content="0;URL='$$PKGNAME'/index.html"></head><body></body></html>' > index.html && \ |
| 57 | git add . && \ |
| 58 | git commit -m 'updated docs.' && \ |
| 59 | git push "$$REMOTE" gh-pages -f; \ |
| 60 | ) |
| 61 |