* Fixed problem with search-masks in fpmake.pp-files in subdirectories

git-svn-id: trunk@32142 -
This commit is contained in:
joost 2015-10-24 22:09:06 +00:00
parent 1491d9655c
commit c0bdce1330
21 changed files with 53 additions and 50 deletions

View File

@ -232,13 +232,13 @@ begin
AddSrc('readme.txt'); AddSrc('readme.txt');
AddSrc('todo.txt'); AddSrc('todo.txt');
AddSrc('fp.ans'); AddSrc('fp.ans');
AddSrcFiles('*.tdf'); AddSrcFiles('*.tdf',P.Directory);
AddSrcFiles('*.pas',true); AddSrcFiles('*.pas',P.Directory,true);
AddSrcFiles('*.inc',true); AddSrcFiles('*.inc',P.Directory,true);
AddSrcFiles('*.rc'); AddSrcFiles('*.rc',P.Directory);
AddSrcFiles('*.ico'); AddSrcFiles('*.ico',P.Directory);
AddSrcFiles('*.term'); AddSrcFiles('*.term',P.Directory);
AddSrcFiles('*.pt'); AddSrcFiles('*.pt',P.Directory);
end; end;
P.CleanFiles.Add('$(UNITSOUTPUTDIR)ppheap.ppu'); P.CleanFiles.Add('$(UNITSOUTPUTDIR)ppheap.ppu');

View File

@ -121,7 +121,7 @@ begin
end; end;
T:=P.Targets.addUnit('advancedipc.pp'); T:=P.Targets.addUnit('advancedipc.pp');
// Additional sources // Additional sources
P.Sources.AddSrcFiles('src/win/fclel.*'); P.Sources.AddSrcFiles('src/win/fclel.*', P.Directory);
// Install windows resources // Install windows resources
P.InstallFiles.Add('src/win/fclel.res',AllWindowsOSes,'$(unitinstalldir)'); P.InstallFiles.Add('src/win/fclel.res',AllWindowsOSes,'$(unitinstalldir)');

View File

