Reorder arguments to CC for linking and fix needs_link to function properly

This commit is contained in:
Dave Smith 2009-12-16 10:27:14 -05:00
parent 4d3c7e60d6
commit ee0c6ad086

View file

@ -95,7 +95,7 @@ compile(Config, AppFile) ->
case needs_link(SoName, NewBins) of case needs_link(SoName, NewBins) of
true -> true ->
AllBins = string:join(NewBins ++ ExistingBins, " "), AllBins = string:join(NewBins ++ ExistingBins, " "),
rebar_utils:sh_failfast(?FMT("$CC ~s $LDFLAGS $DRIVER_LDFLAGS -o ~s", [AllBins, SoName]), Env); rebar_utils:sh_failfast(?FMT("$CC $LDFLAGS $DRIVER_LDFLAGS ~s -o ~s", [AllBins, SoName]), Env);
false -> false ->
?INFO("Skipping relink of ~s\n", [SoName]), ?INFO("Skipping relink of ~s\n", [SoName]),
ok ok
@ -178,15 +178,17 @@ needs_compile(Source, Bin) ->
filelib:last_modified(Bin) < filelib:last_modified(Source). filelib:last_modified(Bin) < filelib:last_modified(Source).
needs_link(SoName, []) -> needs_link(SoName, []) ->
?DEBUG("2 Lad mod \n", []),
filelib:last_modified(SoName) == 0; filelib:last_modified(SoName) == 0;
needs_link(SoName, NewBins) -> needs_link(SoName, NewBins) ->
MaxLastMod = lists:max([filelib:last_modified(B) || B <- NewBins]), MaxLastMod = lists:max([filelib:last_modified(B) || B <- NewBins]),
case filelib:last_modified(SoName) of case filelib:last_modified(SoName) of
0 -> 0 ->
?DEBUG("Last mod is 0 on ~s\n", [SoName]),
true; true;
Other -> Other ->
?DEBUG("Checking ~p < ~p", [MaxLastMod, Other]), ?DEBUG("Checking ~p >= ~p", [MaxLastMod, Other]),
MaxLastMod < Other MaxLastMod >= Other
end. end.
merge_envs(OverrideEnvs, DefaultEnvs) -> merge_envs(OverrideEnvs, DefaultEnvs) ->