* Lazarus project file

* Remove unused KnownArchitectures tryout
* Add SUB_TARGET
This commit is contained in:
Michael VAN CANNEYT 2022-12-13 17:42:40 +01:00 committed by Pierre Muller
parent 53b4acbcca
commit 9fc8bc5210
6 changed files with 578 additions and 451 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,9 @@ OSNeedsComspecToRunBatch = go32v2 watcom
FORCE:
.PHONY: FORCE
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
[osdetect]
#####################################################################
# Autodetect source OS (Linux or Dos or Windows NT or OS/2 or other)
@ -249,8 +252,26 @@ endif
ifndef OS_TARGET
OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
endif
FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
CPU_OS_TARGET=$(CPU_TARGET)-$(OS_TARGET)
ifdef SUB_TARGET
L_SUB_TARGET=$(call lc,$(SUB_TARGET))
FULL_TARGET:=$(CPU_TARGET)-$(OS_TARGET)-$(L_SUB_TARGET)
else
FULL_TARGET:=$(CPU_TARGET)-$(OS_TARGET)
endif
#
# not sure if we'll need this, but defining it for the moment.
# Reason for defining it: this could redefine a "cross-compile".
#
CPU_OS_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
ifdef SUB_SOURCE
L_SUB_SOURCE=$(call lc,$(SUB_SOURCE))
FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)-$(L_SUB_SOURCE)
else
FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
endif
ifeq ($(CPU_TARGET),armeb)
ARCH=arm
@ -268,6 +289,11 @@ ifeq ($(FULL_TARGET),aarch64-embedded)
# override FPCOPT+=-Cp$(SUBARCH)
endif
ifdef SUB_TARGET
override FPCOPT+=-t$(SUB_TARGET)
endif
ifeq ($(FULL_TARGET),arm-embedded)
ifeq ($(SUBARCH),)
# we don't add a default here, people should explicitly add the SUBARCH
@ -328,14 +354,17 @@ SOURCESUFFIX=$(FULL_SOURCE)
endif
# Cross compile flag
ifneq ($(FULL_TARGET),$(FULL_SOURCE))
#
# We may need to switch to FULL_TARGET/FULL_TARGET
#
ifneq ($(CPU_OS_TARGET),$(CPU_OS_SOURCE))
CROSSCOMPILE=1
endif
# Check if the Makefile supports this target, but not
# when the make target is to rebuild the makefile
ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
ifeq ($(filter $(FULL_TARGET),$(MAKEFILETARGETS)),)
ifeq ($(filter $(CPU_OS_TARGET),$(MAKEFILETARGETS)),)
$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
endif
endif
@ -361,7 +390,7 @@ BUILDNATIVE=1
export BUILDNATIVE
endif
export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE SUB_TARGET SUB_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE CPU_OS_TARGET CPU_OS_SOURCE
[fpmakefpcdetect]
#####################################################################

58
utils/fpcm/fpcmake.lpi Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="fpcmake"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<Units>
<Unit>
<Filename Value="fpcmake.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="fpcmmain.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="fpcmdic.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="fpcmpkg.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="fpcmwr.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="fpcmake"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
</CONFIG>

View File

@ -21,7 +21,7 @@ program fpcmake;
uses
getopts,
sysutils,
fpcmmain,fpcmwr,fpcmpkg;
fpcmmain,fpcmwr,fpcmpkg, fpcmdic;
type
{ Verbosity Level }

View File

@ -209,8 +209,11 @@ interface
TFPCMakeVerbose = (FPCMakeError, FPCMakeInfo, FPCMakeDebug);
{ TFPCMake }
TFPCMake = class
private
FKnownArchitectures: TStrings;
FStream : TStream;
FFileName : string;
FCommentChars : TSysCharSet;
@ -270,6 +273,7 @@ interface
property CommentChars:TSysCharSet read FCommentChars write FCommentChars;
property EmptyLines:Boolean read FEmptyLines write FEmptyLines;
property IncludeTargets:TTargetSet read FIncludeTargets write FIncludeTargets;
Property KnownArchitectures : TStrings Read FKnownArchitectures;
end;
function posidx(const substr,s : string;idx:integer):integer;
@ -649,6 +653,7 @@ implementation
for c:=low(tcpu) to high(tcpu) do
for t:=low(tos) to high(tos) do
FRequireList[c,t]:=TStringList.Create;
FKnownArchitectures:=TStringList.Create;
FVariables:=TKeyValue.Create;
FCommentChars:=[';','#'];
FEmptyLines:=false;
@ -672,6 +677,7 @@ implementation
for c:=low(tcpu) to high(tcpu) do
for t:=low(tos) to high(tos) do
FRequireList[c,t].Free;
FKnownArchitectures.Free;
FVariables.Free;
end;
@ -1104,7 +1110,7 @@ implementation
end;
function TFPCMake.GetTargetRequires(c:TCpu;t:Tos):TStringList;
function TFPCMake.GetTargetRequires(c: TCpu; t: TOS): TStringList;
var
ReqSec : TFPCMakeSection;
ReqList : TStringList;

View File

@ -290,7 +290,7 @@ implementation
s:=FInput.GetTargetVariable(c,t,IniVar,false);
if s<>'' then
begin
FOutput.Add('ifeq ($(FULL_TARGET),'+CPUStr[c]+'-'+OSStr[t]+')');
FOutput.Add('ifeq ($(CPU_OS_TARGET),'+CPUStr[c]+'-'+OSStr[t]+')');
FOutput.Add('override '+FixVariable(IniVar)+'+='+s);
FOutput.Add('endif');
end;
@ -347,7 +347,7 @@ implementation
s:=FInput.GetTargetVariable(c,t,IniVar,false);
if s<>'' then
begin
FOutput.Add('ifeq ($(FULL_TARGET),'+CpuStr[c]+'-'+OSStr[t]+')');
FOutput.Add('ifeq ($(CPU_OS_TARGET),'+CpuStr[c]+'-'+OSStr[t]+')');
AddTokens(s);
FOutput.Add('endif');
end;
@ -608,7 +608,7 @@ implementation
FInput.Verbose(FPCMakeInfo,CpuStr[c]+'-'+OSStr[t]+' requires: '+sl.CommaText);
if sl.count>0 then
begin
FOutput.Add('ifeq ($(FULL_TARGET),'+CPUStr[c]+'-'+OSStr[t]+')');
FOutput.Add('ifeq ($(CPU_OS_TARGET),'+CPUStr[c]+'-'+OSStr[t]+')');
for i:=0 to sl.count-1 do
begin
FOutput.Add(prefix+VarName(sl[i])+'=1');