From 1493e9394c9a44bb381cd687485f7eab128b040d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 May 2015 00:13:21 +0300 Subject: Initial autopatch of port env and hooks --- core/deps.mk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'core/deps.mk') diff --git a/core/deps.mk b/core/deps.mk index f44b9a3..bae195b 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -133,6 +133,31 @@ define dep_autopatch_rebar.erl Write(io_lib:format("COMPILE_FIRST +=~s\n", [Names])) end end(), + fun() -> + case lists:keyfind(port_env, 1, Conf) of + {_, Vars} -> + [Write(K ++ " = $$$$\(shell echo " ++ re:replace(V, "\\\\$$$$", "\$$$$$$$$", [global, {return, list}]) ++ "\)\n") + || {K, V} <- Vars], + Write("CFLAGS += $$$$\(DRV_CFLAGS\)\n"), + Write("CXXFLAGS += $$$$\(DRV_CFLAGS\)\n"), + Write("LDFLAGS += $$$$\(DRV_LDFLAGS\)\n"); + _ -> ok + end + end(), + fun() -> + case lists:keyfind(pre_hooks, 1, Conf) of + false -> ok; + {_, Hooks} -> + [case H of + {'get-deps', Command} -> + Write("\npre::\n\t" ++ Command ++ "\n"); + {compile, Command} -> + Write("\npre::\n\t" ++ Command ++ "\n"); + _ -> ok + end || H <- Hooks], + Write("\npre:: deps app\n\n") + end + end(), case $(1) of proper -> Write("\n# Proper hack.\napp::\n\t./write_compile_flags include/compile_flags.hrl\n"); _ -> ok -- cgit v1.2.3