Add -D support to rebar_port_compiler

This commit is contained in:
Tuncer Ayaz 2011-10-22 22:25:40 +02:00
parent 8eeca123e5
commit 28b9cebf0a

View file

@ -154,7 +154,7 @@ setup_env(Config) ->
%% max flexibility for users. %% max flexibility for users.
DefaultEnvs = filter_envs(default_env(), []), DefaultEnvs = filter_envs(default_env(), []),
PortEnvs = rebar_config:get_list(Config, port_envs, []), PortEnvs = rebar_config:get_list(Config, port_envs, []),
OverrideEnvs = filter_envs(PortEnvs, []), OverrideEnvs = global_defines() ++ filter_envs(PortEnvs, []),
RawEnv = apply_defaults(os_env(), DefaultEnvs) ++ OverrideEnvs, RawEnv = apply_defaults(os_env(), DefaultEnvs) ++ OverrideEnvs,
expand_vars_loop(merge_each_var(RawEnv, [])). expand_vars_loop(merge_each_var(RawEnv, [])).
@ -162,6 +162,16 @@ setup_env(Config) ->
%% Internal functions %% Internal functions
%% =================================================================== %% ===================================================================
global_defines() ->
[begin
case string:tokens(D, "=") of
[Var, Val] ->
{Var, Val};
[Def] ->
{Def, "1"}
end
end || D <- rebar_config:get_global(defines, [])].
expand_sources([], Acc) -> expand_sources([], Acc) ->
Acc; Acc;
expand_sources([{ArchRegex, Spec} | Rest], Acc) -> expand_sources([{ArchRegex, Spec} | Rest], Acc) ->