summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar.erl16
-rw-r--r--src/rebar_port_compiler.erl11
2 files changed, 16 insertions, 11 deletions
diff --git a/src/rebar.erl b/src/rebar.erl
index 0c131ef..7ce409c 100644
--- a/src/rebar.erl
+++ b/src/rebar.erl
@@ -156,9 +156,7 @@ parse_args(Args) ->
proplists:get_bool(profile, Options)),
%% Set global variables based on getopt options
- LogLevel = proplists:get_value(verbose, Options,
- rebar_log:default_level()),
- rebar_config:set_global(verbose, LogLevel),
+ set_log_level(Options),
set_global_flag(Options, force),
DefJobs = rebar_config:get_jobs(),
case proplists:get_value(jobs, Options, DefJobs) of
@@ -185,6 +183,18 @@ parse_args(Args) ->
end.
%%
+%% set log level based on getopt option
+%%
+set_log_level(Options) ->
+ LogLevel = case proplists:get_all_values(verbose, Options) of
+ [] ->
+ rebar_log:default_level();
+ Verbosities ->
+ lists:last(Verbosities)
+ end,
+ rebar_config:set_global(verbose, LogLevel).
+
+%%
%% show version information and halt
%%
version() ->
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 05e157b..bee9644 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -155,14 +155,9 @@ setup_env(Config) ->
%% ===================================================================
global_defines() ->
- [begin
- case string:tokens(D, "=") of
- [Var, Val] ->
- {Var, Val};
- [Def] ->
- {Def, "1"}
- end
- end || D <- rebar_config:get_global(defines, [])].
+ Defines = rebar_config:get_global(defines, []),
+ Flags = string:join(["-D" ++ D || D <- Defines], " "),
+ [{"ERL_CFLAGS", "$ERL_CFLAGS " ++ Flags}].
expand_sources([], Acc) ->
Acc;