Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # See LICENSE for licensing information.
  2. PROJECT = cowboy
  3. # Options.
  4. COMPILE_FIRST = cowboy_middleware cowboy_stream cowboy_sub_protocol
  5. CT_OPTS += -ct_hooks cowboy_ct_hook [] # -boot start_sasl
  6. PLT_APPS = crypto public_key ssl
  7. CI_OTP = OTP-18.0-rc2 # OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.3
  8. # Dependencies.
  9. DEPS = cowlib ranch
  10. dep_cowlib = git https://github.com/ninenines/cowlib master
  11. TEST_DEPS = ct_helper gun
  12. dep_ct_helper = git https://github.com/extend/ct_helper.git master
  13. # Standard targets.
  14. include erlang.mk
  15. ERLC_OPTS += +warn_export_all +warn_missing_spec +warn_untyped_record
  16. TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}'
  17. # Also dialyze the tests.
  18. # DIALYZER_OPTS += --src -r test
  19. # Open logs after CI ends.
  20. ci::
  21. $(gen_verbose) xdg-open logs/all_runs.html
  22. # Use erl_make_certs from the tested release.
  23. ci-setup::
  24. $(gen_verbose) cp ~/.kerl/builds/$(CI_OTP_RELEASE)/otp_src_git/lib/ssl/test/erl_make_certs.erl deps/ct_helper/src/
  25. # Documentation.
  26. dep_ezdoc = git https://github.com/ninenines/ezdoc master
  27. $(eval $(call dep_target,ezdoc))
  28. build-doc-deps: $(DEPS_DIR)/ezdoc
  29. $(MAKE) -C $(DEPS_DIR)/ezdoc
  30. define ezdoc_script
  31. io:format("Building manual~n"),
  32. [begin
  33. AST = ezdoc:parse_file(F),
  34. BF = filename:rootname(filename:basename(F)),
  35. io:format(" ~s~n", [BF]),
  36. file:write_file("doc/markdown/manual/" ++ BF ++ ".md", ezdoc_markdown:export(AST)),
  37. case BF of
  38. "cowboy" ++ _ when BF =/= "cowboy_app" ->
  39. file:write_file("doc/man3/" ++ BF ++ ".3", ezdoc_man:export(3, AST));
  40. _ when BF =/= "index" ->
  41. file:write_file("doc/man7/" ++ BF ++ ".7", ezdoc_man:export(7, AST));
  42. _ ->
  43. ok
  44. end
  45. end || F <- filelib:wildcard("doc/src/manual/*.ezdoc")],
  46. io:format("Building guide~n"),
  47. [begin
  48. AST = ezdoc:parse_file(F),
  49. BF = filename:rootname(filename:basename(F)),
  50. io:format(" ~s~n", [BF]),
  51. file:write_file("doc/markdown/guide/" ++ BF ++ ".md", ezdoc_markdown:export(AST))
  52. end || F <- filelib:wildcard("doc/src/guide/*.ezdoc")],
  53. io:format("Done.~n"),
  54. init:stop().
  55. endef
  56. export ezdoc_script
  57. docs:: clean-docs build-doc-deps
  58. @mkdir -p doc/man3 doc/man7 doc/markdown/guide doc/markdown/manual
  59. $(gen_verbose) erl -noinput -pa ebin deps/ezdoc/ebin -eval "$$ezdoc_script"
  60. @gzip doc/man3/*.3 doc/man7/*.7
  61. @cp doc/src/guide/*.png doc/markdown/guide
  62. clean-docs:
  63. $(gen_verbose) rm -rf doc/man3 doc/man7 doc/markdown
  64. MAN_INSTALL_PATH ?= /usr/local/share/man
  65. install-docs:
  66. mkdir -p $(MAN_INSTALL_PATH)/man3/ $(MAN_INSTALL_PATH)/man7/
  67. install -g 0 -o 0 -m 0644 doc/man3/*.gz $(MAN_INSTALL_PATH)/man3/
  68. install -g 0 -o 0 -m 0644 doc/man7/*.gz $(MAN_INSTALL_PATH)/man7/