Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # See LICENSE for licensing information.
  2. PROJECT = cowboy
  3. RANCH_VSN = 0.6.0
  4. ERLC_OPTS = -Werror +debug_info +warn_export_all # +bin_opt_info +warn_missing_spec
  5. .PHONY: all clean-all app clean docs clean-docs tests autobahn build-plt dialyze
  6. # Application.
  7. all: app
  8. clean-all: clean clean-docs
  9. rm -f .$(PROJECT).plt
  10. rm -rf deps logs
  11. deps/ranch:
  12. @mkdir -p deps/
  13. git clone -n -- https://github.com/extend/ranch.git deps/ranch
  14. cd deps/ranch ; git checkout -q $(RANCH_VSN)
  15. MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
  16. app: deps/ranch
  17. @cd deps/ranch ; make
  18. @mkdir -p ebin/
  19. @cat src/cowboy.app.src \
  20. | sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
  21. > ebin/cowboy.app
  22. erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ src/cowboy_middleware.erl src/*.erl
  23. clean:
  24. -@cd deps/ranch && make clean
  25. rm -rf ebin/
  26. rm -f test/*.beam
  27. rm -f erl_crash.dump
  28. # Documentation.
  29. docs: clean-docs
  30. erl -noshell -eval 'edoc:application(cowboy, ".", []), init:stop().'
  31. clean-docs:
  32. rm -f doc/*.css
  33. rm -f doc/*.html
  34. rm -f doc/*.png
  35. rm -f doc/edoc-info
  36. # Tests.
  37. CT_RUN = ct_run \
  38. -pa ebin deps/*/ebin \
  39. -dir test \
  40. -logdir logs \
  41. -cover test/cover.spec
  42. tests: ERLC_OPTS += -DTEST=1
  43. tests: clean app
  44. @mkdir -p logs/
  45. @$(CT_RUN) -suite eunit_SUITE http_SUITE ws_SUITE
  46. autobahn: clean app
  47. @mkdir -p logs/
  48. @$(CT_RUN) -suite autobahn_SUITE
  49. # Dialyzer.
  50. build-plt: app
  51. @dialyzer --build_plt --output_plt .$(PROJECT).plt \
  52. --apps erts kernel stdlib sasl inets crypto public_key ssl deps/ranch
  53. dialyze:
  54. @dialyzer --src src --plt .$(PROJECT).plt --no_native \
  55. -Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs