Makefile 2.0 KB

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