|
|
@ -12,16 +12,17 @@ |
|
|
|
]). |
|
|
|
|
|
|
|
-define(MakeOpts, [noexec, load, netload, noload]). |
|
|
|
-define(EMakefile, "./Emakefile_dev"). |
|
|
|
|
|
|
|
main(Args) -> |
|
|
|
process_flag(trap_exit, true), |
|
|
|
case Args of |
|
|
|
[] -> |
|
|
|
all(max(1, erlang:system_info(schedulers) - 1), "./Emakefile", []); |
|
|
|
all(max(1, erlang:system_info(schedulers) - 1), ?EMakefile, []); |
|
|
|
[EMakeFileOrWorkCnt] -> |
|
|
|
try list_to_integer(EMakeFileOrWorkCnt) of |
|
|
|
Cnt -> |
|
|
|
all(max(1, Cnt), "./Emakefile", []) |
|
|
|
all(max(1, Cnt), ?EMakefile, []) |
|
|
|
catch _:_ -> |
|
|
|
all(max(1, erlang:system_info(schedulers) - 1), EMakeFileOrWorkCnt, []) |
|
|
|
end; |
|
|
@ -62,10 +63,15 @@ all(WorkerCnt, EMakeFile, Opts) -> |
|
|
|
{ok, Files} -> |
|
|
|
LastTime = readEMake(), |
|
|
|
IsAll = LastTime /= 0 andalso StartTime =< LastTime, |
|
|
|
forMake(Files, WorkerCnt, lists:member(noexec, MakeOpts), load_opt(MakeOpts), IsAll, []), |
|
|
|
Ret = forMake(Files, WorkerCnt, lists:member(noexec, MakeOpts), load_opt(MakeOpts), IsAll, []), |
|
|
|
EndTime = erlang:system_time(second), |
|
|
|
saveEMake(EndTime), |
|
|
|
io:format("compile over all is ok use time: ~ps ~n", [EndTime - StartTime]); |
|
|
|
case Ret of |
|
|
|
ok -> |
|
|
|
io:format("compile over all is ok use time: ~ps ~n", [EndTime - StartTime]); |
|
|
|
{error, _Err} -> |
|
|
|
io:format("compile abort why: ~p~n", [_Err]) |
|
|
|
end; |
|
|
|
_Err -> |
|
|
|
_Err |
|
|
|
end. |
|
|
@ -203,7 +209,8 @@ forMake([], _Worker, _NoExec, _Load, IsAll, AllWorkPids) -> |
|
|
|
{mCompileError, Err} -> |
|
|
|
errorStop(Err, AllWorkPids); |
|
|
|
_Other -> |
|
|
|
io:format("forMake [] receive unexpect msg:~p ~n", [_Other]) |
|
|
|
io:format("forMake [] receive unexpect msg:~p ~n", [_Other]), |
|
|
|
{error, _Other} |
|
|
|
end |
|
|
|
end; |
|
|
|
forMake([{Mods, Opts} | Rest], Worker, NoExec, Load, IsAll, AllWorkPids) -> |
|
|
@ -235,7 +242,8 @@ forMake([{Mods, Opts} | Rest], Worker, NoExec, Load, IsAll, AllWorkPids) -> |
|
|
|
{mCompileError, Err} -> |
|
|
|
errorStop(Err, AllWorkPids); |
|
|
|
_Other -> |
|
|
|
io:format("forMake xx receive unexpect msg:~p ~n", [_Other]) |
|
|
|
io:format("forMake xx receive unexpect msg:~p ~n", [_Other]), |
|
|
|
{error, _Other} |
|
|
|
end |
|
|
|
end |
|
|
|
end. |
|
|
@ -252,10 +260,11 @@ errorStop(Err, AllWorkPids) -> |
|
|
|
[exit(OnePid, kill) || OnePid <- AllWorkPids], |
|
|
|
case Err of |
|
|
|
{File, Errors, Warnings} -> |
|
|
|
io:format("the file:~ts compile error:~p wrar:~p ~n ", [File, Errors, Warnings]); |
|
|
|
io:format("the file:~ts compile error:~p wrar:~p ~n", [File, Errors, Warnings]); |
|
|
|
File -> |
|
|
|
io:format("the file:~ts compile error please check ~n ", [File]) |
|
|
|
end. |
|
|
|
io:format("the file:~ts compile error please check ~n", [File]) |
|
|
|
end, |
|
|
|
{error, compile_error}. |
|
|
|
|
|
|
|
compileWorker([], _Opts, Parent, NoExec, Load, IsAll) -> |
|
|
|
erlang:send(Parent, {mOverCompile, self()}), |
|
|
|