Skip to content

Commit 25a5dbc

Browse files
author
José Valim
committed
Only check for erlang release when copying .app file
This way we avoid the cost of checking it on every command. When copying the .app file must be enough as we'd change the Erlang requirement only on new versions.
1 parent b76387a commit 25a5dbc

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ELIXIRC := bin/elixirc --verbose --ignore-module-conflict
33
ERLC := erlc -I lib/elixir/include
44
ERL := erl -I lib/elixir/include -noshell -pa lib/elixir/ebin
55
VERSION := $(strip $(shell cat VERSION))
6-
MIN_ERLANG_VERSION := 17
76
Q := @
87
PREFIX := /usr/local
98
LIBDIR := lib
@@ -15,7 +14,17 @@ INSTALL_PROGRAM = $(INSTALL) -m755
1514
.PHONY: install compile erlang elixir dialyze test clean docs release_docs release_zip check_erlang_release
1615
.NOTPARALLEL: compile
1716

18-
#==> Templates
17+
#==> Functions
18+
19+
# This check should work for older versions like R16B
20+
# as well as new verions like 17.1 and 18
21+
define CHECK_ERLANG_RELEASE
22+
$(Q) erl -noshell -eval 'io:fwrite("~s", [erlang:system_info(otp_release)])' -s erlang halt | grep -q '^1[789]'; \
23+
if [ $$? != 0 ]; then \
24+
echo "At least Erlang 17.0 is required to build Elixir"; \
25+
exit 1; \
26+
fi;
27+
endef
1928

2029
define APP_TEMPLATE
2130
$(1): lib/$(1)/ebin/Elixir.$(2).beam lib/$(1)/ebin/$(1).app
@@ -44,18 +53,10 @@ UNICODE:=lib/elixir/ebin/Elixir.String.Unicode.beam
4453

4554
default: compile
4655

47-
compile: check_erlang_release lib/elixir/src/elixir.app.src erlang elixir
48-
49-
# this check should work for older versions like R16B
50-
# as well as new verions like 17.1 and 18
51-
check_erlang_release:
52-
@ erl -noshell -eval 'io:fwrite("~s", [erlang:system_info(otp_release)])' -s erlang halt | grep -q '^1[789]'; \
53-
if [ $$? != 0 ]; then \
54-
echo "At least Erlang 17.0 is required to build Elixir"; \
55-
exit 1; \
56-
fi
56+
compile: lib/elixir/src/elixir.app.src erlang elixir
5757

5858
lib/elixir/src/elixir.app.src: src/elixir.app.src
59+
$(Q) $(call CHECK_ERLANG_RELEASE)
5960
$(Q) rm -rf lib/elixir/src/elixir.app.src
6061
$(Q) echo "%% This file is automatically generated from <project_root>/src/elixir.app.src" \
6162
>lib/elixir/src/elixir.app.src

lib/elixir/rebar.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@
2121
{report, true},
2222
{verbose, false}
2323
]}.
24-
25-
{require_otp_vsn,"(17).*"}.

0 commit comments

Comments
 (0)