Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # See LICENSE for licensing information.
  2. PROJECT = cowlib
  3. PROJECT_DESCRIPTION = Support library for manipulating Web protocols.
  4. PROJECT_VERSION = 2.11.0
  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 main
  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. <<"Sponsor">> => <<"https://github.com/sponsors/essen">>
  37. }
  38. }
  39. endef
  40. # Standard targets.
  41. include erlang.mk
  42. # Compile options.
  43. TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}' +'{parse_transform, horse_autoexport}'
  44. # Mimetypes module generator.
  45. GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
  46. GEN_SRC = src/cow_mimetypes.erl.src
  47. GEN_OUT = src/cow_mimetypes.erl
  48. .PHONY: gen
  49. gen:
  50. $(gen_verbose) cat $(GEN_SRC) \
  51. | head -n `grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  52. > $(GEN_OUT)
  53. $(gen_verbose) wget -qO - $(GEN_URL) \
  54. | grep -v ^# \
  55. | awk '{for (i=2; i<=NF; i++) if ($$i != "") { \
  56. split($$1, a, "/"); \
  57. print "all_ext(<<\"" $$i "\">>) -> {<<\"" \
  58. a[1] "\">>, <<\"" a[2] "\">>, []};"}}' \
  59. | sort \
  60. | uniq -w 25 \
  61. >> $(GEN_OUT)
  62. $(gen_verbose) cat $(GEN_SRC) \
  63. | tail -n +`grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  64. >> $(GEN_OUT)
  65. # Performance testing.
  66. ifeq ($(MAKECMDGOALS),perfs)
  67. .NOTPARALLEL:
  68. endif
  69. .PHONY: perfs
  70. perfs: test-build
  71. $(gen_verbose) erl -noshell -pa ebin -eval 'horse:app_perf($(PROJECT)), erlang:halt().'
  72. # Prepare for the release.
  73. prepare_tag:
  74. $(verbose) $(warning Hex metadata: $(HEX_TARBALL_EXTRA_METADATA))
  75. $(verbose) echo
  76. $(verbose) echo -n "Most recent tag: "
  77. $(verbose) git tag --sort taggerdate | tail -n1
  78. $(verbose) git verify-tag `git tag --sort taggerdate | tail -n1`
  79. $(verbose) echo -n "MAKEFILE: "
  80. $(verbose) grep -m1 PROJECT_VERSION Makefile
  81. $(verbose) echo -n "APP: "
  82. $(verbose) grep -m1 vsn ebin/$(PROJECT).app | sed 's/ //g'
  83. $(verbose) echo
  84. $(verbose) echo "Dependencies:"
  85. $(verbose) grep ^DEPS Makefile || echo "DEPS ="
  86. $(verbose) grep ^dep_ Makefile || true