Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # See LICENSE for licensing information.
  2. PROJECT = cowboy
  3. # Options.
  4. ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars \
  5. +warn_shadow_vars +warn_obsolete_guard +warn_missing_spec
  6. COMPILE_FIRST = cowboy_middleware cowboy_sub_protocol
  7. CT_OPTS += -pa test -ct_hooks cowboy_ct_hook []
  8. PLT_APPS = crypto public_key ssl
  9. CI_OTP = OTP_R16B01 OTP_R16B02 OTP_R16B03-1 OTP-17.0.2 OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.6.2 OTP-18.0.2
  10. # Dependencies.
  11. DEPS = cowlib ranch
  12. dep_cowlib_commit = 1.0.2
  13. dep_ranch_commit = 1.3.2
  14. TEST_DEPS = ct_helper gun
  15. dep_ct_helper = git https://github.com/extend/ct_helper.git master
  16. dep_gun = git https://github.com/ninenines/gun b85c1f726ca49ac0e3abdcf717317cb95b06207d
  17. # Standard targets.
  18. include erlang.mk
  19. # Documentation.
  20. dep_ezdoc = git https://github.com/ninenines/ezdoc master
  21. $(eval $(call dep_target,ezdoc))
  22. build-doc-deps: $(DEPS_DIR)/ezdoc
  23. $(MAKE) -C $(DEPS_DIR)/ezdoc
  24. define ezdoc_script
  25. io:format("Building manual~n"),
  26. [begin
  27. AST = ezdoc:parse_file(F),
  28. BF = filename:rootname(filename:basename(F)),
  29. io:format(" ~s~n", [BF]),
  30. file:write_file("doc/markdown/manual/" ++ BF ++ ".md", ezdoc_markdown:export(AST)),
  31. case BF of
  32. "cowboy" ++ _ when BF =/= "cowboy_app" ->
  33. file:write_file("doc/man3/" ++ BF ++ ".3", ezdoc_man:export(3, AST));
  34. _ when BF =/= "index" ->
  35. file:write_file("doc/man7/" ++ BF ++ ".7", ezdoc_man:export(7, AST));
  36. _ ->
  37. ok
  38. end
  39. end || F <- filelib:wildcard("doc/src/manual/*.ezdoc")],
  40. io:format("Building guide~n"),
  41. [begin
  42. AST = ezdoc:parse_file(F),
  43. BF = filename:rootname(filename:basename(F)),
  44. io:format(" ~s~n", [BF]),
  45. file:write_file("doc/markdown/guide/" ++ BF ++ ".md", ezdoc_markdown:export(AST))
  46. end || F <- filelib:wildcard("doc/src/guide/*.ezdoc")],
  47. io:format("Done.~n"),
  48. init:stop().
  49. endef
  50. export ezdoc_script
  51. docs:: clean-docs build-doc-deps
  52. @mkdir -p doc/man3 doc/man7 doc/markdown/guide doc/markdown/manual
  53. $(gen_verbose) erl -noinput -pa ebin deps/ezdoc/ebin -eval "$$ezdoc_script"
  54. @gzip doc/man3/*.3 doc/man7/*.7
  55. @cp doc/src/guide/*.png doc/markdown/guide
  56. clean-docs:
  57. $(gen_verbose) rm -rf doc/man3 doc/man7 doc/markdown
  58. MAN_INSTALL_PATH ?= /usr/local/share/man
  59. install-docs:
  60. mkdir -p $(MAN_INSTALL_PATH)/man3/ $(MAN_INSTALL_PATH)/man7/
  61. install -g 0 -o 0 -m 0644 doc/man3/*.gz $(MAN_INSTALL_PATH)/man3/
  62. install -g 0 -o 0 -m 0644 doc/man7/*.gz $(MAN_INSTALL_PATH)/man7/