Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # MySQL/OTP
  2. #
  3. # This Makefile should be complete enough for this project to be used as an
  4. ## erlang.mk dependency.
  5. #
  6. # We use rebar for eunit with coverage since erlang.mk doesn't have this yet.
  7. # 'make tests' is not usable. Try 'rebar eunit' or 'make eunit-coverage'.
  8. #
  9. # Additional targets:
  10. #
  11. # - eunit-coverage: Creates doc/eunit.html with the coverage and eunit output.
  12. # - gh-pages: Generates docs and eunit reports and commits these in the
  13. # gh-pages which Github publishes automatically when pushed.
  14. PROJECT = mysql
  15. EDOC_OPTS = {stylesheet_file,"priv/edoc-style.css"},{todo,true}
  16. include erlang.mk
  17. .PHONY: gh-pages eunit-coverage
  18. # Update the local 'gh-pages' branch with pregenerated output files
  19. # (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
  20. gh-pages: docs eunit-coverage
  21. @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
  22. echo "Not on master. Aborting." ; \
  23. false ; \
  24. fi
  25. @git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
  26. @GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
  27. rm -f $${GIT_INDEX_FILE} && \
  28. git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
  29. git update-ref refs/heads/gh-pages \
  30. $$(echo "Autogenerated html pages for $$(git describe --tags)" \
  31. | git commit-tree $$(git write-tree --prefix=doc) \
  32. -p refs/heads/gh-pages)
  33. @rm gitindex.tmp
  34. @echo "Committed $$(git describe --tags) in the gh-pages branch."
  35. # Build eunit.html containing the coverage report and the eunit output in the
  36. # doc directory.
  37. eunit-coverage:
  38. @mkdir -p .eunit
  39. @rm -f .eunit/index.html # make sure we don't get an old one if cover=false
  40. @rebar eunit | tee .eunit/output
  41. @(echo '<!DOCTYPE html>' ; \
  42. cat .eunit/index.html | sed 's!</body></html>!!' ; \
  43. echo '<h3>Output of <code>make eunit</code></h3><pre>' ; \
  44. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' .eunit/output ; \
  45. echo '</pre>' ; \
  46. echo '<p><em>Generated using EUnit,' ; \
  47. date -u '+%d %h %Y %H:%M:%S UTC.' ; \
  48. echo '</em></p>' ; \
  49. echo '</body></html>') > doc/eunit.html
  50. @cp .eunit/*.COVER.html doc/