Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. TEST_DEPS = ct_helper gun
  13. dep_ct_helper = git https://github.com/extend/ct_helper.git master
  14. # Standard targets.
  15. include erlang.mk
  16. # Documentation.
  17. dep_ezdoc = git https://github.com/ninenines/ezdoc master
  18. $(eval $(call dep_target,ezdoc))
  19. build-doc-deps: $(DEPS_DIR)/ezdoc
  20. $(MAKE) -C $(DEPS_DIR)/ezdoc
  21. define ezdoc_script
  22. io:format("Building manual~n"),
  23. [begin
  24. AST = ezdoc:parse_file(F),
  25. BF = filename:rootname(filename:basename(F)),
  26. io:format(" ~s~n", [BF]),
  27. file:write_file("doc/markdown/manual/" ++ BF ++ ".md", ezdoc_markdown:export(AST)),
  28. case BF of
  29. "cowboy" ++ _ when BF =/= "cowboy_app" ->
  30. file:write_file("doc/man3/" ++ BF ++ ".3", ezdoc_man:export(3, AST));
  31. _ when BF =/= "index" ->
  32. file:write_file("doc/man7/" ++ BF ++ ".7", ezdoc_man:export(7, AST));
  33. _ ->
  34. ok
  35. end
  36. end || F <- filelib:wildcard("doc/src/manual/*.ezdoc")],
  37. io:format("Building guide~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/guide/" ++ BF ++ ".md", ezdoc_markdown:export(AST))
  43. end || F <- filelib:wildcard("doc/src/guide/*.ezdoc")],
  44. io:format("Done.~n"),
  45. init:stop().
  46. endef
  47. export ezdoc_script
  48. docs:: clean-docs build-doc-deps
  49. @mkdir -p doc/man3 doc/man7 doc/markdown/guide doc/markdown/manual
  50. $(gen_verbose) erl -noinput -pa ebin deps/ezdoc/ebin -eval "$$ezdoc_script"
  51. @gzip doc/man3/*.3 doc/man7/*.7
  52. @cp doc/src/guide/*.png doc/markdown/guide
  53. clean-docs:
  54. $(gen_verbose) rm -rf doc/man3 doc/man7 doc/markdown
  55. MAN_INSTALL_PATH ?= /usr/local/share/man
  56. install-docs:
  57. mkdir -p $(MAN_INSTALL_PATH)/man3/ $(MAN_INSTALL_PATH)/man7/
  58. install -g 0 -o 0 -m 0644 doc/man3/*.gz $(MAN_INSTALL_PATH)/man3/
  59. install -g 0 -o 0 -m 0644 doc/man7/*.gz $(MAN_INSTALL_PATH)/man7/