From 2d35cb644d973f81af09c6f8d342e4838a548f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 29 Nov 2018 13:11:05 +0100 Subject: 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. --- plugins/c_src.mk | 11 +++++++++-- plugins/ci.mk | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'plugins') 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" \ -- cgit v1.2.3