* Accept presence of Makefile+fpmake.pp as alid package dir

This commit is contained in:
Michaël Van Canneyt 2023-07-25 14:32:54 +02:00
parent ba534b1192
commit 0db8f72dcd
3 changed files with 35 additions and 3 deletions

View File

@ -201,15 +201,29 @@ program fpcmake;
procedure ProcessFile(const fn:string; const aOutputFile : string);
var
ofn : String;
begin
Show(V_Verbose,TitleDate);
case ParaMode of
m_None :
Error('No operation specified, see -h for help');
m_Makefile :
ProcessFile_Makefile(fn,aOutputFile);
begin
ofn:=aOutputFile;
if ofn='' then
ofn:='Makefile';
ProcessFile_Makefile(fn,ofn);
end;
m_PackageFpc :
ProcessFile_PackageFpc(fn,aOutputFile);
begin
ofn:=aOutputFile;
if ofn='' then
ofn:='Package.fpc';
ProcessFile_PackageFpc(fn,ofn);
end;
end;
end;

View File

@ -985,6 +985,12 @@ implementation
s:=SubstVariables('$(firstword $(wildcard '+s+'))');
if TryFile(s) then
exit;
{ Check for Makefile }
s:=SubstVariables('$(addsuffix /'+ReqName+'/Makefile,$(FPCDIR)) $(addsuffix /'+ReqName+'/Makefile,$(PACKAGESDIR)) $(addsuffix /'+ReqName+'/Makefile,$(REQUIRE_PACKAGESDIR))');
Verbose(FPCMakeDebug,'Package "'+ReqName+'": Looking for Makefile+fpmake: "'+s+'"');
s:=SubstVariables('$(firstword $(wildcard '+s+'))');
if FileExists(s) then
exit;
Raise Exception.Create(Format(s_package_not_found,[OSStr[t],Reqname]));
end;
@ -1002,8 +1008,12 @@ implementation
{ give better error what is wrong }
if not PathExists(s) then
Raise Exception.Create(Format(s_directory_not_found,[s]))
// packages may no longer have 'Makefile.fpc', but they will have a Makefile.
// for such cases, the top Makefile.fpc must simply specify all dependencies recursively.
else if not FileExists(s+'/Makefile') then
Raise Exception.Create(Format(s_makefilefpc_not_found,[s]))
else
Raise Exception.Create(Format(s_makefilefpc_not_found,[s]));
exit;
end;
{ Process Makefile.fpc }
ReqFPCMake:=TFPCMake.Create(currdir+subdir+'/Makefile.fpc');

View File

@ -538,6 +538,14 @@ implementation
unitfpmakedirvar:='UNITDIR_FPMAKE_'+VarName(pack);
{ Search packagedir by looking for Makefile.fpc }
FOutput.Add(packdirvar+':=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /'+pack+'/Makefile.fpc,$(PACKAGESDIR))))))');
{ Packages may no longer have a Makefile.fpc . Check existance of Makefile + fpmake.pp to be sure }
FOutput.Add('ifeq ($('+packdirvar+'),)');
FOutput.Add(packdirvar+':=$(firstword $(subst /Makefile,,$(strip $(wildcard $(addsuffix /'+pack+'/Makefile,$(PACKAGESDIR))))))');
FOutput.Add('ifneq ($('+packdirvar+'),)');
FOutput.Add(packdirvar+':=$(firstword $(subst /fpmake.pp,,$(strip $(wildcard $(addsuffix /'+pack+'/fpmake.pp,$(PACKAGESDIR))))))');
FOutput.Add('endif');
FOutput.Add('endif');
FOutput.Add('ifneq ($('+packdirvar+'),)');
{ Create unit dir, check if os dependent dir exists }
FOutput.Add('ifneq ($(wildcard $('+packdirvar+')/units/$(TARGETSUFFIX)),)');