Makefile 2.7 KB

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