Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.3 OTP-18.1
  11. # Dependencies.
  12. LOCAL_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. # Compile options.
  22. ERLC_OPTS += +warn_export_all +warn_missing_spec +warn_untyped_record
  23. TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}'
  24. # Generate rebar.config on build.
  25. app:: rebar.config
  26. # Also dialyze the tests.
  27. # DIALYZER_OPTS += --src -r test
  28. # Use erl_make_certs from the tested release.
  29. ci-setup:: clean deps test-deps
  30. $(gen_verbose) cp ~/.kerl/builds/$(CI_OTP_RELEASE)/otp_src_git/lib/ssl/test/erl_make_certs.erl deps/ct_helper/src/
  31. # Documentation.
  32. dep_ezdoc = git https://github.com/ninenines/ezdoc master
  33. $(eval $(call dep_target,ezdoc))
  34. build-doc-deps: $(DEPS_DIR)/ezdoc
  35. $(MAKE) -C $(DEPS_DIR)/ezdoc
  36. define ezdoc_script
  37. io:format("Building manual~n"),
  38. [begin
  39. AST = ezdoc:parse_file(F),
  40. BF = filename:rootname(filename:basename(F)),
  41. io:format(" ~s~n", [BF]),
  42. file:write_file("doc/markdown/manual/" ++ BF ++ ".md", ezdoc_markdown:export(AST)),
  43. case BF of
  44. "cowboy" ++ _ when BF =/= "cowboy_app" ->
  45. file:write_file("doc/man3/" ++ BF ++ ".3", ezdoc_man:export(3, AST));
  46. _ when BF =/= "index" ->
  47. file:write_file("doc/man7/" ++ BF ++ ".7", ezdoc_man:export(7, AST));
  48. _ ->
  49. ok
  50. end
  51. end || F <- filelib:wildcard("doc/src/manual/*.ezdoc")],
  52. io:format("Building guide~n"),
  53. [begin
  54. AST = ezdoc:parse_file(F),
  55. BF = filename:rootname(filename:basename(F)),
  56. io:format(" ~s~n", [BF]),
  57. file:write_file("doc/markdown/guide/" ++ BF ++ ".md", ezdoc_markdown:export(AST))
  58. end || F <- filelib:wildcard("doc/src/guide/*.ezdoc")],
  59. io:format("Done.~n"),
  60. init:stop().
  61. endef
  62. export ezdoc_script
  63. docs:: clean-docs build-doc-deps
  64. @mkdir -p doc/man3 doc/man7 doc/markdown/guide doc/markdown/manual
  65. $(gen_verbose) erl -noinput -pa ebin deps/ezdoc/ebin -eval "$$ezdoc_script"
  66. @gzip doc/man3/*.3 doc/man7/*.7
  67. @cp doc/src/guide/*.png doc/markdown/guide
  68. clean-docs:
  69. $(gen_verbose) rm -rf doc/man3 doc/man7 doc/markdown
  70. MAN_INSTALL_PATH ?= /usr/local/share/man
  71. install-docs:
  72. mkdir -p $(MAN_INSTALL_PATH)/man3/ $(MAN_INSTALL_PATH)/man7/
  73. install -g 0 -o 0 -m 0644 doc/man3/*.gz $(MAN_INSTALL_PATH)/man3/
  74. install -g 0 -o 0 -m 0644 doc/man7/*.gz $(MAN_INSTALL_PATH)/man7/