mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add -D support to rebar_port_compiler
This commit is contained in:
parent
8eeca123e5
commit
28b9cebf0a
1 changed files with 11 additions and 1 deletions
|
@ -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) ->
|
||||||
|
|
Loading…
Reference in a new issue