Browse Source

* Set subtarget define as soon as -t option is parsed

Michaël Van Canneyt 1 year ago
parent
commit
f232009010
1 changed files with 5 additions and 2 deletions
  1. 5 2
      packages/pastojs/src/pas2jscompiler.pp

+ 5 - 2
packages/pastojs/src/pas2jscompiler.pp

@@ -4277,7 +4277,8 @@ procedure TPas2jsCompiler.SetSubTarget(AValue: String);
 begin
 begin
   if FSubTarget=AValue then Exit;
   if FSubTarget=AValue then Exit;
   FSubTarget:=AValue;
   FSubTarget:=AValue;
-  //
+  AddDefine('FPC_SUBTARGET',SubTarget);
+  AddDefine('FPC_SUBTARGET_'+Uppercase(SubTarget));
 end;
 end;
 
 
 function TPas2jsCompiler.CreateImportList: TJSSourceElements;
 function TPas2jsCompiler.CreateImportList: TJSSourceElements;
@@ -4611,8 +4612,10 @@ begin
   AddDefine('STR_CONCAT_PROCS');
   AddDefine('STR_CONCAT_PROCS');
   AddDefine('UNICODE');
   AddDefine('UNICODE');
   if SubTarget<>'' then
   if SubTarget<>'' then
+    begin
     AddDefine('FPC_SUBTARGET',SubTarget);
     AddDefine('FPC_SUBTARGET',SubTarget);
-
+    AddDefine('FPC_SUBTARGET_'+Uppercase(SubTarget));
+    end;
   FHasShownLogo:=false;
   FHasShownLogo:=false;
   FHasShownEncoding:=false;
   FHasShownEncoding:=false;
   FFS.Reset;
   FFS.Reset;