Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # - publish-hex: Publishes package and docs to Hex. Requires Mix.
  13. .PHONY: gh-pages tests-report tests-prep CHANGELOG.md publish-hex
  14. PROJECT = mysql
  15. EDOC_OPTS = {stylesheet_file,"priv/edoc-style.css"},{todo,true}
  16. EUNIT_OPTS = {verbose,true}
  17. PLT_APPS = crypto ssl inets public_key
  18. SHELL_PATH = -pa ebin
  19. ERLANG_MK_BUILD_CONFIG = erlang-mk.build.config
  20. include erlang.mk
  21. # Generate keys for SSL tests. Requires configuring and restarting MySQL.
  22. tests-prep:
  23. $(MAKE) -C test/ssl
  24. distclean::
  25. $(MAKE) -C test/ssl clean
  26. CHANGELOG.md:
  27. priv/bin/changelog.sh > $@
  28. # Update the local 'gh-pages' branch with pregenerated output files
  29. # (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
  30. gh-pages: docs tests-report
  31. @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
  32. echo "Not on master. Aborting." ; \
  33. false ; \
  34. fi
  35. @git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
  36. @GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
  37. rm -f $${GIT_INDEX_FILE} && \
  38. git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
  39. git update-ref refs/heads/gh-pages \
  40. $$(echo "Autogenerated html pages for $$(git describe --tags)" \
  41. | git commit-tree $$(git write-tree --prefix=doc) \
  42. -p refs/heads/gh-pages)
  43. @rm gitindex.tmp
  44. @echo "Committed $$(git describe --tags) in the gh-pages branch."
  45. # Build eunit.html containing the coverage report and the test output in the
  46. # doc directory.
  47. tests-report: test_command=$(MAKE) --no-print-directory tests COVER=1 \
  48. COVER_REPORT_DIR=
  49. tests-report:
  50. @rm -f cover/*.html
  51. @$(test_command) | tee tests.output
  52. @$(MAKE) --no-print-directory cover-report
  53. @(cat cover/index.html | sed 's!</body></html>!!' ; \
  54. echo '<h3>Output of <code>$(test_command)</code></h3><pre>' ; \
  55. sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g;' tests.output ; \
  56. echo '</pre>' ; \
  57. echo '</body></html>') > doc/eunit.html
  58. @cp cover/*.COVER.html doc/
  59. # For publishing to Hex using Mix
  60. publish-hex: docs mix.exs
  61. mix hex.publish
  62. mix.exs: priv/bin/mk_mix_file.escript
  63. priv/bin/mk_mix_file.escript > $@