diff --git a/src/compile/mad_port.erl b/src/compile/mad_port.erl index d97d28a..d5f6356 100644 --- a/src/compile/mad_port.erl +++ b/src/compile/mad_port.erl @@ -31,25 +31,32 @@ compile_port(Dir,Specs0,Config) -> Env1 = [{"PORT_IN_FILES", F},{"PORT_OUT_FILE", Obj}] ++ Env ++ default_env(), CmdCC = string:strip(expand(System,TplCC,Env1)), Cmd = expand(System,CmdCC,[{"CXXFLAGS",""},{"LDFLAGS",""},{"CFLAGS",""}]), + mad:info("cc ~s~n",[Cmd]), {_,Status,Report} = sh:run("cc",string:tokens(Cmd," "),binary,Dir,Env), case Status of 0 -> {ok,Obj} ; _ -> {error, "Port Compilation Error:~n" ++ io_lib:format("~ts",[Report])},true end; - true -> {ok,Obj} + true -> {even,Obj} end end, - Res = lists:foldl(fun({ok,X},Acc) -> [X|Acc]; + Res = lists:foldl(fun({ok,X},Acc) -> [{ok,X}|Acc]; + ({even,X},Acc) -> [{even,X}|Acc]; ({error,Err},_)-> {error,Err} end,[],[Compile(F) || F <- Files]), - case Res of - {error, _}=Err -> Err; - Objs -> Env2 = [{"PORT_IN_FILES", string:join(Objs," ")}, + + %%if any ok recompile target + case Res of {error,_} = Err -> Err; Res -> + case lists:any(fun({ok,_}) -> true;(_)->false end, Res) of + false -> false; %% all even, no need to link target + true -> Objs = [O||{_,O} <-Res], + Env2 = [{"PORT_IN_FILES", string:join(Objs," ")}, {"PORT_OUT_FILE", Target}] ++ Env ++ default_env(), TplLD = tpl_ld(TargetType,LinkLang), CmdLD = string:strip(expand(System,TplLD,Env2)), Cmd = expand(System,CmdLD,[{"CXXFLAGS",""},{"LDFLAGS",""},{"CFLAGS",""}]), + mad:info("cc ~s~n",[Cmd]), {_,Status,Report} = sh:run("cc",string:tokens(Cmd," "),binary,Dir,Env), case Status of 0 -> false; @@ -57,6 +64,7 @@ compile_port(Dir,Specs0,Config) -> {error, Report},true end end + end end, [Job(S)||S<-Specs]. diff --git a/src/provision/mad_repl.erl b/src/provision/mad_repl.erl index 344b0af..0642e03 100644 --- a/src/provision/mad_repl.erl +++ b/src/provision/mad_repl.erl @@ -3,8 +3,8 @@ -compile(export_all). disabled() -> []. -system() -> [compiler,syntax_tools,sasl,tools,mnesia,reltool,xmerl,crypto,kernel,stdlib,ssh,eldap, - wx,ssl,runtime_tools,public_key,observer,inets,asn1,et,eunit,hipe,os_mon,parsetools,odbc,n2o]. +system() -> [compiler,syntax_tools,sasl,tools,mnesia,reltool,xmerl,crypto,kernel,stdlib,ssh,eldap,erl_interface, + wx,ssl,runtime_tools,public_key,observer,inets,asn1,et,eunit,hipe,os_mon,parsetools,odbc]. local_app() -> case filename:basename(filelib:wildcard("ebin/*.app"),".app") of