@ -732,10 +732,10 @@ Type
Function AddExample(const AFiles : String) : TSource; Function AddExample(const AFiles : String) : TSource;
Function AddExample(const AFiles : String; AInstallSourcePath : String) : TSource; Function AddExample(const AFiles : String; AInstallSourcePath : String) : TSource;
Function AddTest(const AFiles : String) : TSource; Function AddTest(const AFiles : String) : TSource;
procedure AddDocFiles(const AFileMask: string; Recursive: boolean = False; AInstallSourcePath : String = ''); procedure AddDocFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean = False; AInstallSourcePath : String = '');
procedure AddSrcFiles(const AFileMask: string; Recursive: boolean = False); procedure AddSrcFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean = False);
procedure AddExampleFiles(const AFileMask: string; Recursive: boolean = False; AInstallSourcePath : String = ''); procedure AddExampleFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean = False; AInstallSourcePath : String = '');
procedure AddTestFiles(const AFileMask: string; Recursive: boolean = False); procedure AddTestFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean = False);
Property SourceItems[Index : Integer] : TSource Read GetSourceItem Write SetSourceItem;default; Property SourceItems[Index : Integer] : TSource Read GetSourceItem Write SetSourceItem;default;
end; end;
@ -1374,7 +1374,7 @@ Function GetCustomFpmakeCommandlineOptionValue(const ACommandLineOption : string
Function AddProgramExtension(const ExecutableName: string; AOS : TOS) : string; Function AddProgramExtension(const ExecutableName: string; AOS : TOS) : string;
Function GetImportLibraryFilename(const UnitName: string; AOS : TOS) : string; Function GetImportLibraryFilename(const UnitName: string; AOS : TOS) : string;
procedure SearchFiles(const AFileName: string; Recursive: boolean; var List: TStrings); procedure SearchFiles(AFileName, ASearchPathPrefix: string; Recursive: boolean; var List: TStrings);
function GetDefaultLibGCCDir(CPU : TCPU;OS: TOS; var ErrorMessage: string): string; function GetDefaultLibGCCDir(CPU : TCPU;OS: TOS; var ErrorMessage: string): string;
Implementation Implementation
@ -2402,7 +2402,7 @@ begin
end; end;
procedure SearchFiles(const AFileName: string; Recursive: boolean; var List: TStrings); procedure SearchFiles(AFileName, ASearchPathPrefix: string; Recursive: boolean; var List: TStrings);
procedure AddRecursiveFiles(const SearchDir, FileMask: string; Recursive: boolean); procedure AddRecursiveFiles(const SearchDir, FileMask: string; Recursive: boolean);
var var
@ -2425,12 +2425,16 @@ var
BasePath: string; BasePath: string;
i: integer; i: integer;
begin begin
if IsRelativePath(AFileName) and (ASearchPathPrefix<>'') then
AFileName := IncludeTrailingPathDelimiter(ASearchPathPrefix) + AFileName;
BasePath := ExtractFilePath(ExpandFileName(AFileName)); BasePath := ExtractFilePath(ExpandFileName(AFileName));
AddRecursiveFiles(BasePath, ExtractFileName(AFileName), Recursive); AddRecursiveFiles(BasePath, ExtractFileName(AFileName), Recursive);
CurrDir:=GetCurrentDir; CurrDir:=GetCurrentDir;
for i := 0 to Pred(List.Count) do for i := 0 to Pred(List.Count) do
List[i] := ExtractRelativepath(IncludeTrailingPathDelimiter(CurrDir), List[i]); List[i] := ExtractRelativepath(IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(CurrDir)+ASearchPathPrefix), List[i]);
end; end;
Const Const
@ -3166,53 +3170,52 @@ begin
Result.FSourceType:=stTest; Result.FSourceType:=stTest;
end; end;
procedure TSources.AddDocFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean; AInstallSourcePath: String);
procedure TSources.AddDocFiles(const AFileMask: string; Recursive: boolean; AInstallSourcePath : String = '');
var var
List : TStrings; List : TStrings;
i: integer; i: integer;
begin begin
List := TStringList.Create; List := TStringList.Create;
SearchFiles(AFileMask, Recursive, List); SearchFiles(AFileMask, ASearchPathPrefix, Recursive, List);
for i:= 0 to Pred(List.Count) do for i:= 0 to Pred(List.Count) do
AddDoc(List[i], AInstallSourcePath); AddDoc(List[i], AInstallSourcePath);
List.Free; List.Free;
end; end;
procedure TSources.AddSrcFiles(const AFileMask: string; Recursive: boolean); procedure TSources.AddSrcFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean);
var var
List : TStrings; List : TStrings;
i: integer; i: integer;
begin begin
List := TStringList.Create; List := TStringList.Create;
SearchFiles(AFileMask, Recursive, List); SearchFiles(AFileMask, ASearchPathPrefix, Recursive, List);
for i:= 0 to Pred(List.Count) do for i:= 0 to Pred(List.Count) do
AddSrc(List[i]); AddSrc(List[i]);
List.Free; List.Free;
end; end;
procedure TSources.AddExampleFiles(const AFileMask: string; Recursive: boolean; AInstallSourcePath : String = ''); procedure TSources.AddExampleFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean; AInstallSourcePath: String);
var var
List : TStrings; List : TStrings;
i: integer; i: integer;
begin begin
List := TStringList.Create; List := TStringList.Create;
SearchFiles(AFileMask, Recursive, List); SearchFiles(AFileMask, ASearchPathPrefix, Recursive, List);
for i:= 0 to Pred(List.Count) do for i:= 0 to Pred(List.Count) do
AddExample(List[i], AInstallSourcePath); AddExample(List[i], AInstallSourcePath);
List.Free; List.Free;
end; end;
procedure TSources.AddTestFiles(const AFileMask: string; Recursive: boolean); procedure TSources.AddTestFiles(const AFileMask, ASearchPathPrefix: string; Recursive: boolean);
var var
List : TStrings; List : TStrings;
i: integer; i: integer;
begin begin
List := TStringList.Create; List := TStringList.Create;
SearchFiles(AFileMask, Recursive, List); SearchFiles(AFileMask, ASearchPathPrefix, Recursive, List);
for i:= 0 to Pred(List.Count) do for i:= 0 to Pred(List.Count) do
AddTest(List[i]); AddTest(List[i]);
List.Free; List.Free;

View File

@ -30,7 +30,7 @@ begin
T:=P.Targets.AddUnit('gmp.pas'); T:=P.Targets.AddUnit('gmp.pas');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -1278,15 +1278,15 @@ begin
AddInclude('htmldocument.inc'); AddInclude('htmldocument.inc');
AddInclude('htmlview.inc'); AddInclude('htmlview.inc');
end;} end;}
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
P.Sources.AddExampleFiles('examples/filechooser/*',false,'filechooser'); P.Sources.AddExampleFiles('examples/filechooser/*',P.Directory,false,'filechooser');
P.Sources.AddExampleFiles('examples/gettingstarted/*',false,'gettingstarted'); P.Sources.AddExampleFiles('examples/gettingstarted/*',P.Directory,false,'gettingstarted');
P.Sources.AddExampleFiles('examples/gtk_demo/*',false,'gtk_demo'); P.Sources.AddExampleFiles('examples/gtk_demo/*',P.Directory,false,'gtk_demo');
P.Sources.AddExampleFiles('examples/gtkglext/*',false,'gtkglext'); P.Sources.AddExampleFiles('examples/gtkglext/*',P.Directory,false,'gtkglext');
P.Sources.AddExampleFiles('examples/helloworld/*',false,'helloworld'); P.Sources.AddExampleFiles('examples/helloworld/*',P.Directory,false,'helloworld');
P.Sources.AddExampleFiles('examples/helloworld2/*',false,'helloworld2'); P.Sources.AddExampleFiles('examples/helloworld2/*',P.Directory,false,'helloworld2');
P.Sources.AddExampleFiles('examples/plugins/*',false,'plugins'); P.Sources.AddExampleFiles('examples/plugins/*',P.Directory,false,'plugins');
P.Sources.AddExampleFiles('examples/scribble_simple/*',false,'scribble_simple'); P.Sources.AddExampleFiles('examples/scribble_simple/*',P.Directory,false,'scribble_simple');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}

