mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-05 03:59:24 +02:00
* Implement -t and -x options
* Fix spurious warning of already specified -t * If no subtarget file found, error out instead of hint/warn * Globals needs subtarget for macro substitution
This commit is contained in:
parent
0b7a771ca9
commit
5605cebd46
@ -256,6 +256,9 @@ interface
|
|||||||
outputfilename : string;
|
outputfilename : string;
|
||||||
outputprefix : pshortstring;
|
outputprefix : pshortstring;
|
||||||
outputsuffix : pshortstring;
|
outputsuffix : pshortstring;
|
||||||
|
{ selected subtarget }
|
||||||
|
subtarget : string;
|
||||||
|
|
||||||
{ specified with -FE or -FU }
|
{ specified with -FE or -FU }
|
||||||
outputexedir : TPathStr;
|
outputexedir : TPathStr;
|
||||||
outputunitdir : TPathStr;
|
outputunitdir : TPathStr;
|
||||||
@ -1002,6 +1005,8 @@ implementation
|
|||||||
if (tf_use_8_3 in Source_Info.Flags) or
|
if (tf_use_8_3 in Source_Info.Flags) or
|
||||||
(tf_use_8_3 in Target_Info.Flags) then
|
(tf_use_8_3 in Target_Info.Flags) then
|
||||||
Replace(s,'$FPCTARGET',target_os_string)
|
Replace(s,'$FPCTARGET',target_os_string)
|
||||||
|
else if subtarget<>'' then
|
||||||
|
Replace(s,'$FPCTARGET',target_full_string+'-'+lower(subtarget))
|
||||||
else
|
else
|
||||||
Replace(s,'$FPCTARGET',target_full_string);
|
Replace(s,'$FPCTARGET',target_full_string);
|
||||||
Replace(s,'$FPCSUBARCH',lower(cputypestr[init_settings.cputype]));
|
Replace(s,'$FPCSUBARCH',lower(cputypestr[init_settings.cputype]));
|
||||||
|
@ -3629,6 +3629,12 @@ option_unsupported_fpu=11063_F_The selected FPU type "$1" is not supported by th
|
|||||||
% Not all instruction sets support all FPU types. For example on ARM, Thumb(-1) supports no FPU/VFP instruction set
|
% Not all instruction sets support all FPU types. For example on ARM, Thumb(-1) supports no FPU/VFP instruction set
|
||||||
option_too_many_exception_modes=11064_E_Only one WebAssembly exception support mode can be specified.
|
option_too_many_exception_modes=11064_E_Only one WebAssembly exception support mode can be specified.
|
||||||
% Only one WebAssembly exception support mode (NOEXCEPTIONS, JSEXCEPTIONS, BFEXCEPTIONS or NATIVEEXCEPTIONS) can be specified.
|
% Only one WebAssembly exception support mode (NOEXCEPTIONS, JSEXCEPTIONS, BFEXCEPTIONS or NATIVEEXCEPTIONS) can be specified.
|
||||||
|
option_subtarget_is_already_set=11065_W_Subtarget is already set to: $1
|
||||||
|
% Displayed if more than one \var{-t} option is specified.
|
||||||
|
option_subtarget_config_not_found=11066_E_Subtarget $1 specified but no corresponding config file $2 found.
|
||||||
|
% Displayed if more than one \var{-t} option is specified.
|
||||||
|
option_x_ignored=11067_N_Ignoring compiler executable suffix $1.
|
||||||
|
% Displayed if more than one \var{-t} option is specified.
|
||||||
%\end{description}
|
%\end{description}
|
||||||
# EndOfTeX
|
# EndOfTeX
|
||||||
|
|
||||||
@ -4313,6 +4319,10 @@ Z*2Tzxspectrum_ZX Spectrum
|
|||||||
W*2Tembedded_Embedded
|
W*2Tembedded_Embedded
|
||||||
W*2Twasi_The WebAssembly System Interface (WASI)
|
W*2Twasi_The WebAssembly System Interface (WASI)
|
||||||
# end of targets section
|
# end of targets section
|
||||||
|
**1t<x>_Target architecture
|
||||||
|
**2*_ * Defines FPC_SUBTARGET_<x>
|
||||||
|
**2*_ * Defines FPC_SUBTARGET as <arg>
|
||||||
|
**2*_ * Additionally reads config file fpc-<subtarget>.cfg
|
||||||
**1u<x>_Undefines the symbol <x>
|
**1u<x>_Undefines the symbol <x>
|
||||||
**1U_Unit options:
|
**1U_Unit options:
|
||||||
**2Un_Do not check where the unit name matches the file name
|
**2Un_Do not check where the unit name matches the file name
|
||||||
@ -4416,6 +4426,7 @@ P*2WT_Specify MPW tool type application (Classic Mac OS)
|
|||||||
6*3WQqhdr_Set metadata to QDOS File Header style (default)
|
6*3WQqhdr_Set metadata to QDOS File Header style (default)
|
||||||
6*3WQxtcc_Set metadata to XTcc style
|
6*3WQxtcc_Set metadata to XTcc style
|
||||||
**2WX_Enable executable stack (Linux)
|
**2WX_Enable executable stack (Linux)
|
||||||
|
**1x<suff>_Set suffix for compiler executable (fpc command only).
|
||||||
**1X_Executable options:
|
**1X_Executable options:
|
||||||
**2X9_Generate linkerscript for GNU Binutils ld older than version 2.19.1 (Linux)
|
**2X9_Generate linkerscript for GNU Binutils ld older than version 2.19.1 (Linux)
|
||||||
**2Xa_Generate code which allows to use more than 2 GB static data on 64 bit targets (Linux)
|
**2Xa_Generate code which allows to use more than 2 GB static data on 64 bit targets (Linux)
|
||||||
|
@ -1104,6 +1104,9 @@ const
|
|||||||
option_valgrind_heaptrc_mismatch=11062;
|
option_valgrind_heaptrc_mismatch=11062;
|
||||||
option_unsupported_fpu=11063;
|
option_unsupported_fpu=11063;
|
||||||
option_too_many_exception_modes=11064;
|
option_too_many_exception_modes=11064;
|
||||||
|
option_subtarget_is_already_set=11065;
|
||||||
|
option_subtarget_config_not_found=11066;
|
||||||
|
option_x_ignored=11067;
|
||||||
wpo_cant_find_file=12000;
|
wpo_cant_find_file=12000;
|
||||||
wpo_begin_processing=12001;
|
wpo_begin_processing=12001;
|
||||||
wpo_end_processing=12002;
|
wpo_end_processing=12002;
|
||||||
@ -1157,9 +1160,9 @@ const
|
|||||||
option_info=11024;
|
option_info=11024;
|
||||||
option_help_pages=11025;
|
option_help_pages=11025;
|
||||||
|
|
||||||
MsgTxtSize = 90618;
|
MsgTxtSize = 91007;
|
||||||
|
|
||||||
MsgIdxMax : array[1..20] of longint=(
|
MsgIdxMax : array[1..20] of longint=(
|
||||||
28,109,366,132,100,63,148,38,223,71,
|
28,109,366,132,100,63,148,38,223,71,
|
||||||
65,20,30,1,1,1,1,1,1,1
|
68,20,30,1,1,1,1,1,1,1
|
||||||
);
|
);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -56,6 +56,7 @@ Type
|
|||||||
paratarget : tsystem;
|
paratarget : tsystem;
|
||||||
paratargetasm : tasm;
|
paratargetasm : tasm;
|
||||||
paratargetdbg : tdbg;
|
paratargetdbg : tdbg;
|
||||||
|
parasubtarget : string;
|
||||||
LinkTypeSetExplicitly : boolean;
|
LinkTypeSetExplicitly : boolean;
|
||||||
LinkerSetExplicitly : boolean;
|
LinkerSetExplicitly : boolean;
|
||||||
Constructor Create;
|
Constructor Create;
|
||||||
@ -123,8 +124,10 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
option : toption;
|
option : toption;
|
||||||
|
read_subfile, { read subtarget config file, set when a cfgfile is found }
|
||||||
read_configfile, { read config file, set when a cfgfile is found }
|
read_configfile, { read config file, set when a cfgfile is found }
|
||||||
disable_configfile : boolean;
|
disable_configfile : boolean;
|
||||||
|
subcfg,
|
||||||
fpcdir,
|
fpcdir,
|
||||||
ppccfg,
|
ppccfg,
|
||||||
param_file : string; { file to compile specified on the commandline }
|
param_file : string; { file to compile specified on the commandline }
|
||||||
@ -1507,7 +1510,7 @@ begin
|
|||||||
not(
|
not(
|
||||||
(opt[1]='-') and
|
(opt[1]='-') and
|
||||||
(
|
(
|
||||||
((length(opt)>1) and (opt[2] in ['i','d','v','T','u','n','X','l','U'])) or
|
((length(opt)>1) and (opt[2] in ['i','d','v','T','t','u','n','x','X','l','U'])) or
|
||||||
((length(opt)>3) and (opt[2]='F') and (opt[3]='e')) or
|
((length(opt)>3) and (opt[2]='F') and (opt[3]='e')) or
|
||||||
((length(opt)>2) and (opt[2]='C') and (opt[3] in ['a','b','f','p'])) or
|
((length(opt)>2) and (opt[2]='C') and (opt[3] in ['a','b','f','p'])) or
|
||||||
((length(opt)>3) and (opt[2]='W') and (opt[3] in ['m','p']))
|
((length(opt)>3) and (opt[2]='W') and (opt[3] in ['m','p']))
|
||||||
@ -2782,6 +2785,22 @@ begin
|
|||||||
if More<>upper(target_info.shortname) then
|
if More<>upper(target_info.shortname) then
|
||||||
Message1(option_target_is_already_set,target_info.shortname);
|
Message1(option_target_is_already_set,target_info.shortname);
|
||||||
end;
|
end;
|
||||||
|
't' :
|
||||||
|
begin
|
||||||
|
more:=Upper(More);
|
||||||
|
if (more='') then
|
||||||
|
Message1(option_missing_arg,'-t')
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (self.parasubtarget<>'') and (More<>upper(self.parasubtarget)) then
|
||||||
|
Message1(option_subtarget_is_already_set,self.parasubtarget)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
self.parasubtarget:=more;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
'u' :
|
'u' :
|
||||||
if is_identifier(more) then
|
if is_identifier(more) then
|
||||||
@ -3177,7 +3196,8 @@ begin
|
|||||||
inc(j);
|
inc(j);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
'x' :
|
||||||
|
message1(option_x_ignored,more);
|
||||||
'X' :
|
'X' :
|
||||||
begin
|
begin
|
||||||
j:=1;
|
j:=1;
|
||||||
@ -3768,6 +3788,7 @@ procedure toption.writequickinfo;
|
|||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
i : longint;
|
i : longint;
|
||||||
|
emptyOK : Boolean;
|
||||||
|
|
||||||
procedure addinfo(const hs:string);
|
procedure addinfo(const hs:string);
|
||||||
begin
|
begin
|
||||||
@ -3778,6 +3799,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
emptyOK:=False;
|
||||||
s:='';
|
s:='';
|
||||||
i:=0;
|
i:=0;
|
||||||
while (i<length(quickinfo)) do
|
while (i<length(quickinfo)) do
|
||||||
@ -3804,6 +3826,11 @@ begin
|
|||||||
addinfo(lower(target_info.shortname));
|
addinfo(lower(target_info.shortname));
|
||||||
'P' :
|
'P' :
|
||||||
AddInfo(target_cpu_string);
|
AddInfo(target_cpu_string);
|
||||||
|
'T' :
|
||||||
|
begin
|
||||||
|
addinfo(lower(self.parasubtarget));
|
||||||
|
emptyOK:=True;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
IllegalPara('-i'+QuickInfo);
|
IllegalPara('-i'+QuickInfo);
|
||||||
end;
|
end;
|
||||||
@ -3820,7 +3847,7 @@ begin
|
|||||||
IllegalPara('-i'+QuickInfo);
|
IllegalPara('-i'+QuickInfo);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if s<>'' then
|
if (s<>'') or EmptyOK then
|
||||||
begin
|
begin
|
||||||
writeln(s);
|
writeln(s);
|
||||||
stopoptions(0);
|
stopoptions(0);
|
||||||
@ -4155,6 +4182,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure read_arguments(cmd:TCmdStr);
|
procedure read_arguments(cmd:TCmdStr);
|
||||||
|
|
||||||
procedure def_cpu_macros;
|
procedure def_cpu_macros;
|
||||||
@ -4580,6 +4609,16 @@ begin
|
|||||||
|
|
||||||
{ don't remove this, it's also for fpdoc necessary (FK) }
|
{ don't remove this, it's also for fpdoc necessary (FK) }
|
||||||
def_system_macro('FPC_HAS_FEATURE_SUPPORT');
|
def_system_macro('FPC_HAS_FEATURE_SUPPORT');
|
||||||
|
if (Option.parasubtarget<>'') then
|
||||||
|
begin
|
||||||
|
def_system_macro('FPC_SUBTARGET_'+Option.parasubtarget);
|
||||||
|
if cs_support_macro in init_settings.moduleswitches then
|
||||||
|
set_system_macro('FPC_SUBTARGET',Option.parasubtarget)
|
||||||
|
else
|
||||||
|
set_system_compvar('FPC_SUBTARGET',Option.parasubtarget);
|
||||||
|
// So it can be used in macro substitution.
|
||||||
|
globals.subtarget:=Option.parasubtarget;
|
||||||
|
end;
|
||||||
|
|
||||||
{ make cpu makros available when reading the config files the second time }
|
{ make cpu makros available when reading the config files the second time }
|
||||||
def_cpu_macros;
|
def_cpu_macros;
|
||||||
@ -4649,6 +4688,14 @@ begin
|
|||||||
read_configfile:=check_configfile(ppccfg,ppccfg)
|
read_configfile:=check_configfile(ppccfg,ppccfg)
|
||||||
else
|
else
|
||||||
read_configfile := false;
|
read_configfile := false;
|
||||||
|
if (option.parasubtarget<>'') then
|
||||||
|
begin
|
||||||
|
subcfg:='fpc-'+lower(option.parasubtarget)+'.cfg';
|
||||||
|
read_subfile:=check_configfile(subcfg,subcfg);
|
||||||
|
// Warn if we didn't find an architecture-specific file
|
||||||
|
if not read_subfile then
|
||||||
|
message2(option_subtarget_config_not_found,option.parasubtarget,subcfg);
|
||||||
|
end;
|
||||||
|
|
||||||
{ Read commandline and configfile }
|
{ Read commandline and configfile }
|
||||||
param_file:='';
|
param_file:='';
|
||||||
@ -4656,6 +4703,8 @@ begin
|
|||||||
{ read configfile }
|
{ read configfile }
|
||||||
if read_configfile then
|
if read_configfile then
|
||||||
option.interpret_file(ppccfg);
|
option.interpret_file(ppccfg);
|
||||||
|
if read_subfile then
|
||||||
|
option.interpret_file(subcfg);
|
||||||
|
|
||||||
{ read parameters again to override config file }
|
{ read parameters again to override config file }
|
||||||
if cmd<>'' then
|
if cmd<>'' then
|
||||||
|
Loading…
Reference in New Issue
Block a user