lazbuild: create-makefile: hide output depending on verbosity, check fileage of fpmake

git-svn-id: trunk@52000 -
This commit is contained in:
mattias 2016-03-20 11:19:13 +00:00
parent ba03ed5199
commit c6262f1fed
3 changed files with 38 additions and 20 deletions

View File

@ -38,7 +38,7 @@ uses
FileUtil, LazFileUtils, LazFileCache, LazUTF8, lazutf8classes, FileUtil, LazFileUtils, LazFileCache, LazUTF8, lazutf8classes,
AvgLvlTree, Laz2_XMLCfg, AvgLvlTree, Laz2_XMLCfg,
// IDE // IDE
LazConf; IDECmdLine, LazConf;
type type
// comments // comments
@ -430,11 +430,13 @@ end;
function FindFPCTool(const Executable, CompilerFilename: string): string; function FindFPCTool(const Executable, CompilerFilename: string): string;
begin begin
DebugLn('FindFPCTool Executable="',Executable,'" CompilerFilename="',CompilerFilename,'"'); if ConsoleVerbosity>=0 then
DebugLn('Hint: (lazarus) FindFPCTool Executable="',Executable,'" CompilerFilename="',CompilerFilename,'"');
Result:=FindDefaultExecutablePath(Executable); Result:=FindDefaultExecutablePath(Executable);
if Result<>'' then exit; if Result<>'' then exit;
Result:=AppendPathDelim(ExtractFilePath(CompilerFilename))+Executable; Result:=AppendPathDelim(ExtractFilePath(CompilerFilename))+Executable;
DebugLn('FindFPCTool Try="',Result); if ConsoleVerbosity>=0 then
DebugLn('Hint: (lazarus) FindFPCTool Try="',Result);
if FileExistsUTF8(Result) then exit; if FileExistsUTF8(Result) then exit;
Result:=''; Result:='';
end; end;

View File

@ -695,6 +695,8 @@ end;
procedure TLazBuildApplication.DoCreateMakefile(APackage: TLazPackage); procedure TLazBuildApplication.DoCreateMakefile(APackage: TLazPackage);
begin begin
if ConsoleVerbosity>0 then
debugln(['Hint: (lazarus) [TLazBuildApplication.DoCreateMakefile] ',APackage.Filename]);
PackageGraph.WriteMakeFile(APackage); PackageGraph.WriteMakeFile(APackage);
end; end;

View File

@ -4226,11 +4226,14 @@ begin
// it is not needed because it is the location of the Makefile.compiled // it is not needed because it is the location of the Makefile.compiled
s:=s+' '+SwitchPathDelims(CreateRelativePath(APackage.GetSrcFilename,APackage.Directory),pdsUnix); s:=s+' '+SwitchPathDelims(CreateRelativePath(APackage.GetSrcFilename,APackage.Directory),pdsUnix);
if ConsoleVerbosity>1 then if ConsoleVerbosity>1 then
debugln(['Hint: (lazarus) writing Makefile.compiled IncPath="',IncPath,'" UnitPath="',UnitPath,'" Custom="',OtherOptions,'" Makefile.compiled="',TargetCompiledFile,'"']); debugln(['Hint: (lazarus) writing ',TargetCompiledFile,' IncPath="',IncPath,'" UnitPath="',UnitPath,'" Custom="',OtherOptions,'" Makefile.compiled="',TargetCompiledFile,'"']);
XMLConfig.SetValue('Params/Value',s); XMLConfig.SetValue('Params/Value',s);
if XMLConfig.Modified then begin if XMLConfig.Modified then begin
InvalidateFileStateCache; InvalidateFileStateCache;
XMLConfig.Flush; XMLConfig.Flush;
end else begin
if ConsoleVerbosity>1 then
debugln(['Hint: (lazarus) not writing ',TargetCompiledFile,', because nothing changed']);
end; end;
finally finally
XMLConfig.Free; XMLConfig.Free;
@ -4321,6 +4324,7 @@ var
FormIncPath: String; FormIncPath: String;
Executable: String; Executable: String;
DistCleanDir: String; DistCleanDir: String;
NeedFPCMake: Boolean;
begin begin
Result:=mrCancel; Result:=mrCancel;
PathDelimNeedsReplace:=PathDelim<>'/'; PathDelimNeedsReplace:=PathDelim<>'/';
@ -4494,28 +4498,39 @@ begin
end; end;
end; end;
if ExtractCodeFromMakefile(CodeBuffer.Source)=ExtractCodeFromMakefile(s) NeedFPCMake:=false;
if ExtractCodeFromMakefile(CodeBuffer.Source)<>ExtractCodeFromMakefile(s)
then begin then begin
// Makefile.fpc not changed // Makefile.fpc changed
Result:=mrOk; CodeBuffer.Source:=s;
exit;
end;
CodeBuffer.Source:=s;
//debugln('TPkgManager.DoWriteMakefile MakefileFPCFilename="',MakefileFPCFilename,'"'); //debugln('TPkgManager.DoWriteMakefile MakefileFPCFilename="',MakefileFPCFilename,'"');
Result:=SaveCodeBufferToFile(CodeBuffer,MakefileFPCFilename); Result:=SaveCodeBufferToFile(CodeBuffer,MakefileFPCFilename);
if Result<>mrOk then begin if Result<>mrOk then begin
if not DirectoryIsWritableCached(ExtractFilePath(MakefileFPCFilename)) then if not DirectoryIsWritableCached(ExtractFilePath(MakefileFPCFilename)) then
begin begin
// the package source is read only => no problem // the package source is read only => no problem
Result:=mrOk; if ConsoleVerbosity>0 then
debugln(['Note: (lazarus) [TLazPackageGraph.WriteMakeFile] not writing "',MakefileFPCFilename,'" because dir not writable, ignoring...']);
Result:=mrOk;
end;
exit;
end; end;
exit; NeedFPCMake:=true;
end; end;
Executable:=FindFPCTool('fpcmake'+GetExecutableExt, Executable:=FindFPCTool('fpcmake'+GetExecutableExt,
EnvironmentOptions.GetParsedCompilerFilename); EnvironmentOptions.GetParsedCompilerFilename);
if not FileIsExecutableCached(Executable) then if FileIsExecutableCached(Executable) then begin
if (not NeedFPCMake)
and (FileAgeUTF8(MakefileFPCFilename)<FileAgeCached(Executable)) then begin
if ConsoleVerbosity>=-1 then
debugln(['Hint: (lazarus) [TLazPackageGraph.WriteMakeFile] "',Executable,'" is newer than "',MakefileFPCFilename,'"']);
NeedFPCMake:=true;// fpcmake is newer than Makefile.fpc
end;
if not NeedFPCMake then
exit(mrOk);
end else
Executable:='fpcmake'+GetExecutableExt; Executable:='fpcmake'+GetExecutableExt;
// call fpcmake to create the Makefile // call fpcmake to create the Makefile
@ -4528,7 +4543,6 @@ begin
'FPCDIR='+EnvironmentOptions.GetParsedFPCSourceDirectory); 'FPCDIR='+EnvironmentOptions.GetParsedFPCSourceDirectory);
FPCMakeTool.Execute; FPCMakeTool.Execute;
FPCMakeTool.WaitForExit; FPCMakeTool.WaitForExit;
Result:=mrOk; Result:=mrOk;
end; end;