Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. (*
  2.     BSD 2-Clause License
  3.  
  4.     Copyright (c) 2019-2020, Anton Krotov
  5.     All rights reserved.
  6. *)
  7.  
  8. MODULE TARGETS;
  9.  
  10.  
  11. CONST
  12.  
  13.     MSP430*       =  0;
  14.     Win32C*       =  1;
  15.     Win32GUI*     =  2;
  16.     Win32DLL*     =  3;
  17.     KolibriOS*    =  4;
  18.     KolibriOSDLL* =  5;
  19.     Win64C*       =  6;
  20.     Win64GUI*     =  7;
  21.     Win64DLL*     =  8;
  22.     Linux32*      =  9;
  23.     Linux32SO*    = 10;
  24.     Linux64*      = 11;
  25.     Linux64SO*    = 12;
  26.     STM32CM3*     = 13;
  27.  
  28.     cpuX86* = 0; cpuAMD64* = 1; cpuMSP430* = 2; cpuTHUMB* = 3;
  29.  
  30.     osNONE*    = 0;  osWIN32*   = 1;  osWIN64* = 2;
  31.     osLINUX32* = 3;  osLINUX64* = 4;  osKOS*   = 5;
  32.  
  33.  
  34. TYPE
  35.  
  36.     STRING = ARRAY 32 OF CHAR;
  37.  
  38.     TARGET = RECORD
  39.  
  40.         target, CPU, BitDepth, OS, RealSize: INTEGER;
  41.         ComLinePar*, LibDir, FileExt: STRING
  42.  
  43.     END;
  44.  
  45.  
  46. VAR
  47.  
  48.     Targets*: ARRAY 14 OF TARGET;
  49.  
  50.     target*, CPU*, BitDepth*, OS*, RealSize*, WordSize*, AdrSize*: INTEGER;
  51.     ComLinePar*, LibDir*, FileExt*: STRING;
  52.     Import*, Dispose*, Dll*: BOOLEAN;
  53.  
  54.  
  55. PROCEDURE Enter (idx, CPU, BitDepth, RealSize, OS: INTEGER; ComLinePar, LibDir, FileExt: STRING);
  56. BEGIN
  57.     Targets[idx].target := idx;
  58.     Targets[idx].CPU := CPU;
  59.     Targets[idx].BitDepth := BitDepth;
  60.     Targets[idx].RealSize := RealSize;
  61.     Targets[idx].OS := OS;
  62.     Targets[idx].ComLinePar := ComLinePar;
  63.     Targets[idx].LibDir := LibDir;
  64.     Targets[idx].FileExt := FileExt;
  65. END Enter;
  66.  
  67.  
  68. PROCEDURE Select* (ComLineParam: ARRAY OF CHAR): BOOLEAN;
  69. VAR
  70.     i: INTEGER;
  71.     res: BOOLEAN;
  72.  
  73. BEGIN
  74.     i := 0;
  75.     WHILE (i < LEN(Targets)) & (Targets[i].ComLinePar # ComLineParam) DO
  76.         INC(i)
  77.     END;
  78.  
  79.     res := i < LEN(Targets);
  80.     IF res THEN
  81.         target := Targets[i].target;
  82.         CPU := Targets[i].CPU;
  83.         BitDepth := Targets[i].BitDepth;
  84.         RealSize := Targets[i].RealSize;
  85.         OS := Targets[i].OS;
  86.         ComLinePar := Targets[i].ComLinePar;
  87.         LibDir := Targets[i].LibDir;
  88.         FileExt := Targets[i].FileExt;
  89.  
  90.         Import := OS IN {osWIN32, osWIN64, osKOS};
  91.         Dispose := ~(target IN {MSP430, STM32CM3});
  92.         Dll := target IN {Linux32SO, Linux64SO, Win32DLL, Win64DLL, KolibriOSDLL};
  93.         WordSize := BitDepth DIV 8;
  94.         AdrSize  := WordSize
  95.     END
  96.  
  97.     RETURN res
  98. END Select;
  99.  
  100.  
  101. BEGIN
  102.     Enter( MSP430,        cpuMSP430,  16,  0,  osNONE,     "msp430",      "MSP430",     ".hex");
  103.     Enter( Win32C,        cpuX86,     32,  8,  osWIN32,    "win32con",    "Windows32",  ".exe");
  104.     Enter( Win32GUI,      cpuX86,     32,  8,  osWIN32,    "win32gui",    "Windows32",  ".exe");
  105.     Enter( Win32DLL,      cpuX86,     32,  8,  osWIN32,    "win32dll",    "Windows32",  ".dll");
  106.     Enter( KolibriOS,     cpuX86,     32,  8,  osKOS,      "kosexe",      "KolibriOS",  "");
  107.     Enter( KolibriOSDLL,  cpuX86,     32,  8,  osKOS,      "kosdll",      "KolibriOS",  ".obj");
  108.     Enter( Win64C,        cpuAMD64,   64,  8,  osWIN64,    "win64con",    "Windows64",  ".exe");
  109.     Enter( Win64GUI,      cpuAMD64,   64,  8,  osWIN64,    "win64gui",    "Windows64",  ".exe");
  110.     Enter( Win64DLL,      cpuAMD64,   64,  8,  osWIN64,    "win64dll",    "Windows64",  ".dll");
  111.     Enter( Linux32,       cpuX86,     32,  8,  osLINUX32,  "linux32exe",  "Linux32",    "");
  112.     Enter( Linux32SO,     cpuX86,     32,  8,  osLINUX32,  "linux32so",   "Linux32",    ".so");
  113.     Enter( Linux64,       cpuAMD64,   64,  8,  osLINUX64,  "linux64exe",  "Linux64",    "");
  114.     Enter( Linux64SO,     cpuAMD64,   64,  8,  osLINUX64,  "linux64so",   "Linux64",    ".so");
  115.     Enter( STM32CM3,      cpuTHUMB,   32,  4,  osNONE,     "stm32cm3",    "STM32CM3",   ".hex");
  116. END TARGETS.