Makefile 2.3 KB

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