Makefile 2.0 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. # Additional targets:
  7. #
  8. # - tests-report: Creates doc/eunit.html with the coverage and eunit output.
  9. # - gh-pages: Generates docs and eunit reports and commits these in the
  10. # gh-pages which Github publishes automatically when pushed.
  11. PROJECT = mysql
  12. EDOC_OPTS = {stylesheet_file,"priv/edoc-style.css"},{todo,true}
  13. PLT_APPS = crypto
  14. SHELL_PATH = -pa ebin
  15. include erlang.mk
  16. .PHONY: gh-pages tests-report CHANGELOG.md
  17. CHANGELOG.md:
  18. ./changelog.sh > $@
  19. # Update the local 'gh-pages' branch with pregenerated output files
  20. # (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
  21. gh-pages: docs tests-report
  22. @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
  23. echo "Not on master. Aborting." ; \
  24. false ; \
  25. fi
  26. @git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
  27. @GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
  28. rm -f $${GIT_INDEX_FILE} && \
  29. git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
  30. git update-ref refs/heads/gh-pages \
  31. $$(echo "Autogenerated html pages for $$(git describe --tags)" \
  32. | git commit-tree $$(git write-tree --prefix=doc) \
  33. -p refs/heads/gh-pages)
  34. @rm gitindex.tmp
  35. @echo "Committed $$(git describe --tags) in the gh-pages branch."
  36. # Build eunit.html containing the coverage report and the test output in the
  37. # doc directory.
  38. tests-report: test_command=$(MAKE) --no-print-directory tests COVER=1 \
  39. COVER_REPORT_DIR= EUNIT_OPTS={verbose,true}
  40. tests-report:
  41. @rm -f cover/*.html
  42. @$(test_command) | tee tests.output
  43. @$(MAKE) --no-print-directory cover-report
  44. @(cat cover/index.html | sed 's!</body></html>!!' ; \
  45. echo '<h3>Output of <code>$(test_command)</code></h3><pre>' ; \
  46. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' tests.output ; \
  47. echo '</pre>' ; \
  48. echo '</body></html>') > doc/eunit.html
  49. @cp cover/*.COVER.html doc/