aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-29 13:11:05 +0100
committerLoïc Hoguin <[email protected]>2018-11-29 13:24:34 +0100
commit2d35cb644d973f81af09c6f8d342e4838a548f7b (patch)
treef01f2a0d9db921d0cfb15d8091c6754b6021378c
parentf943ca241be408177be5d0cfae9815dc87ecffb9 (diff)
downloaderlang.mk-2d35cb644d973f81af09c6f8d342e4838a548f7b.tar.gz
erlang.mk-2d35cb644d973f81af09c6f8d342e4838a548f7b.tar.bz2
erlang.mk-2d35cb644d973f81af09c6f8d342e4838a548f7b.zip
Rebuild the env.mk file when the Erlang/OTP has changed
We also rebuild the C code since C code tends to not stay compatible between different Erlang versions. Based on a patch by Slava Yurin.
-rw-r--r--plugins/c_src.mk11
-rw-r--r--plugins/ci.mk2
2 files changed, 10 insertions, 3 deletions
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index bd46613..92711ce 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -103,7 +103,7 @@ $(C_SRC_OUTPUT_FILE): $(OBJECTS)
$(LDFLAGS) $(if $(filter $(C_SRC_TYPE),shared),-shared) $(LDLIBS) \
-o $(C_SRC_OUTPUT_FILE)
-$(OBJECTS): $(MAKEFILE_LIST)
+$(OBJECTS): $(MAKEFILE_LIST) $(C_SRC_ENV)
%.o: %.c
$(COMPILE_C) $(OUTPUT_OPTION) $<
@@ -125,13 +125,16 @@ clean-c_src:
endif
ifneq ($(wildcard $(C_SRC_DIR)),)
+ERL_ERTS_DIR = $(shell $(ERL) -eval 'io:format("~s~n", [code:lib_dir(erts)]), halt().')
+
$(C_SRC_ENV):
$(verbose) $(ERL) -eval "file:write_file(\"$(call core_native_path,$(C_SRC_ENV))\", \
io_lib:format( \
\"# Generated by Erlang.mk. Edit at your own risk!~n~n\" \
\"ERTS_INCLUDE_DIR ?= ~s/erts-~s/include/~n\" \
\"ERL_INTERFACE_INCLUDE_DIR ?= ~s~n\" \
- \"ERL_INTERFACE_LIB_DIR ?= ~s~n\", \
+ \"ERL_INTERFACE_LIB_DIR ?= ~s~n\" \
+ \"ERTS_DIR ?= $(ERL_ERTS_DIR)~n\", \
[code:root_dir(), erlang:system_info(version), \
code:lib_dir(erl_interface, include), \
code:lib_dir(erl_interface, lib)])), \
@@ -143,6 +146,10 @@ distclean-c_src-env:
$(gen_verbose) rm -f $(C_SRC_ENV)
-include $(C_SRC_ENV)
+
+ifneq ($(ERL_ERTS_DIR),$(ERTS_DIR))
+$(shell rm -f $(C_SRC_ENV))
+endif
endif
# Templates.
diff --git a/plugins/ci.mk b/plugins/ci.mk
index 0881d49..52cf8f3 100644
--- a/plugins/ci.mk
+++ b/plugins/ci.mk
@@ -32,7 +32,7 @@ ci_verbose = $(ci_verbose_$(V))
define ci_target
ci-$1: $(KERL_INSTALL_DIR)/$2
- $(verbose) $(MAKE) --no-print-directory clean distclean-c_src-env
+ $(verbose) $(MAKE) --no-print-directory clean
$(ci_verbose) \
PATH="$(KERL_INSTALL_DIR)/$2/bin:$(PATH)" \
CI_OTP_RELEASE="$1" \