implemented compilation of simple packages

git-svn-id: trunk@4072 -
This commit is contained in:
mattias 2003-04-17 11:40:41 +00:00
parent 4ac981d4de
commit 26ea00db8d
7 changed files with 197 additions and 83 deletions

View File

@ -80,8 +80,10 @@ type
const const
ParsedCompilerSearchPaths = [pcosUnitPath,pcosIncludePath, ParsedCompilerSearchPaths = [pcosUnitPath,pcosIncludePath,
pcosObjectPath,pcosLibraryPath]; pcosObjectPath,pcosLibraryPath];
ParsedCompilerFilenames = [pcosOutputDir,pcosCompilerPath]; ParsedCompilerFilenames = [pcosCompilerPath];
ParsedCompilerFiles = ParsedCompilerSearchPaths+ParsedCompilerFilenames; ParsedCompilerDirectories = [pcosOutputDir];
ParsedCompilerFiles =
ParsedCompilerSearchPaths+ParsedCompilerFilenames+ParsedCompilerDirectories;
type type
TLocalSubstitutionEvent = function(const s: string): string of object; TLocalSubstitutionEvent = function(const s: string): string of object;
@ -240,13 +242,14 @@ type
function MakeOptionsString: String; function MakeOptionsString: String;
function MakeOptionsString(const MainSourceFileName: string): String; virtual; function MakeOptionsString(const MainSourceFileName: string): String; virtual;
function CustomOptionsAsString: string; function CustomOptionsAsString: string;
function ParseSearchPaths(const switch, paths: String): String; function ConvertSearchPathToCmdLine(const switch, paths: String): String;
function ParseOptions(const Delim, Switch, OptionStr: string): string; function ConvertOptionsToCmdLine(const Delim, Switch, OptionStr: string): string;
function GetXMLConfigPath: String; virtual; function GetXMLConfigPath: String; virtual;
function CreateTargetFilename(const MainSourceFileName: string): string; virtual; function CreateTargetFilename(const MainSourceFileName: string): string; virtual;
procedure GetInheritedCompilerOptions(var OptionsList: TList); virtual; procedure GetInheritedCompilerOptions(var OptionsList: TList); virtual;
function GetOwnerName: string; virtual; function GetOwnerName: string; virtual;
function GetInheritedOption(Option: TInheritedCompilerOption): string; virtual; function GetInheritedOption(Option: TInheritedCompilerOption;
RelativeToBaseDir: boolean): string; virtual;
function MergeLinkerOptions(const OldOptions, AddOptions: string): string; function MergeLinkerOptions(const OldOptions, AddOptions: string): string;
function MergeCustomOptions(const OldOptions, AddOptions: string): string; function MergeCustomOptions(const OldOptions, AddOptions: string): string;
function GetDefaultMainSourceFileName: string; virtual; function GetDefaultMainSourceFileName: string; virtual;
@ -1063,10 +1066,10 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function TBaseCompilerOptions.GetInheritedOption( function TBaseCompilerOptions.GetInheritedOption(
Option: TInheritedCompilerOption): string; Option: TInheritedCompilerOption; RelativeToBaseDir: boolean): string;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TBaseCompilerOptions.GetInheritedOption( function TBaseCompilerOptions.GetInheritedOption(
Option: TInheritedCompilerOption): string; Option: TInheritedCompilerOption; RelativeToBaseDir: boolean): string;
var var
OptionsList: TList; OptionsList: TList;
i: Integer; i: Integer;
@ -1114,6 +1117,10 @@ begin
fInheritedOptGraphStamps:=CompilerGraphStamp; fInheritedOptGraphStamps:=CompilerGraphStamp;
end; end;
Result:=fInheritedOptions[Option]; Result:=fInheritedOptions[Option];
if RelativeToBaseDir then begin
if Option in [icoUnitPath,icoIncludePath,icoObjectPath,icoLibraryPath] then
Result:=CreateRelativeSearchPath(Result,BaseDirectory);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -1528,13 +1535,13 @@ Processor specific options:
if PassLinkerOptions then begin if PassLinkerOptions then begin
CurLinkerOptions:=ParsedOpts.GetParsedValue(pcosLinkerOptions); CurLinkerOptions:=ParsedOpts.GetParsedValue(pcosLinkerOptions);
if (CurLinkerOptions<>'') then if (CurLinkerOptions<>'') then
switches := switches + ' ' + ParseOptions(' ','-k', CurLinkerOptions); switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', CurLinkerOptions);
end; end;
// inherited Linker options // inherited Linker options
InhLinkerOpts:=GetInheritedOption(icoLinkerOptions); InhLinkerOpts:=GetInheritedOption(icoLinkerOptions,true);
if InhLinkerOpts<>'' then if InhLinkerOpts<>'' then
switches := switches + ' ' + ParseOptions(' ','-k', InhLinkerOpts); switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', InhLinkerOpts);
{ ---------------- Other Tab -------------------- } { ---------------- Other Tab -------------------- }
@ -1602,42 +1609,44 @@ Processor specific options:
// include path // include path
CurIncludePath:=ParsedOpts.GetParsedValue(pcosIncludePath); CurIncludePath:=ParsedOpts.GetParsedValue(pcosIncludePath);
if (CurIncludePath <> '') then if (CurIncludePath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fi', CurIncludePath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fi', CurIncludePath);
// inherited include path // inherited include path
InhIncludePath:=GetInheritedOption(icoIncludePath); InhIncludePath:=GetInheritedOption(icoIncludePath,true);
if (InhIncludePath <> '') then if (InhIncludePath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fi', InhIncludePath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fi', InhIncludePath);
// library path // library path
CurLibraryPath:=ParsedOpts.GetParsedValue(pcosLibraryPath); CurLibraryPath:=ParsedOpts.GetParsedValue(pcosLibraryPath);
if (CurLibraryPath <> '') then if (CurLibraryPath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fl', CurLibraryPath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fl', CurLibraryPath);
// inherited library path // inherited library path
InhLibraryPath:=GetInheritedOption(icoLibraryPath); InhLibraryPath:=GetInheritedOption(icoLibraryPath,true);
if (InhLibraryPath <> '') then if (InhLibraryPath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fl', InhLibraryPath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fl', InhLibraryPath);
// object path // object path
CurObjectPath:=ParsedOpts.GetParsedValue(pcosObjectPath); CurObjectPath:=ParsedOpts.GetParsedValue(pcosObjectPath);
if (CurObjectPath <> '') then if (CurObjectPath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fo', CurObjectPath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', CurObjectPath);
// inherited object path // inherited object path
InhObjectPath:=GetInheritedOption(icoObjectPath); InhObjectPath:=GetInheritedOption(icoObjectPath,true);
if (InhObjectPath <> '') then if (InhObjectPath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fo', InhObjectPath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', InhObjectPath);
// unit path // unit path
CurUnitPath:=ParsedOpts.GetParsedValue(pcosUnitPath); CurUnitPath:=ParsedOpts.GetParsedValue(pcosUnitPath);
if (CurUnitPath <> '') then // always add the current directory to the unit path, so that the compiler
switches := switches + ' ' + ParseSearchPaths('-Fu', CurUnitPath); // checks for changed files in the directory
CurUnitPath:=CurUnitPath+';.';
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fu', CurUnitPath);
// inherited unit path // inherited unit path
InhUnitPath:=GetInheritedOption(icoUnitPath); InhUnitPath:=GetInheritedOption(icoUnitPath,true);
if (InhUnitPath <> '') then if (InhUnitPath <> '') then
switches := switches + ' ' + ParseSearchPaths('-Fu', InhUnitPath); switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fu', InhUnitPath);
{ CompilerPath - Nothing needs to be done with this one } { CompilerPath - Nothing needs to be done with this one }
@ -1711,7 +1720,7 @@ Processor specific options:
Switches:=Switches+' '+CurCustomOptions; Switches:=Switches+' '+CurCustomOptions;
// inherited custom options // inherited custom options
InhCustomOptions:=GetInheritedOption(icoCustomOptions); InhCustomOptions:=GetInheritedOption(icoCustomOptions,true);
if InhCustomOptions<>'' then if InhCustomOptions<>'' then
Switches:=Switches+' '+InhCustomOptions; Switches:=Switches+' '+InhCustomOptions;
@ -1733,9 +1742,10 @@ begin
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ TBaseCompilerOptions ParseSearchPaths } { TBaseCompilerOptions ConvertSearchPathToCmdLine }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
function TBaseCompilerOptions.ParseSearchPaths(const switch, paths: String): String; function TBaseCompilerOptions.ConvertSearchPathToCmdLine(
const switch, paths: String): String;
var var
tempsw, SS, Delim: String; tempsw, SS, Delim: String;
M: Integer; M: Integer;
@ -1779,9 +1789,9 @@ begin
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TBaseCompilerOptions ParseOptions TBaseCompilerOptions ConvertOptionsToCmdLine
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TBaseCompilerOptions.ParseOptions(const Delim, Switch, function TBaseCompilerOptions.ConvertOptionsToCmdLine(const Delim, Switch,
OptionStr: string): string; OptionStr: string): string;
var Startpos, EndPos: integer; var Startpos, EndPos: integer;
begin begin
@ -1813,10 +1823,9 @@ begin
CopySecondaryConfigFile(fn); CopySecondaryConfigFile(fn);
end; end;
{------------------------------------------------------------------------------
{------------------------------------------------------------------------------} TBaseCompilerOptions Clear
{ TBaseCompilerOptions Clear } ------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
procedure TBaseCompilerOptions.Clear; procedure TBaseCompilerOptions.Clear;
begin begin
fOptionsString := ''; fOptionsString := '';
@ -2570,20 +2579,16 @@ begin
AncestorNode.SelectedIndex:=AncestorNode.ImageIndex; AncestorNode.SelectedIndex:=AncestorNode.ImageIndex;
with CompilerOpts do begin with CompilerOpts do begin
AddChildNode('unit path', AddChildNode('unit path',
CreateRelativeSearchPath(GetInheritedOption(icoUnitPath), GetInheritedOption(icoUnitPath,true),icoUnitPath);
BaseDirectory),icoUnitPath);
AddChildNode('include path', AddChildNode('include path',
CreateRelativeSearchPath(GetInheritedOption(icoIncludePath), GetInheritedOption(icoIncludePath,true),icoIncludePath);
BaseDirectory),icoIncludePath);
AddChildNode('object path', AddChildNode('object path',
CreateRelativeSearchPath(GetInheritedOption(icoObjectPath), GetInheritedOption(icoObjectPath,true),icoObjectPath);
BaseDirectory),icoObjectPath);
AddChildNode('library path', AddChildNode('library path',
CreateRelativeSearchPath(GetInheritedOption(icoLibraryPath), GetInheritedOption(icoLibraryPath,true),icoLibraryPath);
BaseDirectory),icoLibraryPath); AddChildNode('linker options',GetInheritedOption(icoLinkerOptions,true),
AddChildNode('linker options',GetInheritedOption(icoLinkerOptions),
icoLinkerOptions); icoLinkerOptions);
AddChildNode('custom options',GetInheritedOption(icoCustomOptions), AddChildNode('custom options',GetInheritedOption(icoCustomOptions,true),
icoCustomOptions); icoCustomOptions);
end; end;
AncestorNode.Expanded:=true; AncestorNode.Expanded:=true;
@ -4158,6 +4163,14 @@ begin
if (BaseDirectory<>'') and (not FilenameIsAbsolute(s)) then if (BaseDirectory<>'') and (not FilenameIsAbsolute(s)) then
s:=BaseDirectory+s; s:=BaseDirectory+s;
end end
else if Option in ParsedCompilerDirectories then begin
// make directory absolute
s:=TrimFilename(s);
BaseDirectory:=GetParsedValue(pcosBaseDir);
if (BaseDirectory<>'') and (not FilenameIsAbsolute(s)) then
s:=BaseDirectory+s;
s:=AppendPathDelim(s);
end
else if Option in ParsedCompilerSearchPaths then begin else if Option in ParsedCompilerSearchPaths then begin
// make search paths absolute // make search paths absolute
BaseDirectory:=GetParsedValue(pcosBaseDir); BaseDirectory:=GetParsedValue(pcosBaseDir);

View File

@ -43,9 +43,10 @@ uses
Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms, Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms,
Buttons, Menus, ComCtrls, Spin, ProjectDefs, Project, SysUtils, FileCtrl, Buttons, Menus, ComCtrls, Spin, ProjectDefs, Project, SysUtils, FileCtrl,
Controls, Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager, Controls, Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager,
Splash, ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter, IDEDefs, Splash, TransferMacros, ObjectInspector, PropEdits, SynEditKeyCmds,
MsgView, EnvironmentOpts, EditorOptions, IDEComp, FormEditor, CompilerOptions, OutputFilter, IDEDefs, MsgView, EnvironmentOpts, EditorOptions, IDEComp,
KeyMapping, IDEProcs, UnitEditor, Debugger, IDEOptionDefs, CodeToolsDefines; FormEditor, CompilerOptions, KeyMapping, IDEProcs, UnitEditor, Debugger,
IDEOptionDefs, CodeToolsDefines;
type type
// The IDE is at anytime in a specific state: // The IDE is at anytime in a specific state:
@ -336,7 +337,8 @@ type
public public
ToolStatus: TIDEToolStatus; ToolStatus: TIDEToolStatus;
CurrentParsedCompilerOption: TParsedCompilerOptions; CurrentParsedCompilerOption: TParsedCompilerOptions;
MacroList: TTransferMacroList;
function FindUnitFile(const AFilename: string): string; virtual; abstract; function FindUnitFile(const AFilename: string): string; virtual; abstract;
procedure GetCurrentUnit(var ActiveSourceEditor:TSourceEditor; procedure GetCurrentUnit(var ActiveSourceEditor:TSourceEditor;
var ActiveUnitInfo:TUnitInfo); virtual; abstract; var ActiveUnitInfo:TUnitInfo); virtual; abstract;

View File

@ -428,6 +428,7 @@ type
procedure UpdateEditorRect; procedure UpdateEditorRect;
procedure GetInheritedCompilerOptions(var OptionsList: TList); procedure GetInheritedCompilerOptions(var OptionsList: TList);
function GetCompileSourceFilename: string; function GetCompileSourceFilename: string;
function GetOutputDirectory: string;
// files // files
function FindPkgFile(const AFilename: string; function FindPkgFile(const AFilename: string;
ResolveLinks, IgnoreRemoved: boolean): TPkgFile; ResolveLinks, IgnoreRemoved: boolean): TPkgFile;
@ -2063,6 +2064,14 @@ begin
Result:=ChangeFileExt(ExtractFilename(Filename),'.pas'); Result:=ChangeFileExt(ExtractFilename(Filename),'.pas');
end; end;
function TLazPackage.GetOutputDirectory: string;
begin
if HasDirectory then begin
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir);
end else
Result:='';
end;
{ TPkgComponent } { TPkgComponent }
procedure TPkgComponent.SetPkgFile(const AValue: TPkgFile); procedure TPkgComponent.SetPkgFile(const AValue: TPkgFile);

