Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # See LICENSE for licensing information.
  2. PROJECT = cowlib
  3. PROJECT_DESCRIPTION = Support library for manipulating Web protocols.
  4. PROJECT_VERSION = 2.10.1
  5. # Options.
  6. #ERLC_OPTS += +bin_opt_info
  7. ifdef HIPE
  8. ERLC_OPTS += -smp +native
  9. TEST_ERLC_OPTS += -smp +native
  10. endif
  11. DIALYZER_OPTS = -Werror_handling -Wunmatched_returns
  12. # Dependencies.
  13. LOCAL_DEPS = crypto
  14. DOC_DEPS = asciideck
  15. TEST_DEPS = $(if $(CI_ERLANG_MK),ci.erlang.mk) base32 horse proper jsx \
  16. structured-header-tests uritemplate-tests
  17. dep_base32 = git https://github.com/dnsimple/base32_erlang master
  18. dep_horse = git https://github.com/ninenines/horse.git master
  19. dep_jsx = git https://github.com/talentdeficit/jsx v2.10.0
  20. dep_structured-header-tests = git https://github.com/httpwg/structured-header-tests e614583397e7f65e0082c0fff3929f32a298b9f2
  21. dep_uritemplate-tests = git https://github.com/uri-templates/uritemplate-test master
  22. # CI configuration.
  23. dep_ci.erlang.mk = git https://github.com/ninenines/ci.erlang.mk master
  24. DEP_EARLY_PLUGINS = ci.erlang.mk
  25. AUTO_CI_OTP ?= OTP-21+
  26. AUTO_CI_HIPE ?= OTP-LATEST
  27. # AUTO_CI_ERLLVM ?= OTP-LATEST
  28. AUTO_CI_WINDOWS ?= OTP-21+
  29. # Hex configuration.
  30. define HEX_TARBALL_EXTRA_METADATA
  31. #{
  32. licenses => [<<"ISC">>],
  33. links => #{
  34. <<"Function reference">> => <<"https://ninenines.eu/docs/en/cowlib/2.10/manual/">>,
  35. <<"GitHub">> => <<"https://github.com/ninenines/cowlib">>
  36. }
  37. }
  38. endef
  39. # Standard targets.
  40. include erlang.mk
  41. # Compile options.
  42. TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}' +'{parse_transform, horse_autoexport}'
  43. # Mimetypes module generator.
  44. GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
  45. GEN_SRC = src/cow_mimetypes.erl.src
  46. GEN_OUT = src/cow_mimetypes.erl
  47. .PHONY: gen
  48. gen:
  49. $(gen_verbose) cat $(GEN_SRC) \
  50. | head -n `grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  51. > $(GEN_OUT)
  52. $(gen_verbose) wget -qO - $(GEN_URL) \
  53. | grep -v ^# \
  54. | awk '{for (i=2; i<=NF; i++) if ($$i != "") { \
  55. split($$1, a, "/"); \
  56. print "all_ext(<<\"" $$i "\">>) -> {<<\"" \
  57. a[1] "\">>, <<\"" a[2] "\">>, []};"}}' \
  58. | sort \
  59. | uniq -w 25 \
  60. >> $(GEN_OUT)
  61. $(gen_verbose) cat $(GEN_SRC) \
  62. | tail -n +`grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  63. >> $(GEN_OUT)
  64. # Performance testing.
  65. ifeq ($(MAKECMDGOALS),perfs)
  66. .NOTPARALLEL:
  67. endif
  68. .PHONY: perfs
  69. perfs: test-build
  70. $(gen_verbose) erl -noshell -pa ebin -eval 'horse:app_perf($(PROJECT)), erlang:halt().'
  71. # Prepare for the release.
  72. prepare_tag:
  73. $(verbose) $(warning Hex metadata: $(HEX_TARBALL_EXTRA_METADATA))
  74. $(verbose) echo
  75. $(verbose) echo -n "Most recent tag: "
  76. $(verbose) git tag --sort taggerdate | tail -n1
  77. $(verbose) git verify-tag `git tag --sort taggerdate | tail -n1`
  78. $(verbose) echo -n "MAKEFILE: "
  79. $(verbose) grep -m1 PROJECT_VERSION Makefile
  80. $(verbose) echo -n "APP: "
  81. $(verbose) grep -m1 vsn ebin/$(PROJECT).app | sed 's/ //g'
  82. $(verbose) echo
  83. $(verbose) echo "Dependencies:"
  84. $(verbose) grep ^DEPS Makefile || echo "DEPS ="
  85. $(verbose) grep ^dep_ Makefile || true