Makefile 2.2 KB

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