View File

@ -45,7 +45,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testib40.pp'); P.Targets.AddExampleProgram('testib40.pp');
P.Targets.AddExampleProgram('testib60.pp'); P.Targets.AddExampleProgram('testib60.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -33,7 +33,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testcurl.pp'); P.Targets.AddExampleProgram('testcurl.pp');
P.Targets.AddExampleProgram('teststream.pp'); P.Targets.AddExampleProgram('teststream.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}

View File

@ -70,7 +70,7 @@ begin
AddInclude('mm_types.inc'); AddInclude('mm_types.inc');
end; end;
P.Sources.AddExampleFiles('examples/*',true,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,true,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -27,7 +27,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('gdtestcgi.pp'); P.Targets.AddExampleProgram('gdtestcgi.pp');
P.Targets.AddExampleProgram('gdtest.pp'); P.Targets.AddExampleProgram('gdtest.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -144,7 +144,7 @@ begin
AddInclude('mm_types.inc'); AddInclude('mm_types.inc');
end; end;
P.Sources.AddExampleFiles('examples/*',true,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,true,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;
end; end;

View File

@ -149,7 +149,7 @@ begin
AddInclude('wpad.inc'); AddInclude('wpad.inc');
end; end;
P.Sources.AddExampleFiles('examples/*',true,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,true,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -88,7 +88,7 @@ begin
P.Targets.AddExampleProgram('tree2.pas'); P.Targets.AddExampleProgram('tree2.pas');
P.Targets.AddExampleProgram('exutils.pas'); P.Targets.AddExampleProgram('exutils.pas');
P.Targets.AddExampleProgram('reader2.pas'); P.Targets.AddExampleProgram('reader2.pas');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -34,7 +34,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testodbc.pp'); P.Targets.AddExampleProgram('testodbc.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -30,7 +30,7 @@ begin
T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin]); T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin]);
P.Targets.AddExampleProgram('examples/es2example1.pas'); P.Targets.AddExampleProgram('examples/es2example1.pas');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}

View File

@ -46,7 +46,7 @@ begin
P.Targets.AddExampleProgram('clktest.pas'); P.Targets.AddExampleProgram('clktest.pas');
P.Targets.AddExampleProgram('ftptest.pas'); P.Targets.AddExampleProgram('ftptest.pas');
P.Targets.AddExampleProgram('lvmtest.pas'); P.Targets.AddExampleProgram('lvmtest.pas');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -57,7 +57,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testpg2.pp'); P.Targets.AddExampleProgram('testpg2.pp');
P.Targets.AddExampleProgram('testpg1.pp'); P.Targets.AddExampleProgram('testpg1.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -235,7 +235,7 @@ begin
P.Targets.AddExampleProgram('tunnel3d.pp'); P.Targets.AddExampleProgram('tunnel3d.pp');
P.Targets.AddExampleProgram('ptcgl.pp', AllUnixOSes + [win32, win64]); P.Targets.AddExampleProgram('ptcgl.pp', AllUnixOSes + [win32, win64]);
P.Targets.AddExampleProgram('ptcgl2.pp', AllUnixOSes + [win32, win64]); P.Targets.AddExampleProgram('ptcgl2.pp', AllUnixOSes + [win32, win64]);
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -34,7 +34,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testreg1.pp'); P.Targets.AddExampleProgram('testreg1.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -28,7 +28,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testvga.pp'); P.Targets.AddExampleProgram('testvga.pp');
P.Targets.AddExampleProgram('vgatest.pp'); P.Targets.AddExampleProgram('vgatest.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -24,7 +24,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testlog.pp'); P.Targets.AddExampleProgram('testlog.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}
Run; Run;

View File

@ -29,7 +29,7 @@ begin
P.ExamplePath.Add('examples'); P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testlibuid.pp'); P.Targets.AddExampleProgram('testlibuid.pp');
P.Targets.AddExampleProgram('testuid.pp'); P.Targets.AddExampleProgram('testuid.pp');
P.Sources.AddExampleFiles('examples/*',false,'.'); P.Sources.AddExampleFiles('examples/*',P.Directory,false,'.');
{$ifndef ALLPACKAGES} {$ifndef ALLPACKAGES}