Browse files

Merge remote-tracking branch 'origin/2.0.1'

* origin/2.0.1:
  GC-3: Make COUCH_SRC parsing less fragile

Change-Id: I1680f1661a716018a9da2b3963db80e0bdb96af1
  • Loading branch information...
2 parents bd21f3e + 8997159 commit 16b91fbceab50c7c032a1dcfc2af9be0f428c017 @fdmanana fdmanana committed Dec 31, 2012
Showing with 23 additions and 5 deletions.
  1. +2 −5 Makefile
  2. BIN rebar
  3. +21 −0 rebar.config.script
View
7 Makefile
@@ -1,16 +1,13 @@
ERL=erl
VERSION=$(shell git describe)
-# Output ERL_COMPILER_OPTIONS env variable
-COMPILER_OPTIONS=$(shell $(ERL) -noinput +B -eval 'Options = case os:getenv("ERL_COMPILER_OPTIONS") of false -> []; Else -> {ok,Tokens,_} = erl_scan:string(Else ++ "."),{ok,Term} = erl_parse:parse_term(Tokens), Term end, io:format("~p~n", [[{i, "${COUCH_SRC}"}, {i, "${COUCH_SRC}/.."}] ++ Options]), halt(0).')
-COMPILER_OPTIONS_MAKE_CHECK=$(shell $(ERL) -noinput +B -eval 'Options = case os:getenv("ERL_COMPILER_OPTIONS") of false -> []; Else -> {ok,Tokens,_} = erl_scan:string(Else ++ "."),{ok,Term} = erl_parse:parse_term(Tokens), Term end, io:format("~p~n", [[{i, "${COUCH_SRC}"},{i, "${COUCH_SRC}/.."},{d, makecheck}] ++ Options]), halt(0).')
all: compile
compile:
- ERL_COMPILER_OPTIONS='$(COMPILER_OPTIONS)' ./rebar compile
+ ./rebar compile
compileforcheck:
- ERL_COMPILER_OPTIONS='$(COMPILER_OPTIONS_MAKE_CHECK)' ./rebar compile
+ MAKECHECK=1 ./rebar compile
buildandtest: all test
View
BIN rebar
Binary file not shown.
View
21 rebar.config.script
@@ -0,0 +1,21 @@
+% Add the COUCH_SRC directory to include path
+IncludeDir = case os:getenv("COUCH_SRC") of
+ false -> []; % env var not defined
+ [] -> []; % env var set to empty string
+ Dir -> [{i, Dir}, {i, Dir ++ "/../"}]
+end,
+
+% Add "makecheck" setting for testing
+MakeCheck = case os:getenv("MAKECHECK") of
+ false -> []; % env var not defined
+ [] -> []; % env var set to empty string
+ _ -> [{d, makecheck}]
+end,
+
+% Add all variables to erl_opts
+case lists:keytake(erl_opts, 1, CONFIG) of
+ false ->
+ CONFIG ++ [{erl_opts, IncludeDir ++ MakeCheck}];
+ {value, {erl_opts, ErlOpts}, Config2} ->
+ Config2 ++ [{erl_opts, ErlOpts ++ IncludeDir ++ MakeCheck}]
+end.

0 comments on commit 16b91fb

Please sign in to comment.