Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # This Makefile is used to build documentation in the gh-pages branch.
  2. .PHONY: all gh-pages eunit edoc
  3. all:
  4. @echo "Do 'make gh-pages' to commit in the gh-pages branch containing"
  5. @echo "the generated EDoc and the EUnit coverage report."
  6. edoc:
  7. rebar doc
  8. eunit:
  9. rebar eunit | tee .eunit/output
  10. # Build eunit.html containing the coverage report and the eunit output.
  11. doc/eunit.html: eunit
  12. (echo '<!DOCTYPE html>' ; \
  13. cat .eunit/index.html | sed 's!</body></html>!!' ; \
  14. echo '<h3>Output</h3><pre>' ; \
  15. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' .eunit/output ; \
  16. echo '</pre>' ; \
  17. echo '<p><em>Generated using EUnit,' ; \
  18. date -u '+%d %h %Y %H:%M:%S UTC.' ; \
  19. echo '</em></p>' ; \
  20. echo '</body></html>') > doc/eunit.html
  21. # Update the local 'gh-pages' branch with pregenerated output files
  22. # (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
  23. gh-pages: doc/eunit.html edoc
  24. @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
  25. echo "Not on master. Aborting." ; \
  26. false ; \
  27. fi
  28. cp .eunit/*.COVER.html doc/
  29. git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
  30. GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
  31. rm -f $${GIT_INDEX_FILE} && \
  32. git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
  33. git update-ref refs/heads/gh-pages \
  34. $$(echo "Autogenerated html pages for $$(git describe)" \
  35. | git commit-tree $$(git write-tree --prefix=doc) \
  36. -p refs/heads/gh-pages)
  37. rm gitindex.tmp
  38. @echo "=== Done ==="
  39. # Credits:
  40. #