2012-06-18 15:57:59 +00:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
REBAR ?= $(shell command -v rebar >/dev/null 2>&1 && echo "rebar" || echo "$(CURDIR)/rebar")
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-16 14:04:29 +00:00
|
|
|
ELVIS ?= $(shell command -v elvis >/dev/null 2>&1 && echo "elvis" || echo "$(CURDIR)/elvis")
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
DEPS_PLT := $(CURDIR)/.deps_plt
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
ERLANG_DIALYZER_APPS := erts \
|
2016-01-30 21:58:43 +00:00
|
|
|
kernel \
|
2015-12-14 22:49:35 +00:00
|
|
|
stdlib \
|
|
|
|
inets
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
DIALYZER := dialyzer
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
# Travis CI is slow at building dialyzer PLT
|
2018-04-06 13:25:17 +00:00
|
|
|
TRAVIS ?=
|
|
|
|
ifeq (true,$(TRAVIS))
|
2015-12-17 00:34:01 +00:00
|
|
|
OTP_VSN := $(shell erl -noshell -eval 'io:format("~p", [erlang:system_info(otp_release)]), erlang:halt(0).' | perl -lne 'print for /^(?:"R)?(\d+).*/g')
|
2015-12-14 22:59:16 +00:00
|
|
|
NO_DIALYZER := $(shell expr $(OTP_VSN) \<= 16 )
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-14 22:59:16 +00:00
|
|
|
ifeq ($(NO_DIALYZER), 1)
|
|
|
|
DIALYZER := : not running dialyzer on TRAVIS with R16 and below
|
2015-12-05 23:31:05 +00:00
|
|
|
endif
|
|
|
|
endif
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
SRCS := $(wildcard src/* include/* rebar.config)
|
|
|
|
|
2016-01-30 21:43:48 +00:00
|
|
|
SRC_BEAMS := $(patsubst src/%.erl, ebin/%.beam, $(wildcard src/*.erl))
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: all
|
2016-01-30 21:58:03 +00:00
|
|
|
all: maybe_dev deps ebin/jesse.app bin/jesse
|
|
|
|
|
|
|
|
.PHONY: maybe_dev
|
|
|
|
maybe_dev:
|
|
|
|
ifdef CI
|
|
|
|
$(MAKE) --no-print-directory .rebar/DEV_MODE
|
|
|
|
else
|
|
|
|
@:
|
|
|
|
endif
|
2015-12-05 23:31:05 +00:00
|
|
|
|
|
|
|
# Clean
|
|
|
|
|
|
|
|
.PHONY: clean
|
2012-06-18 15:57:59 +00:00
|
|
|
clean:
|
2015-12-05 23:31:05 +00:00
|
|
|
$(REBAR) clean
|
|
|
|
$(RM) -r .rebar
|
|
|
|
$(RM) -r bin
|
|
|
|
$(RM) doc/*.html
|
|
|
|
$(RM) doc/edoc-info
|
|
|
|
$(RM) doc/erlang.png
|
|
|
|
$(RM) doc/stylesheet.css
|
|
|
|
$(RM) -r ebin
|
|
|
|
$(RM) -r logs
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean:
|
|
|
|
$(RM) $(DEPS_PLT)
|
|
|
|
$(RM) -r deps
|
|
|
|
$(MAKE) clean
|
|
|
|
|
|
|
|
# Deps
|
|
|
|
|
|
|
|
.PHONY: get-deps
|
|
|
|
get-deps:
|
|
|
|
$(REBAR) get-deps
|
2016-02-28 21:31:54 +00:00
|
|
|
[ -f .rebar/DEV_MODE ] && git submodule update --init --recursive || true
|
2015-12-05 23:31:05 +00:00
|
|
|
|
|
|
|
.PHONY: update-deps
|
|
|
|
update-deps:
|
|
|
|
$(REBAR) update-deps
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: delete-deps
|
|
|
|
delete-deps:
|
|
|
|
$(REBAR) delete-deps
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: deps
|
|
|
|
deps: get-deps
|
|
|
|
|
|
|
|
# Docs
|
|
|
|
|
|
|
|
.PHONY: docs
|
|
|
|
docs:
|
|
|
|
$(REBAR) doc skip_deps=true
|
|
|
|
|
|
|
|
# Compile
|
|
|
|
|
|
|
|
ebin/jesse.app: compile
|
|
|
|
|
2016-01-30 21:43:48 +00:00
|
|
|
bin/jesse: ebin/jesse.app $(SRC_BEAMS)
|
2015-12-06 19:40:49 +00:00
|
|
|
$(REBAR) escriptize
|
|
|
|
bin/jesse --help
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: compile
|
|
|
|
compile: $(SRCS)
|
|
|
|
$(REBAR) compile
|
2012-06-18 15:57:59 +00:00
|
|
|
|
|
|
|
# Tests.
|
|
|
|
|
2016-03-08 17:03:57 +00:00
|
|
|
.PHONY: test
|
|
|
|
test: .rebar/DEV_MODE deps eunit ct xref dialyzer
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.rebar/DEV_MODE:
|
|
|
|
mkdir -p .rebar
|
|
|
|
touch .rebar/DEV_MODE
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: eunit
|
2013-02-05 11:22:48 +00:00
|
|
|
eunit:
|
2015-12-05 23:31:05 +00:00
|
|
|
$(REBAR) eunit skip_deps=true
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: ct
|
2013-02-05 11:22:48 +00:00
|
|
|
ct:
|
2015-12-14 14:56:31 +00:00
|
|
|
$(REBAR) ct skip_deps=true suites="jesse_tests_draft3,jesse_tests_draft4"
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2016-03-08 17:03:57 +00:00
|
|
|
.PHONY: xref
|
|
|
|
xref:
|
|
|
|
$(REBAR) xref skip_deps=true
|
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
$(DEPS_PLT):
|
|
|
|
$(DIALYZER) --build_plt --apps $(ERLANG_DIALYZER_APPS) -r deps --output_plt $(DEPS_PLT)
|
2012-06-18 15:57:59 +00:00
|
|
|
|
2015-12-05 23:31:05 +00:00
|
|
|
.PHONY: dialyzer
|
2016-01-26 15:01:11 +00:00
|
|
|
dialyzer: $(DEPS_PLT) ebin/jesse.app
|
2016-03-08 17:03:57 +00:00
|
|
|
$(DIALYZER) -q --plt $(DEPS_PLT) -Wno_return ebin > test/dialyzer_warnings || true
|
|
|
|
diff -U0 test/known_dialyzer_warnings test/dialyzer_warnings
|
2015-12-16 14:04:29 +00:00
|
|
|
|
|
|
|
.PHONY: elvis
|
|
|
|
elvis:
|
2016-03-08 17:03:57 +00:00
|
|
|
$(ELVIS) rock > test/elvis || true
|
|
|
|
grep "FAIL" test/elvis | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > test/elvis_warnings
|
|
|
|
diff -U0 test/known_elvis_warnings test/elvis_warnings || cat test/elvis
|