Makefile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. PLT_APPS = crypto
  17. SHELL_PATH = -pa ebin
  18. include erlang.mk
  19. .PHONY: gh-pages eunit eunit-report
  20. eunit:
  21. @mkdir -p .eunit
  22. @rm -f .eunit/index.html # make sure we don't get an old one if cover=false
  23. @rebar eunit | tee .eunit/output
  24. # Update the local 'gh-pages' branch with pregenerated output files
  25. # (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
  26. gh-pages: docs eunit-report
  27. @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
  28. echo "Not on master. Aborting." ; \
  29. false ; \
  30. fi
  31. @git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
  32. @GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
  33. rm -f $${GIT_INDEX_FILE} && \
  34. git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
  35. git update-ref refs/heads/gh-pages \
  36. $$(echo "Autogenerated html pages for $$(git describe --tags)" \
  37. | git commit-tree $$(git write-tree --prefix=doc) \
  38. -p refs/heads/gh-pages)
  39. @rm gitindex.tmp
  40. @echo "Committed $$(git describe --tags) in the gh-pages branch."
  41. # Build eunit.html containing the coverage report and the eunit output in the
  42. # doc directory.
  43. eunit-report: eunit
  44. @(echo '<!DOCTYPE html>' ; \
  45. cat .eunit/index.html | sed 's!</body></html>!!' ; \
  46. echo '<h3>Output of <code>make eunit</code></h3><pre>' ; \
  47. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' .eunit/output ; \
  48. echo '</pre>' ; \
  49. echo '<p><em>Generated using rebar and EUnit,' ; \
  50. date -u '+%d %h %Y %H:%M:%S UTC.' ; \
  51. echo '</em></p>' ; \
  52. echo '</body></html>') > doc/eunit.html
  53. @cp .eunit/*.COVER.html doc/