jesse/Makefile

129 lines
2.2 KiB
Makefile
Raw Normal View History

# See LICENSE for licensing information.
CHMOD := $(shell command -v chmod 2>/dev/null)
CURL := $(shell command -v curl 2>/dev/null)
LN := $(shell command -v ln 2>/dev/null)
OTP_RELEASE = $(shell erl -eval 'io:format("~s", [erlang:system_info(otp_release)]), halt().' -noshell)
2021-01-07 22:57:46 +00:00
ifdef CI
REBAR = ./rebar3.OTP$(OTP_RELEASE)
2021-01-06 22:40:14 +00:00
else
REBAR ?= $(shell command -v rebar3 2>/dev/null || echo "./rebar3.OTP$(OTP_RELEASE)")
2021-01-06 22:40:14 +00:00
endif
2015-12-05 23:31:05 +00:00
SRCS := $(wildcard src/* include/* rebar.config)
.PHONY: all
2020-03-07 15:20:22 +00:00
all: escript
2015-12-05 23:31:05 +00:00
# Clean
.PHONY: clean
clean:
2015-12-05 23:31:05 +00:00
$(REBAR) clean
2020-03-07 15:20:22 +00:00
.PHONY: distclean
distclean:
$(MAKE) clean
$(RM) -r _build
2015-12-05 23:31:05 +00:00
$(RM) doc/*.html
$(RM) doc/edoc-info
$(RM) doc/erlang.png
$(RM) doc/stylesheet.css
$(RM) -r logs
.PHONY: clean-tests
clean-tests:
@ rm -rf _build/test/lib
2021-05-26 21:36:12 +00:00
2015-12-05 23:31:05 +00:00
# Docs
.PHONY: docs
docs:
2020-03-07 15:20:22 +00:00
$(REBAR) edoc
2015-12-05 23:31:05 +00:00
# Compile
ebin/jesse.app: compile
2020-03-07 15:20:22 +00:00
.PHONY: escript
escript: ebin/jesse.app
$(REBAR) escriptize
2020-03-07 15:20:22 +00:00
./_build/default/bin/jesse --help
2015-12-05 23:31:05 +00:00
.PHONY: compile
compile: $(SRCS)
$(REBAR) compile
2021-05-27 18:43:17 +00:00
# Tests
2020-03-07 15:20:22 +00:00
test/JSON-Schema-Test-Suite/tests:
2021-01-06 01:17:05 +00:00
git submodule sync --recursive
git submodule update --init --recursive
.PHONY: test
2021-05-27 18:43:17 +00:00
# Would be nice to include elvis to test, but it fails on OTP-18
# test: elvis
2021-01-07 22:47:53 +00:00
test: eunit ct xref dialyzer cover
2021-05-27 18:43:17 +00:00
.PHONY: elvis
elvis:
$(REBAR) lint
2015-12-05 23:31:05 +00:00
.PHONY: eunit
2013-02-05 11:22:48 +00:00
eunit:
@ $(MAKE) clean-tests
2020-03-07 15:20:22 +00:00
$(REBAR) eunit
# @ rm -rf _build
2015-12-05 23:31:05 +00:00
.PHONY: ct
2020-03-07 15:20:22 +00:00
ct: test/JSON-Schema-Test-Suite/tests
@ $(MAKE) clean-tests
2020-03-07 15:20:22 +00:00
$(REBAR) ct
.PHONY: xref
xref:
2020-03-07 15:20:22 +00:00
$(REBAR) xref
2015-12-05 23:31:05 +00:00
.PHONY: dialyzer
2020-03-07 15:20:22 +00:00
dialyzer:
$(REBAR) dialyzer
2015-12-16 14:04:29 +00:00
2020-03-07 15:20:22 +00:00
.PHONY: cover
cover:
@ $(MAKE) clean-tests
2020-03-07 15:20:22 +00:00
$(REBAR) cover -v
.PHONY: rebar3.OTP18
rebar3.OTP18:
$(CURL) -fqsS -L -o $@ https://github.com/erlang/rebar3/releases/download/3.13.3/rebar3
$(CHMOD) +x $@
.PHONY: rebar3.OTP19
rebar3.OTP19:
$(CURL) -fqsS -L -o $@ https://github.com/erlang/rebar3/releases/download/3.15.2/rebar3
$(CHMOD) +x $@
.PHONY: rebar3.OTP20
rebar3.OTP20:
$(LN) -sf rebar3.OTP19 $@
.PHONY: rebar3.OTP21
rebar3.OTP21:
$(LN) -sf rebar3.OTP19 $@
.PHONY: rebar3.OTP22
rebar3.OTP22:
$(CURL) -fqsS -L -o $@ https://github.com/erlang/rebar3/releases/download/3.16.1/rebar3
$(CHMOD) +x $@
.PHONY: rebar3.OTP23
rebar3.OTP23:
$(LN) -sf rebar3.OTP22 $@
.PHONY: rebar3.OTP24
rebar3.OTP24:
$(LN) -sf rebar3.OTP22 $@