Skip to content

Commit

Permalink
Add -D support to rebar_port_compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuncer Ayaz committed Oct 22, 2011
1 parent 8eeca12 commit 28b9ceb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/rebar_port_compiler.erl
Expand Up @@ -154,14 +154,24 @@ setup_env(Config) ->
%% max flexibility for users.
DefaultEnvs = filter_envs(default_env(), []),
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,
expand_vars_loop(merge_each_var(RawEnv, [])).

%% ===================================================================
%% 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) ->
Acc;
expand_sources([{ArchRegex, Spec} | Rest], Acc) ->
Expand Down

0 comments on commit 28b9ceb

Please sign in to comment.