浏览代码

* Globals needs subtarget for macro substitution

Michael VAN CANNEYT 2 年之前
父节点
当前提交
05a5107cda
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 5 0
      compiler/globals.pas
  2. 4 0
      compiler/options.pas

+ 5 - 0
compiler/globals.pas

@@ -256,6 +256,9 @@ interface
        outputfilename    : string;
        outputprefix      : pshortstring;
        outputsuffix      : pshortstring;
+       { selected subtarget }
+       subtarget         : string;
+
        { specified with -FE or -FU }
        outputexedir      : TPathStr;
        outputunitdir     : TPathStr;
@@ -996,6 +999,8 @@ implementation
          if (tf_use_8_3 in Source_Info.Flags) or
             (tf_use_8_3 in Target_Info.Flags) then
            Replace(s,'$FPCTARGET',target_os_string)
+         else if subtarget<>'' then
+           Replace(s,'$FPCTARGET',target_full_string+'-'+lower(subtarget))
          else
            Replace(s,'$FPCTARGET',target_full_string);
          Replace(s,'$FPCSUBARCH',lower(cputypestr[init_settings.cputype]));

+ 4 - 0
compiler/options.pas

@@ -2763,7 +2763,9 @@ 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;
@@ -4564,6 +4566,8 @@ begin
       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 }