View File

@ -792,9 +792,11 @@ begin
PackageType:=lptDesignTime; PackageType:=lptDesignTime;
Installed:=pitStatic; Installed:=pitStatic;
CompilerOptions.UnitOutputDirectory:=''; CompilerOptions.UnitOutputDirectory:='';
UsageOptions.UnitPath:='';
// add lazarus registration unit path
UsageOptions.UnitPath:='$(LazarusDir)/packager/units';
// add files // add registering units
AddFile('inc/process.pp','Process',pftUnit,[pffHasRegisterProc],cpBase); AddFile('inc/process.pp','Process',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('db/db.pp','DB',pftUnit,[pffHasRegisterProc],cpBase); AddFile('db/db.pp','DB',pftUnit,[pffHasRegisterProc],cpBase);
@ -819,7 +821,7 @@ begin
Installed:=pitStatic; Installed:=pitStatic;
CompilerOptions.UnitOutputDirectory:=''; CompilerOptions.UnitOutputDirectory:='';
// add files // add registering units
AddFile('menus.pp','Menus',pftUnit,[pffHasRegisterProc],cpLCL); AddFile('menus.pp','Menus',pftUnit,[pffHasRegisterProc],cpLCL);
AddFile('buttons.pp','Buttons',pftUnit,[pffHasRegisterProc],cpLCL); AddFile('buttons.pp','Buttons',pftUnit,[pffHasRegisterProc],cpLCL);
AddFile('stdctrls.pp','StdCtrls',pftUnit,[pffHasRegisterProc],cpLCL); AddFile('stdctrls.pp','StdCtrls',pftUnit,[pffHasRegisterProc],cpLCL);

View File

@ -50,6 +50,7 @@ uses
InputHistory, IDEDefs, UComponentManMain, Project, ComponentReg, InputHistory, IDEDefs, UComponentManMain, Project, ComponentReg,
PackageEditor, AddToPackageDlg, PackageDefs, PackageLinks, PackageSystem, PackageEditor, AddToPackageDlg, PackageDefs, PackageLinks, PackageSystem,
OpenInstalledPkgDlg, PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions, OpenInstalledPkgDlg, PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions,
ExtToolDialog, ExtToolEditDlg,
BasePkgManager, MainBar; BasePkgManager, MainBar;
type type
@ -904,6 +905,9 @@ function TPkgManager.DoCompilePackage(APackage: TLazPackage;
Flags: TPkgCompileFlags): TModalResult; Flags: TPkgCompileFlags): TModalResult;
var var
PathList: TList; PathList: TList;
PkgCompileTool: TExternalToolOptions;
OutputDir: String;
SrcFilename: String;
begin begin
Result:=mrCancel; Result:=mrCancel;
@ -929,6 +933,16 @@ begin
exit; exit;
end; end;
// create the output directory
OutputDir:=APackage.GetOutputDirectory;
if not ForceDirectory(OutputDir) then begin
Result:=MessageDlg('Unable to create directory',
'Unable to create output directory "'+OutputDir+'"'#13
+'for package '+APackage.IDAsString+'.',
mtError,[mbCancel,mbAbort],0);
exit;
end;
// save everything // save everything
Result:=MainIDE.DoSaveForBuild; Result:=MainIDE.DoSaveForBuild;
if Result<>mrOk then exit; if Result<>mrOk then exit;
@ -941,9 +955,28 @@ begin
// create package main source file // create package main source file
Result:=DoSavePackageMainSource(APackage,Flags); Result:=DoSavePackageMainSource(APackage,Flags);
if Result<>mrOk then exit; if Result<>mrOk then exit;
SrcFilename:=CreateRelativePath(OutputDir+APackage.GetCompileSourceFilename,
APackage.Directory);
// create external tool to run the compiler
PkgCompileTool:=TExternalToolOptions.Create;
PkgCompileTool.Title:='Compiling package '+APackage.IDAsString;
PkgCompileTool.Filename:=APackage.CompilerOptions.CompilerPath;
PkgCompileTool.ScanOutputForFPCMessages:=true;
PkgCompileTool.ScanOutputForMakeMessages:=true;
PkgCompileTool.WorkingDirectory:=APackage.Directory;
PkgCompileTool.CmdLineParams:=APackage.CompilerOptions.MakeOptionsString
+' '+SrcFilename;
// clear old errors
SourceNotebook.ClearErrorLines;
// compile package // compile package
Result:=EnvironmentOptions.ExternalTools.Run(PkgCompileTool,MainIDE.MacroList);
// clean up
PkgCompileTool.Free;
MainIDE.DoCheckFilesOnDisk;
Result:=mrOk; Result:=mrOk;
end; end;
@ -961,16 +994,20 @@ var
CurUnitName: String; CurUnitName: String;
RegistrationCode: String; RegistrationCode: String;
fs: TFileStream; fs: TFileStream;
HeaderSrc: String;
OutputDir: String;
begin begin
// check if package is ready for saving // check if package is ready for saving
if not APackage.HasDirectory then begin OutputDir:=APackage.GetOutputDirectory;
Result:=MessageDlg('Package has no directory', if not DirectoryExists(OutputDir) then begin
'Package "'+APackage.IDAsString+'" has no valid directory.', Result:=MessageDlg('Directory not found',
'Package "'+APackage.IDAsString+'" has no valid output directory:'#13
+'"'+OutputDir+'"',
mtError,[mbCancel,mbAbort],0); mtError,[mbCancel,mbAbort],0);
exit; exit;
end; end;
SrcFilename:=APackage.Directory+APackage.GetCompileSourceFilename; SrcFilename:=OutputDir+APackage.GetCompileSourceFilename;
// backup old file // backup old file
Result:=MainIDE.DoBackupFile(SrcFilename,false); Result:=MainIDE.DoBackupFile(SrcFilename,false);
@ -1014,7 +1051,15 @@ begin
// create source // create source
Src:='interface'+e HeaderSrc:=
'{ This file was automatically created by Lazarus. Do not edit!'+e
+' This source is only used to compile and install'+e
+' the package '+APackage.IDAsString+'.'+e
+'}'+e
+e;
Src:='unit '+APackage.Name+';'+e
+e
+'interface'+e
+e +e
+'uses'+e +'uses'+e
+' '+UsedUnits+', LazarusPackageIntf;'+e +' '+UsedUnits+', LazarusPackageIntf;'+e
@ -1031,12 +1076,7 @@ begin
+'end.'+e; +'end.'+e;
Src:=CodeToolBoss.SourceChangeCache.BeautifyCodeOptions. Src:=CodeToolBoss.SourceChangeCache.BeautifyCodeOptions.
BeautifyStatement(Src,0); BeautifyStatement(Src,0);
Src:='{ This file was automatically created by Lazarus. Do not edit!'+e Src:=HeaderSrc+Src;
+' This source is only used to compile and install'+e
+' the package '+APackage.IDAsString+'.'+e
+'}'+e
+e
+Src;
// save source // save source
try try

