summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuis Rascão <luis.rascao@gmail.com>2016-02-23 15:22:26 +0000
committerLuis Rascão <luis.rascao@gmail.com>2016-02-23 15:22:26 +0000
commit13a570ed93220564460562e07fda9d90a0dd18dd (patch)
tree8e772ecf1f652e144ce4daf5b70d2ec9e05de0a6 /src
parentaebe3b0bd35c0e4a5d18bda650490503eb463fd1 (diff)
parentb816c69e343c8fd757c59fe8703eeda597f4da0a (diff)
downloadrebar-13a570ed93220564460562e07fda9d90a0dd18dd.tar.gz
Merge pull request #590 from lrascao/feature/allow_port_env_flags_redefinition
Treat port env vars as expandable only if they self reference
Diffstat (limited to 'src')
-rw-r--r--src/rebar_port_compiler.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 906bcb0..7af45eb 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -495,9 +495,10 @@ expand_command(TmplName, Env, InFiles, OutFile) ->
%%
%% Given a string, determine if it is expandable
-%%
+%% A string is defined as expandable if it contains itself
+%% (eg. CFLAGS = -m64 $CFLAGS)
is_expandable(InStr) ->
- case re:run(InStr,"\\\$",[{capture,none}]) of
+ case re:run(InStr,"\\\$"++InStr,[{capture,none}]) of
match -> true;
nomatch -> false
end.
@@ -626,6 +627,11 @@ default_env() ->
{"darwin9.*-64$", "CXXFLAGS", "-m64 $CXXFLAGS"},
{"darwin9.*-64$", "LDFLAGS", "-arch x86_64 $LDFLAGS"},
+ %% OS X Lion onwards flags for 64-bit
+ {"darwin1[0-4].*-64$", "CFLAGS", "-m64 $CFLAGS"},
+ {"darwin1[0-4].*-64$", "CXXFLAGS", "-m64 $CXXFLAGS"},
+ {"darwin1[0-4].*-64$", "LDFLAGS", "-arch x86_64 $LDFLAGS"},
+
%% OS X Snow Leopard, Lion, and Mountain Lion flags for 32-bit
{"darwin1[0-2].*-32", "CFLAGS", "-m32 $CFLAGS"},
{"darwin1[0-2].*-32", "CXXFLAGS", "-m32 $CXXFLAGS"},