Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. decimal 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_decimal = git https://github.com/egobrain/decimal 0.6.2
  21. dep_structured-header-tests = git https://github.com/httpwg/structured-header-tests main
  22. dep_uritemplate-tests = git https://github.com/uri-templates/uritemplate-test master
  23. # CI configuration.
  24. dep_ci.erlang.mk = git https://github.com/ninenines/ci.erlang.mk master
  25. DEP_EARLY_PLUGINS = ci.erlang.mk
  26. AUTO_CI_OTP ?= OTP-21+
  27. AUTO_CI_HIPE ?= OTP-LATEST
  28. # AUTO_CI_ERLLVM ?= OTP-LATEST
  29. AUTO_CI_WINDOWS ?= OTP-21+
  30. # Always rebuild deps in CI because OTP-25.0+ can't use the older build.
  31. ci-setup:: distclean-deps
  32. # Hex configuration.
  33. define HEX_TARBALL_EXTRA_METADATA
  34. #{
  35. licenses => [<<"ISC">>],
  36. links => #{
  37. <<"Function reference">> => <<"https://ninenines.eu/docs/en/cowlib/2.11/manual/">>,
  38. <<"GitHub">> => <<"https://github.com/ninenines/cowlib">>,
  39. <<"Sponsor">> => <<"https://github.com/sponsors/essen">>
  40. }
  41. }
  42. endef
  43. # Standard targets.
  44. include erlang.mk
  45. # Compile options.
  46. TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}' +'{parse_transform, horse_autoexport}'
  47. # Mimetypes module generator.
  48. GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
  49. GEN_SRC = src/cow_mimetypes.erl.src
  50. GEN_OUT = src/cow_mimetypes.erl
  51. .PHONY: gen
  52. gen:
  53. $(gen_verbose) cat $(GEN_SRC) \
  54. | head -n `grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  55. > $(GEN_OUT)
  56. $(gen_verbose) wget -qO - $(GEN_URL) \
  57. | grep -v ^# \
  58. | awk '{for (i=2; i<=NF; i++) if ($$i != "") { \
  59. split($$1, a, "/"); \
  60. print "all_ext(<<\"" $$i "\">>) -> {<<\"" \
  61. a[1] "\">>, <<\"" a[2] "\">>, []};"}}' \
  62. | sort \
  63. | uniq -w 25 \
  64. >> $(GEN_OUT)
  65. $(gen_verbose) cat $(GEN_SRC) \
  66. | tail -n +`grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
  67. >> $(GEN_OUT)
  68. # Performance testing.
  69. ifeq ($(MAKECMDGOALS),perfs)
  70. .NOTPARALLEL:
  71. endif
  72. .PHONY: perfs
  73. perfs: test-build
  74. $(gen_verbose) erl -noshell -pa ebin -eval 'horse:app_perf($(PROJECT)), erlang:halt().'
  75. # Prepare for the release.
  76. prepare_tag:
  77. $(verbose) $(warning Hex metadata: $(HEX_TARBALL_EXTRA_METADATA))
  78. $(verbose) echo
  79. $(verbose) echo -n "Most recent tag: "
  80. $(verbose) git tag --sort taggerdate | tail -n1
  81. $(verbose) git verify-tag `git tag --sort taggerdate | tail -n1`
  82. $(verbose) echo -n "MAKEFILE: "
  83. $(verbose) grep -m1 PROJECT_VERSION Makefile
  84. $(verbose) echo -n "APP: "
  85. $(verbose) grep -m1 vsn ebin/$(PROJECT).app | sed 's/ //g'
  86. $(verbose) echo
  87. $(verbose) echo "Dependencies:"
  88. $(verbose) grep ^DEPS Makefile || echo "DEPS ="
  89. $(verbose) grep ^dep_ Makefile || true