summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-13 16:50:43 +0200
committerJean-Sébastien Pédron <jean-sebastien.pedron@dumbbell.fr>2015-10-20 11:10:48 +0200
commit266853faa151ceb5193e27f6d43a1ed981b9f59d (patch)
tree649d398527ffb38a0a52a757a031a26546726ec4
parent01d8cb1a7853ec050f8ef170c259d3fc9babf451 (diff)
downloadrabbitmq-server-git-266853faa151ceb5193e27f6d43a1ed981b9f59d.tar.gz
Makefile: Use `erl -version` to do ERTS version tests
This is way faster than starting a full VM. Use awk to perform the comparison.
-rw-r--r--Makefile27
1 files changed, 22 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index d8424dc795..a466659c8d 100644
--- a/Makefile
+++ b/Makefile
@@ -92,11 +92,28 @@ define boolean_macro
$(if $(filter true,$(1)),-D$(2))
endef
-ifndef USE_SPECS
-# our type specs rely on dict:dict/0 etc, which are only available in 17.0
-# upwards.
-USE_SPECS := $(shell erl -noshell -eval 'io:format([list_to_integer(X) || X <- string:tokens(erlang:system_info(version), ".")] >= [5,11]), halt().')
-ERLC_OPTS += $(call boolean_macro,$(USE_SPECS),use_specs)
+# Our type specs rely on dict:dict/0 etc, which are only available in
+# 17.0 upwards.
+define compare_version
+$(shell awk 'BEGIN {
+ split("$(1)", v1, "\.");
+ version1 = v1[1] * 1000000 + v1[2] * 10000 + v1[3] * 100 + v1[4];
+
+ split("$(2)", v2, "\.");
+ version2 = v2[1] * 1000000 + v2[2] * 10000 + v2[3] * 100 + v2[4];
+
+ if (version1 $(3) version2) {
+ print "true";
+ } else {
+ print "false";
+ }
+}')
+endef
+
+ERTS_VER = $(shell erl -version 2>&1 | sed -E 's/.* version //')
+USE_SPECS_MIN_ERTS_VER = 5.11
+ifeq ($(call compare_version,$(ERTS_VER),$(USE_SPECS_MIN_ERTS_VER),>=),true)
+ERLC_OPTS += -Duse_specs
endif
ifndef USE_PROPER_QC