View File

@ -1,5 +1,5 @@
# #
# Don't edit, this file is generated by FPCMake Version 1.1 [2002/09/21] # Don't edit, this file is generated by FPCMake Version 1.1 [2003/03/28]
# #
default: all default: all
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx
@ -58,6 +58,9 @@ ifdef inUnix
PATHSEP=/ PATHSEP=/
else else
PATHSEP:=$(subst /,\,/) PATHSEP:=$(subst /,\,/)
ifdef inCygWin
PATHSEP=/
endif
endif endif
ifdef PWD ifdef PWD
BASEDIR:=$(subst \,/,$(shell $(PWD))) BASEDIR:=$(subst \,/,$(shell $(PWD)))
@ -139,6 +142,16 @@ ifndef OS_TARGET
OS_TARGET:=$(shell $(FPC) -iTO) OS_TARGET:=$(shell $(FPC) -iTO)
endif endif
endif endif
ifndef CPU_TARGET
ifdef CPU_TARGET_DEFAULT
CPU_TARGET=$(CPU_TARGET_DEFAULT)
endif
endif
ifndef OS_TARGET
ifdef OS_TARGET_DEFAULT
OS_TARGET=$(OS_TARGET_DEFAULT)
endif
endif
FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
ifneq ($(FULL_TARGET),$(FULL_SOURCE)) ifneq ($(FULL_TARGET),$(FULL_SOURCE))
@ -782,7 +795,8 @@ override REQUIRE_PACKAGES=rtl rtl fcl
ifeq ($(OS_TARGET),linux) ifeq ($(OS_TARGET),linux)
REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1 REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_INET=1 REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1 REQUIRE_PACKAGES_IBASE=1
@ -795,6 +809,7 @@ endif
ifeq ($(OS_TARGET),win32) ifeq ($(OS_TARGET),win32)
REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1 REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1 REQUIRE_PACKAGES_IBASE=1
@ -807,7 +822,8 @@ endif
ifeq ($(OS_TARGET),freebsd) ifeq ($(OS_TARGET),freebsd)
REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1 REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_INET=1 REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1 REQUIRE_PACKAGES_IBASE=1
@ -820,7 +836,8 @@ endif
ifeq ($(OS_TARGET),netbsd) ifeq ($(OS_TARGET),netbsd)
REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1 REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_INET=1 REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1 REQUIRE_PACKAGES_IBASE=1
@ -853,7 +870,8 @@ endif
ifeq ($(OS_TARGET),openbsd) ifeq ($(OS_TARGET),openbsd)
REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1 REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_INET=1 REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1 REQUIRE_PACKAGES_IBASE=1
@ -915,30 +933,56 @@ ifdef UNITDIR_PASZLIB
override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB)
endif endif
endif endif
ifdef REQUIRE_PACKAGES_INET ifdef REQUIRE_PACKAGES_NETDB
PACKAGEDIR_INET:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR)))))) PACKAGEDIR_NETDB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /netdb/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_INET),) ifneq ($(PACKAGEDIR_NETDB),)
ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) ifneq ($(wildcard $(PACKAGEDIR_NETDB)/$(OS_TARGET)),)
UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) UNITDIR_NETDB=$(PACKAGEDIR_NETDB)/$(OS_TARGET)
else else
UNITDIR_INET=$(PACKAGEDIR_INET) UNITDIR_NETDB=$(PACKAGEDIR_NETDB)
endif endif
ifdef CHECKDEPEND ifdef CHECKDEPEND
$(PACKAGEDIR_INET)/$(FPCMADE): $(PACKAGEDIR_NETDB)/$(FPCMADE):
$(MAKE) -C $(PACKAGEDIR_INET) $(FPCMADE) $(MAKE) -C $(PACKAGEDIR_NETDB) $(FPCMADE)
override ALLDEPENDENCIES+=$(PACKAGEDIR_INET)/$(FPCMADE) override ALLDEPENDENCIES+=$(PACKAGEDIR_NETDB)/$(FPCMADE)
endif endif
else else
PACKAGEDIR_INET= PACKAGEDIR_NETDB=
UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) UNITDIR_NETDB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /netdb/Package.fpc,$(UNITSDIR)))))
ifneq ($(UNITDIR_INET),) ifneq ($(UNITDIR_NETDB),)
UNITDIR_INET:=$(firstword $(UNITDIR_INET)) UNITDIR_NETDB:=$(firstword $(UNITDIR_NETDB))
else else
UNITDIR_INET= UNITDIR_NETDB=
endif endif
endif endif
ifdef UNITDIR_INET ifdef UNITDIR_NETDB
override COMPILER_UNITDIR+=$(UNITDIR_INET) override COMPILER_UNITDIR+=$(UNITDIR_NETDB)
endif
endif
ifdef REQUIRE_PACKAGES_LIBASYNC
PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_LIBASYNC),)
ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/$(OS_TARGET)),)
UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/$(OS_TARGET)
else
UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)
endif
ifdef CHECKDEPEND
$(PACKAGEDIR_LIBASYNC)/$(FPCMADE):
$(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE)
override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE)
endif
else
PACKAGEDIR_LIBASYNC=
UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR)))))
ifneq ($(UNITDIR_LIBASYNC),)
UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC))
else
UNITDIR_LIBASYNC=
endif
endif
ifdef UNITDIR_LIBASYNC
override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC)
endif endif
endif endif
ifdef REQUIRE_PACKAGES_FCL ifdef REQUIRE_PACKAGES_FCL
@ -1416,6 +1460,7 @@ fpc_baseinfo:
@$(ECHO) Rm........ $(RMPROG) @$(ECHO) Rm........ $(RMPROG)
@$(ECHO) GInstall.. $(GINSTALL) @$(ECHO) GInstall.. $(GINSTALL)
@$(ECHO) Echo...... $(ECHO) @$(ECHO) Echo...... $(ECHO)
@$(ECHO) Shell..... $(SHELL)
@$(ECHO) Date...... $(DATE) @$(ECHO) Date...... $(DATE)
@$(ECHO) FPCMake... $(FPCMAKE) @$(ECHO) FPCMake... $(FPCMAKE)
@$(ECHO) PPUMove... $(PPUMOVE) @$(ECHO) PPUMove... $(PPUMOVE)

View File

@ -46,3 +46,6 @@ makefile: Makefile.fpc
-$(FPCMAKE) -w -$(FPCMAKE) -w
makefiles: makefile makefiles: makefile
# end.