Makefile 2.2 KB

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