From c849da35563a2fef207fa824bc89dc01e7a5e96f Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Fri, 7 Oct 2016 17:40:05 -0400 Subject: Support C compiler flag overrides for dependencies This change makes it possible to override the ERL_CFLAGS and ERL_LDFLAGS Makefile variables in project dependencies. For the main project, the ability to override variables associated with C compilation already existed in plugins/c_src.mk. With this change, the C compiler flag semantics are similar for both the main project and dependencies. This is important for cases where the automatically determined values for the ERTS include and library directories are incorrect. This happens in cross-compiled environments where they point to the host's include and library directories. However, the desired behaviour is to have them point to those that have been cross-compiled for the target. --- core/deps.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/deps.mk') diff --git a/core/deps.mk b/core/deps.mk index a1c1cd8..c8237e9 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -334,9 +334,9 @@ define dep_autopatch_rebar.erl [] -> ok; _ -> Write("\npre-app::\n\t$$\(MAKE) -f c_src/Makefile.erlang.mk\n"), - PortSpecWrite(io_lib:format("ERL_CFLAGS = -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n", + PortSpecWrite(io_lib:format("ERL_CFLAGS ?= -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n", [code:root_dir(), erlang:system_info(version), code:lib_dir(erl_interface, include)])), - PortSpecWrite(io_lib:format("ERL_LDFLAGS = -L \\"~s\\" -lerl_interface -lei\n", + PortSpecWrite(io_lib:format("ERL_LDFLAGS ?= -L \\"~s\\" -lerl_interface -lei\n", [code:lib_dir(erl_interface, lib)])), [PortSpecWrite(["\n", E, "\n"]) || E <- OsEnv], FilterEnv = fun(Env) -> -- cgit v1.2.3