Skip to content

Commit

Permalink
Parametrize the rebar binary (processone/fast_tls#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Jun 20, 2021
1 parent 801962e commit bfa403c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
REBAR=./rebar
REBAR ?= ./rebar

IS_REBAR3:=$(shell expr `$(REBAR) --version | awk -F '[ .]' '/rebar / {print $$2}'` '>=' 3)

all: src

src:
$(REBAR) get-deps compile
$(REBAR) get-deps
$(REBAR) compile

clean:
$(REBAR) clean

distclean: clean
rm -rf _build
rm -rf deps
rm -rf ebin
rm -rf dialyzer

test: all
$(REBAR) -v skip_deps=true eunit
$(REBAR) eunit

xref: all
$(REBAR) skip_deps=true xref
$(REBAR) xref

ifeq "$(IS_REBAR3)" "1"
dialyzer:
$(REBAR) dialyzer
else
deps := $(wildcard deps/*/ebin)

APPS=kernel stdlib erts public_key crypto asn1
Expand Down Expand Up @@ -57,6 +65,7 @@ dialyzer: erlang_plt pkix_plt #deps_plt pkix_plt
@dialyzer --plts dialyzer/*.plt --no_check_plt \
--get_warnings -o dialyzer/error.log ebin; \
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
endif

check-syntax:
gcc -o nul -S ${CHK_SOURCES}
Expand Down
6 changes: 5 additions & 1 deletion test/pkix_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ stop_test() ->
%%%===================================================================
test_dir() ->
{ok, Cwd} = file:get_cwd(),
filename:join(filename:dirname(Cwd), "test").
CwdClean = case lists:reverse(filename:split(Cwd)) of
[".eunit" | Tail] -> Tail; % when using rebar2
Tail -> Tail % when using rebar3
end,
filename:join(lists:reverse(["test" | CwdClean])).

path(File) ->
unicode:characters_to_binary(filename:join(test_dir(), File)).
Expand Down

0 comments on commit bfa403c

Please sign in to comment.