mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 11:19:14 +02:00
IDE: added macro MakeLib
git-svn-id: trunk@28720 -
This commit is contained in:
parent
24cd1f56f3
commit
230d56ede2
@ -75,6 +75,8 @@ type
|
||||
var Abort: boolean): string;// make utility
|
||||
function MacroFuncMakeExe(const Filename: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function MacroFuncMakeLib(const Filename: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function MacroFuncParams(const Param: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function MacroFuncProject(const Param: string; const Data: PtrInt;
|
||||
@ -302,6 +304,8 @@ begin
|
||||
lisEnvironmentVariableNameAsParameter, @MacroFuncEnv, []));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('MakeExe','',
|
||||
lisMakeExe,@MacroFuncMakeExe,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('MakeLib','',
|
||||
lisMakeExe,@MacroFuncMakeLib,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('Make','',
|
||||
lisPathOfTheMakeUtility, @MacroFuncMake, []));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('IDEBuildOptions','',
|
||||
@ -1309,18 +1313,17 @@ end;
|
||||
|
||||
function TBuildManager.MacroFuncMakeExe(const Filename: string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
var
|
||||
OldExt: String;
|
||||
ExeExt: String;
|
||||
begin
|
||||
Result:=Filename;
|
||||
OldExt:=ExtractFileExt(Filename);
|
||||
ExeExt:=LazConf.GetExecutableExt(GetTargetOS(true));
|
||||
if OldExt<>ExeExt then
|
||||
Result:=copy(Result,1,length(Result)-length(OldExt))+ExeExt;
|
||||
Result:=MakeStandardExeFilename(GetTargetOS(true),Filename);
|
||||
//DebugLn('TMainIDE.MacroFuncMakeExe A ',Filename,' ',Result);
|
||||
end;
|
||||
|
||||
function TBuildManager.MacroFuncMakeLib(const Filename: string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
begin
|
||||
Result:=MakeStandardLibFilename(GetTargetOS(true),Filename);
|
||||
end;
|
||||
|
||||
function TBuildManager.MacroFuncProject(const Param: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
begin
|
||||
|
@ -2499,26 +2499,16 @@ begin
|
||||
if (HeapSize > 0) then
|
||||
switches := switches + ' ' + '-Ch' + IntToStr(HeapSize);
|
||||
|
||||
|
||||
{ TODO: Implement the following switches. They need to be added
|
||||
to the dialog. }
|
||||
{
|
||||
n = Omit linking stage
|
||||
sxxx = Set stack size to xxx
|
||||
}
|
||||
|
||||
{ Optimizations }
|
||||
OptimizeSwitches:='';
|
||||
|
||||
if SmallerCode then
|
||||
OptimizeSwitches := OptimizeSwitches + 's';
|
||||
|
||||
{ OptimizationLevel 1 = Level 1 2 = Level 2 3 = Level 3 }
|
||||
case (OptimizationLevel) of
|
||||
1: OptimizeSwitches := OptimizeSwitches + '1';
|
||||
2: OptimizeSwitches := OptimizeSwitches + '2';
|
||||
3: OptimizeSwitches := OptimizeSwitches + '3';
|
||||
end;
|
||||
|
||||
if OptimizeSwitches<>'' then
|
||||
switches := switches + ' -O'+OptimizeSwitches;
|
||||
|
||||
@ -2590,7 +2580,7 @@ begin
|
||||
switches := switches + ' -Xs';
|
||||
|
||||
{ Link Style
|
||||
-XD = Link with dynamic libraries, not implemented by FPC
|
||||
-XD = Link with dynamic libraries
|
||||
-XS = Link with static libraries, default on non-win32 platforms
|
||||
-XX = Link smart
|
||||
}
|
||||
@ -2732,14 +2722,6 @@ begin
|
||||
switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir);
|
||||
end;
|
||||
|
||||
{ TODO: Implement the following switches. They need to be added
|
||||
to the dialog. }
|
||||
{
|
||||
exxx = Errors file
|
||||
Lxxx = Use xxx as dynamic linker (LINUX only)
|
||||
oxxx = Object files
|
||||
rxxx = Compiler messages file
|
||||
}
|
||||
t := GetIgnoredMsgsIndexes(CompilerMessages, ',');
|
||||
if t <> '' then
|
||||
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
|
||||
@ -2785,6 +2767,9 @@ begin
|
||||
|
||||
}
|
||||
// append -o Option if neccessary
|
||||
{ * -o to define the target file name.
|
||||
* -FE if the target file name is not in the project directory (where the lpi file is)
|
||||
* -FU if the unit output directory is not empty }
|
||||
//DebugLn(['TBaseCompilerOptions.MakeOptionsString ',DbgSName(Self),' ',ccloDoNotAppendOutFileOption in Flags,' TargetFilename="',TargetFilename,'" CurMainSrcFile="',CurMainSrcFile,'" CurOutputDir="',CurOutputDir,'"']);
|
||||
if (not (ccloDoNotAppendOutFileOption in Flags))
|
||||
and (not (ccloNoMacroParams in Flags))
|
||||
@ -2801,7 +2786,7 @@ begin
|
||||
if (NewTargetDirectory <> '')
|
||||
and (CompareFilenames(ChompPathDelim(NewTargetDirectory),ChompPathDelim(BaseDirectory))=0)
|
||||
then begin
|
||||
// if target file is in base directory, do not use -FE switch
|
||||
// if target file is in the base directory, do not use -FE switch
|
||||
// Without -FE and -FU switch the compiler puts .ppu files in the source
|
||||
// directories, which is Delphi compatible.
|
||||
// See bug http://bugs.freepascal.org/view.php?id=15535
|
||||
|
@ -96,10 +96,12 @@ function CreateCompilerTestPascalFilename: string;
|
||||
|
||||
// returns the standard executable extension (e.g '.exe')
|
||||
function GetExecutableExt(TargetOS: string = ''): string;
|
||||
function MakeStandardExeFilename(TargetOS, Filename: string): string;
|
||||
// returns the standard library extension (e.g '.dll' or '.dylib')
|
||||
function GetLibraryExt(TargetOS: string = ''): string;
|
||||
// returns the standard library prefix (e.g 'lib')
|
||||
function GetLibraryPrefix(TargetOS: string = ''): string;
|
||||
function MakeStandardLibFilename(TargetOS, Filename: string): string;
|
||||
|
||||
// returns the standard file extension for compiled units (e.g '.ppu')
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
@ -326,6 +328,18 @@ begin
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function MakeStandardExeFilename(TargetOS, Filename: string): string;
|
||||
var
|
||||
StdExt: String;
|
||||
begin
|
||||
Result:=Filename;
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
StdExt:=GetExecutableExt(TargetOS);
|
||||
if StdExt='' then exit;
|
||||
Result:=ChangeFileExt(Result,StdExt);
|
||||
end;
|
||||
|
||||
function GetLibraryExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
@ -356,6 +370,31 @@ begin
|
||||
Result:='lib';
|
||||
end;
|
||||
|
||||
function MakeStandardLibFilename(TargetOS, Filename: string): string;
|
||||
var
|
||||
StdExt: String;
|
||||
StdPrefix: String;
|
||||
begin
|
||||
Result:=Filename;
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
// change extension
|
||||
StdExt:=GetLibraryExt(TargetOS);
|
||||
if StdExt<>'' then
|
||||
Result:=ChangeFileExt(Result,StdExt);
|
||||
// change prefix
|
||||
StdPrefix:=GetLibraryPrefix(TargetOS);
|
||||
if StdPrefix<>'' then
|
||||
Result:=ExtractFilePath(Result)+StdPrefix+ExtractFileName(Result);
|
||||
// lowercase
|
||||
if (CompareText(TargetOS,'linux')=0)
|
||||
or (CompareText(TargetOS,'freebsd')=0)
|
||||
or (CompareText(TargetOS,'netbsd')=0)
|
||||
or (CompareText(TargetOS,'openbsd')=0)
|
||||
then
|
||||
Result:=ExtractFilePath(Result)+lowercase(ExtractFileName(Result));
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:=lowerCase({$I %FPCTARGETOS%});
|
||||
|
Loading…
Reference in New Issue
Block a user