From a96cfe92310465f6713cb83a623f14ee120a2870 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 10 Apr 2015 19:19:09 +0000 Subject: [PATCH] lazbuild: -q -q passes -vw-n-h-i-l-d-u-t-p-c-x- to the compiler git-svn-id: trunk@48698 - --- ide/compileroptions.pp | 68 +++++++++++++++++++++++------------------- ide/lazbuild.lpr | 49 +++++++++++++++++++----------- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 2de4d105c8..d195b24601 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -52,7 +52,7 @@ uses IDEOptionsIntf, // IDE LazarusIDEStrConsts, IDEProcs, LazConf, TransferMacros, etFPCMsgParser, - ModeMatrixOpts, CompOptsModes, EnvironmentOpts; + IDECmdLine, ModeMatrixOpts, CompOptsModes, EnvironmentOpts; const DefaultCompilerPath = '$(CompPath)'; @@ -2448,7 +2448,7 @@ end; function TBaseCompilerOptions.MakeOptionsString( Flags: TCompilerCmdLineOptions): String; var - switches, tempsw, t: String; + switches, tempsw, quietsw, t: String; InhLinkerOpts: String; NewTargetFilename: String; NewTargetDirectory: String; @@ -2472,13 +2472,22 @@ var FPCompilerFilename: String; s: string; CurFPCMsgFile: TFPCMsgFilePoolItem; + Quiet: Boolean; procedure EnableDisableVerbosityFlag(Enable: boolean; c: char); begin - if Enable then - tempsw+=c + if Quiet or not Enable then + quietsw+=c+'-' else - switches+=' -v'+c+'-'; + tempsw+=c; + end; + + procedure EnableVerbosityFlag(Enable: boolean; c: char); + begin + if Quiet then + quietsw+=c+'-' + else if Enable then + tempsw+=c; end; begin @@ -2734,7 +2743,7 @@ begin Supported Microcontroller types: } - + Quiet:=ConsoleVerbosity<=-3; // lazbuild -q -q, lazarus -q -q -q CurTargetOS:=''; CurTargetCPU:=''; @@ -2932,42 +2941,40 @@ begin { ---------------- Other Tab -------------------- } { Verbosity } - if (WriteFPCLogo) then + if Quiet then + switches := switches + ' -l-' + else if WriteFPCLogo then switches := switches + ' -l'; tempsw := ''; + quietsw := ''; // the default fpc.cfg normally contains -viwn, if the user does not want - // to see warning pass -vw- + // to see warnings pass -vw- tempsw := tempsw + 'e'; // always pass -ve, you cannot ignore errors EnableDisableVerbosityFlag(ShowWarn,'w'); EnableDisableVerbosityFlag(ShowNotes,'n'); EnableDisableVerbosityFlag(ShowHints,'h'); - tempsw := tempsw + 'i'; // always pass -vi, (e.g. (3104) Compiling) needed to resolve filenames in fpc messages without path - if ShowLineNum then - tempsw := tempsw + 'l'; - if ShowDebugInfo then - tempsw := tempsw + 'd'; - if ShowUsedFiles then - tempsw := tempsw + 'u'; - if ShowTriedFiles then - tempsw := tempsw + 't'; - if ShowCompProc then - tempsw := tempsw + 'p'; - if ShowCond then - tempsw := tempsw + 'c'; - if ShowExecInfo then - tempsw := tempsw + 'x'; + // always pass -vi for IDE, (e.g. (3104) Compiling) needed to resolve filenames in fpc messages without path + EnableVerbosityFlag(true,'i'); + // optional verbosity flags, usually off in fpc.cfg, pass them only if wanted + EnableVerbosityFlag(ShowLineNum,'l'); + EnableVerbosityFlag(ShowDebugInfo,'d'); + EnableVerbosityFlag(ShowUsedFiles,'u'); + EnableVerbosityFlag(ShowTriedFiles,'t'); + EnableVerbosityFlag(ShowCompProc,'p'); + EnableVerbosityFlag(ShowCond,'c'); + EnableVerbosityFlag(ShowExecInfo,'x'); - if ShowAll or (ccloAddVerboseAll in Flags) then + if (ShowAll and not (Quiet)) or (ccloAddVerboseAll in Flags) then tempsw := 'a'; tempsw := tempsw + 'bq'; // b = full file names, q = message ids - if (tempsw <> '') then begin - tempsw := '-v' + tempsw; - switches := switches + ' ' + tempsw; - end; + if (tempsw <> '') then + switches := switches + ' -v' + tempsw; + if (quietsw <> '') then + switches := switches + ' -v' + quietsw; - // -vm flags allow to enable/disable types of messages +// -vm flags allow to enable/disable types of messages // Passing a -vm ID, unknown by the current compiler will create an error // => check the compiler message file if IDEMessageFlags.Count>0 then begin @@ -2997,9 +3004,8 @@ begin { Use Custom Config File @ = yes and path } if not (ccloNoMacroParams in Flags) - and (CustomConfigFile) and (ConfigFilePath<>'') then begin + and (CustomConfigFile) and (ConfigFilePath<>'') then switches := switches + ' ' + PrepareCmdLineOption('@' + ConfigFilePath); - end; { ------------- Search Paths ---------------- } CurOutputDir:=''; diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index 0b71a80b4e..0b3a38b1ef 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -1643,37 +1643,51 @@ const begin Result:=UTF8ToConsole(BreakString(s,75, length(space))) end; + + procedure w(Msg: string); + begin + writeln(LongToConsole(Msg)); + end; + begin TranslateResourceStrings(ProgramDirectory(true),''); writeln(''); writeln('lazbuild [options] '); writeln(''); - writeln(UTF8ToConsole(lisEdtExtToolParameters)); + w(lisEdtExtToolParameters); writeln(''); - writeln('--help or -? ', UTF8ToConsole(listhisHelpMessage)); - writeln(''); - writeln('-B or --build-all ', UTF8ToConsole(lisBuildAllFilesOfProjectPackageIDE)); - writeln('-r or --recursive ', UTF8ToConsole(lisApplyBuildFlagsBToDependenciesToo)); - writeln('-d or --skip-dependencies ', UTF8ToConsole(lisDoNotCompileDependencies)); - writeln('--build-ide= ', UTF8ToConsole(lisBuildIDEWithPackages)); - writeln('-v or --version ', UTF8ToConsole(lisShowVersionAndExit)); - writeln('-q or --quiet ', UTF8ToConsole(lisBeLessVerboseCanBeGivenMultipleTimes)); - writeln('--verbose ', UTF8ToConsole(lisBeMoreVerboseCanBeGivenMultipleTimes)); + writeln('--help or -?'); + w(space+listhisHelpMessage); + writeln('-B or --build-all'); + w(space+lisBuildAllFilesOfProjectPackageIDE); + writeln('-r or --recursive'); + w(space+lisApplyBuildFlagsBToDependenciesToo); + writeln('-d or --skip-dependencies'); + w(space+lisDoNotCompileDependencies); + writeln('--build-ide='); + w(space+lisBuildIDEWithPackages); + writeln('-v or --version'); + w(space+lisShowVersionAndExit); + writeln('-q or --quiet'); + w(space+lisBeLessVerboseCanBeGivenMultipleTimes); + w(space+'Passing quiet two times, will pass -vw-n-h-i-l-d-u-t-p-c-x- to the compiler'); + writeln('--verbose'); + w(space+lisBeMoreVerboseCanBeGivenMultipleTimes); writeln(''); writeln('--add-package'); - writeln(LongToConsole(space+lisAddPackageSToListOfInstalledPackagesCombineWithBui)); + w(space+lisAddPackageSToListOfInstalledPackagesCombineWithBui); writeln('--create-makefile'); - writeln(LongToConsole(space+lisInsteadOfCompilePackageCreateASimpleMakefile)); + w(space+lisInsteadOfCompilePackageCreateASimpleMakefile); writeln(''); writeln(PrimaryConfPathOptLong,''); writeln('or ',PrimaryConfPathOptShort,''); - writeln(LongToConsole(space+lisprimaryConfigDirectoryWhereLazarusStoresItsConfig+LazConf.GetPrimaryConfigPath)); + w(space+lisprimaryConfigDirectoryWhereLazarusStoresItsConfig+LazConf.GetPrimaryConfigPath); writeln(''); writeln(SecondaryConfPathOptLong,''); writeln('or ',SecondaryConfPathOptShort,''); - writeln(LongToConsole(space+lissecondaryConfigDirectoryWhereLazarusSearchesFor+LazConf.GetSecondaryConfigPath)); + w(space+lissecondaryConfigDirectoryWhereLazarusSearchesFor+LazConf.GetSecondaryConfigPath); writeln(''); writeln('--operating-system='); writeln('or --os='); @@ -1701,14 +1715,13 @@ begin lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD, [space]))); writeln(''); writeln(LanguageOpt); - writeln(LongToConsole(space+lisOverrideLanguage)); + w(space+lisOverrideLanguage); writeln(''); writeln('--lazarusdir='); - writeln(LongToConsole(space+lisLazarusDirOverride)); + w(space+lisLazarusDirOverride); writeln(''); writeln('--max-process-count='); - writeln(LongToConsole(space+ - lisMaximumNumberOfThreadsForCompilingInParallelDefaul)); + w(space+lisMaximumNumberOfThreadsForCompilingInParallelDefaul); writeln(''); end;