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