Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. # - CHANGELOG.md: Generates a changelog from the git commits and tags.
  12. .PHONY: gh-pages tests-report tests-prep CHANGELOG.md
  13. PROJECT = mysql
  14. EDOC_OPTS = {stylesheet_file,"priv/edoc-style.css"},{todo,true}
  15. PLT_APPS = crypto ssl inets public_key
  16. SHELL_PATH = -pa ebin
  17. ERLANG_MK_BUILD_CONFIG = erlang-mk.build.config
  18. include erlang.mk
  19. # Generate keys for SSL tests. Requires configuring and restarting MySQL.
  20. tests-prep:
  21. $(MAKE) -C test/ssl
  22. distclean::
  23. $(MAKE) -C test/ssl clean
  24. CHANGELOG.md:
  25. ./changelog.sh > $@
  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 tests-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 test output in the
  44. # doc directory.
  45. tests-report: test_command=$(MAKE) --no-print-directory tests COVER=1 \
  46. COVER_REPORT_DIR= EUNIT_OPTS={verbose,true}
  47. tests-report:
  48. @rm -f cover/*.html
  49. @$(test_command) | tee tests.output
  50. @$(MAKE) --no-print-directory cover-report
  51. @(cat cover/index.html | sed 's!</body></html>!!' ; \
  52. echo '<h3>Output of <code>$(test_command)</code></h3><pre>' ; \
  53. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' tests.output ; \
  54. echo '</pre>' ; \
  55. echo '</body></html>') > doc/eunit.html
  56. @cp cover/*.COVER.html doc/