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