systems.pas 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  1. {
  2. $Id$
  3. Copyright (C) 1995,97 by Florian Klaempfl
  4. This unit contains information about the target systems supported
  5. (these are not processor specific)
  6. This progsam is free software; you can redistribute it and/or modify
  7. iu under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge- MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit systems;
  20. interface
  21. type
  22. tendian = (endian_little,endian_big);
  23. ttargetcpu=(no_cpu
  24. ,i386,m68k,alpha
  25. );
  26. tprocessors = (no_processor
  27. ,Class386,ClassP5,ClassP6
  28. ,MC68000,MC68100,MC68020
  29. );
  30. type
  31. tasmmode= (asmmode_none
  32. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  33. ,asmmode_m68k_mot
  34. );
  35. const
  36. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  37. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  38. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+1;
  39. type
  40. ttarget = (target_none
  41. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  42. target_i386_OS2,target_i386_Win32
  43. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  44. target_m68k_linux,target_m68k_PalmOS
  45. );
  46. const
  47. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  48. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  49. targetcnt=i386targetcnt+m68ktargetcnt+1;
  50. type
  51. tasm = (as_none
  52. ,as_i386_o,as_i386_o_aout,as_i386_asw,
  53. as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
  54. as_i386_tasm,as_i386_masm
  55. ,as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
  56. );
  57. const
  58. {$ifdef i386} i386asmcnt=8; {$else} i386asmcnt=0; {$endif}
  59. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  60. asmcnt=i386asmcnt+m68kasmcnt+1;
  61. type
  62. tlink = (link_none
  63. ,link_i386_ld,link_i386_ldgo32v1,
  64. link_i386_ldgo32v2,link_i386_ldw,
  65. link_i386_ldos2
  66. ,link_m68k_ld
  67. );
  68. const
  69. {$ifdef i386} i386linkcnt=5; {$else} i386linkcnt=0; {$endif}
  70. {$ifdef m68k} m68klinkcnt=1; {$else} m68klinkcnt=0; {$endif}
  71. linkcnt=i386linkcnt+m68klinkcnt+1;
  72. type
  73. tar = (ar_none
  74. ,ar_i386_ar,ar_i386_arw
  75. ,ar_m68k_ar
  76. );
  77. const
  78. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  79. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  80. arcnt=i386arcnt+m68karcnt+1;
  81. type
  82. tos = ( os_none,
  83. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  84. os_i386_Win32,
  85. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  86. os_m68k_PalmOS
  87. );
  88. const
  89. i386oscnt=5;
  90. m68koscnt=5;
  91. oscnt=i386oscnt+m68koscnt+1;
  92. type
  93. tosinfo = packed record
  94. id : tos;
  95. name : string[30];
  96. sharedlibext,
  97. staticlibext,
  98. sourceext,
  99. pasext,
  100. exeext,
  101. scriptext : string[4];
  102. libprefix : string[3];
  103. Cprefix : string[2];
  104. newline : string[2];
  105. endian : tendian;
  106. use_function_relative_addresses : boolean;
  107. end;
  108. tasminfo = packed record
  109. id : tasm;
  110. idtxt : string[8];
  111. asmbin : string[8];
  112. asmcmd : string[50];
  113. externals : boolean;
  114. labelprefix : string[2];
  115. comment : string[2];
  116. end;
  117. tlinkinfo = packed record
  118. id : tlink;
  119. linkbin : string[8];
  120. linkcmd : string[50];
  121. bindbin : string[8];
  122. bindcmd : string[50];
  123. stripopt : string[2];
  124. libpathprefix : string[13];
  125. libpathsuffix : string[2];
  126. groupstart : string[8];
  127. groupend : string[2];
  128. inputstart : string[8];
  129. inputend : string[2];
  130. libprefix : string[2];
  131. end;
  132. tarinfo = packed record
  133. id : tar;
  134. arbin : string[8];
  135. arcmd : string[50];
  136. end;
  137. ttargetinfo = packed record
  138. target : ttarget;
  139. cpu : ttargetcpu;
  140. short_name : string[8];
  141. unit_env : string[12];
  142. system_unit : string[8];
  143. smartext,
  144. unitext,
  145. unitlibext,
  146. asmext,
  147. objext,
  148. exeext : string[4];
  149. os : tos;
  150. link : tlink;
  151. assem : tasm;
  152. ar : tar;
  153. heapsize,
  154. maxheapsize,
  155. stacksize : longint;
  156. end;
  157. tasmmodeinfo=packed record
  158. id : tasmmode;
  159. idtxt : string[8];
  160. end;
  161. var
  162. target_cpu : ttargetcpu;
  163. target_info : ttargetinfo;
  164. target_os : tosinfo;
  165. target_asm : tasminfo;
  166. target_link : tlinkinfo;
  167. target_ar : tarinfo;
  168. source_os : tosinfo;
  169. function set_string_target(s : string) : boolean;
  170. function set_string_asm(s : string) : boolean;
  171. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  172. implementation
  173. uses
  174. globals,verbose;
  175. const
  176. {****************************************************************************
  177. OS Info
  178. ****************************************************************************}
  179. os_infos : array[1..oscnt] of tosinfo = (
  180. (
  181. id : os_none;
  182. name : 'No operating system';
  183. ),
  184. (
  185. id : os_i386_go32v1;
  186. name : 'GO32 V1 DOS extender';
  187. sharedlibext : '.dll';
  188. staticlibext : '.a';
  189. sourceext : '.pp';
  190. pasext : '.pas';
  191. exeext : ''; { No .exe, the linker only output a.out ! }
  192. scriptext : '.bat';
  193. libprefix : '';
  194. Cprefix : '_';
  195. newline : #13#10;
  196. endian : endian_little;
  197. use_function_relative_addresses : true
  198. ),
  199. (
  200. id : os_i386_go32v2;
  201. name : 'GO32 V2 DOS extender';
  202. sharedlibext : '.dll';
  203. staticlibext : '.a';
  204. sourceext : '.pp';
  205. pasext : '.pas';
  206. exeext : '.exe';
  207. scriptext : '.bat';
  208. libprefix : '';
  209. Cprefix : '_';
  210. newline : #13#10;
  211. endian : endian_little;
  212. use_function_relative_addresses : true
  213. ),
  214. (
  215. id : os_i386_linux;
  216. name : 'Linux-i386';
  217. sharedlibext : '.so';
  218. staticlibext : '.a';
  219. sourceext : '.pp';
  220. pasext : '.pas';
  221. exeext : '';
  222. scriptext : '.sh';
  223. libprefix : 'lib';
  224. Cprefix : '';
  225. newline : #10;
  226. endian : endian_little;
  227. use_function_relative_addresses : true
  228. ),
  229. (
  230. id : os_i386_os2;
  231. name : 'OS/2 via EMX';
  232. sharedlibext : '.ao2';
  233. staticlibext : '.ao2';
  234. sourceext : '.pas';
  235. pasext : '.pp';
  236. exeext : '.exe';
  237. scriptext : '.cmd';
  238. libprefix : '';
  239. Cprefix : '_';
  240. newline : #13#10;
  241. endian : endian_little;
  242. use_function_relative_addresses : false
  243. ),
  244. (
  245. id : os_i386_win32;
  246. name : 'Win32';
  247. sharedlibext : '.dll';
  248. staticlibext : '.aw';
  249. sourceext : '.pp';
  250. pasext : '.pas';
  251. exeext : '.exe';
  252. scriptext : '.bat';
  253. libprefix : 'lib';
  254. Cprefix : '_';
  255. newline : #13#10;
  256. endian : endian_little;
  257. use_function_relative_addresses : true
  258. ),
  259. (
  260. id : os_m68k_amiga;
  261. name : 'Commodore Amiga';
  262. sharedlibext : '.library';
  263. staticlibext : '.a';
  264. sourceext : '.pp';
  265. pasext : '.pas';
  266. exeext : '';
  267. scriptext : '';
  268. libprefix : '';
  269. Cprefix : '_';
  270. newline : #10;
  271. endian : endian_big;
  272. use_function_relative_addresses : false
  273. ),
  274. (
  275. id : os_m68k_atari;
  276. name : 'Atari ST/STE';
  277. sharedlibext : '.dll';
  278. staticlibext : '.a';
  279. sourceext : '.pp';
  280. pasext : '.pas';
  281. exeext : '.tpp';
  282. scriptext : '';
  283. libprefix : '';
  284. Cprefix : '_';
  285. newline : #10;
  286. endian : endian_big;
  287. use_function_relative_addresses : false
  288. ),
  289. (
  290. id : os_m68k_mac;
  291. name : 'Macintosh m68k';
  292. sharedlibext : '.dll';
  293. staticlibext : '.a';
  294. sourceext : '.pp';
  295. pasext : '.pas';
  296. exeext : '.tpp';
  297. scriptext : '';
  298. libprefix : '';
  299. Cprefix : '_';
  300. newline : #13;
  301. endian : endian_big;
  302. use_function_relative_addresses : false
  303. ),
  304. (
  305. id : os_m68k_linux;
  306. name : 'Linux-m68k';
  307. sharedlibext : '.so';
  308. staticlibext : '.a';
  309. sourceext : '.pp';
  310. pasext : '.pas';
  311. exeext : '';
  312. scriptext : '.sh';
  313. libprefix : 'lib';
  314. Cprefix : '';
  315. newline : #10;
  316. endian : endian_big;
  317. use_function_relative_addresses : true
  318. ),
  319. (
  320. id : os_m68k_palmos;
  321. name : 'PalmOS';
  322. sharedlibext : '.so';
  323. staticlibext : '.a';
  324. sourceext : '.pp';
  325. pasext : '.pas';
  326. exeext : '';
  327. scriptext : '.sh';
  328. libprefix : 'lib';
  329. Cprefix : '_';
  330. newline : #10;
  331. endian : endian_big;
  332. use_function_relative_addresses : false
  333. )
  334. );
  335. {****************************************************************************
  336. Assembler Info
  337. ****************************************************************************}
  338. as_infos : array[1..asmcnt] of tasminfo = (
  339. (
  340. id : as_none;
  341. idtxt : 'no'
  342. )
  343. {$ifdef i386}
  344. ,(
  345. id : as_i386_o;
  346. idtxt : 'O';
  347. asmbin : 'as';
  348. asmcmd : '-o $OBJ $ASM';
  349. externals : false;
  350. labelprefix : '.L';
  351. comment : '# '
  352. )
  353. ,(
  354. id : as_i386_o_aout;
  355. idtxt : 'O_AOUT';
  356. asmbin : 'as';
  357. asmcmd : '-o $OBJ $ASM';
  358. externals : false;
  359. labelprefix : 'L';
  360. comment : '# '
  361. )
  362. ,(
  363. id : as_i386_asw;
  364. idtxt : 'ASW';
  365. asmbin : 'asw';
  366. asmcmd : '-o $OBJ $ASM';
  367. externals : false;
  368. labelprefix : '.L';
  369. comment : '# '
  370. )
  371. ,(
  372. id : as_i386_nasmcoff;
  373. idtxt : 'NASMCOFF';
  374. asmbin : 'nasm';
  375. asmcmd : '-f coff -o $OBJ $ASM';
  376. externals : true;
  377. labelprefix : 'L';
  378. comment : '; '
  379. )
  380. ,(
  381. id : as_i386_nasmelf;
  382. idtxt : 'NASMELF';
  383. asmbin : 'nasm';
  384. asmcmd : '-f elf -o $OBJ $ASM';
  385. externals : true;
  386. labelprefix : 'L';
  387. comment : '; '
  388. )
  389. ,(
  390. id : as_i386_nasmobj;
  391. idtxt : 'NASMOBJ';
  392. asmbin : 'nasm';
  393. asmcmd : '-f obj -o $OBJ $ASM';
  394. externals : true;
  395. labelprefix : 'L';
  396. comment : '; '
  397. )
  398. ,(
  399. id : as_i386_tasm;
  400. idtxt : 'TASM';
  401. asmbin : 'tasm';
  402. asmcmd : '/m2 $ASM $OBJ';
  403. externals : true;
  404. labelprefix : '.L';
  405. comment : '; '
  406. )
  407. ,(
  408. id : as_i386_masm;
  409. idtxt : 'MASM';
  410. asmbin : 'masm';
  411. asmcmd : '$ASM $OBJ';
  412. externals : true;
  413. labelprefix : '.L';
  414. comment : '; '
  415. )
  416. {$endif i386}
  417. {$ifdef m68k}
  418. ,(
  419. id : as_m68k_o;
  420. idtxt : 'O';
  421. asmbin : 'as';
  422. asmcmd : '-o $OBJ $ASM';
  423. externals : false;
  424. labelprefix : '.L';
  425. comment : '# '
  426. )
  427. ,(
  428. id : as_m68k_gas;
  429. idtxt : 'GAS';
  430. asmbin : 'as68k'; { Gas for the Amiga}
  431. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  432. externals : false;
  433. labelprefix : '.L';
  434. comment : '| '
  435. )
  436. ,(
  437. id : as_m68k_mit;
  438. idtxt : 'MIT';
  439. asmbin : '';
  440. asmcmd : '-o $OBJ $ASM';
  441. externals : false;
  442. labelprefix : '.L';
  443. comment : '| '
  444. )
  445. ,(
  446. id : as_m68k_mot;
  447. idtxt : 'MOT';
  448. asmbin : '';
  449. asmcmd : '-o $OBJ $ASM';
  450. externals : false;
  451. labelprefix : '__L';
  452. comment : '| '
  453. )
  454. ,(
  455. id : as_m68k_mpw;
  456. idtxt : 'MPW';
  457. asmbin : '';
  458. asmcmd : '-model far -o $OBJ $ASM';
  459. externals : false;
  460. labelprefix : '__L';
  461. comment : '| '
  462. )
  463. {$endif m68k}
  464. );
  465. {****************************************************************************
  466. Linker Info
  467. ****************************************************************************}
  468. link_infos : array[1..linkcnt] of tlinkinfo = (
  469. (
  470. id : link_none;
  471. )
  472. {$ifdef i386}
  473. ,(
  474. id : link_i386_ld;
  475. linkbin : 'ld';
  476. linkcmd : '$OPT -o $EXE $RES';
  477. bindbin : '';
  478. bindcmd : '';
  479. stripopt : '-s';
  480. libpathprefix : 'SEARCH_DIR(';
  481. libpathsuffix : ')';
  482. groupstart : 'GROUP(';
  483. groupend : ')';
  484. inputstart : 'INPUT(';
  485. inputend : ')';
  486. libprefix : '-l'
  487. )
  488. ,(
  489. id : link_i386_ldgo32v1;
  490. linkbin : 'ld';
  491. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  492. bindbin : 'aout2exe';
  493. bindcmd : '$EXE';
  494. stripopt : '-s';
  495. libpathprefix : '-L';
  496. libpathsuffix : '';
  497. groupstart : '-(';
  498. groupend : '-)';
  499. inputstart : '';
  500. inputend : '';
  501. libprefix : '-l'
  502. )
  503. ,(
  504. id : link_i386_ldgo32v2;
  505. linkbin : 'ld';
  506. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  507. bindbin : '';
  508. bindcmd : '';
  509. stripopt : '-s';
  510. libpathprefix : '-L';
  511. libpathsuffix : '';
  512. groupstart : '-(';
  513. groupend : '-)';
  514. inputstart : '';
  515. inputend : '';
  516. libprefix : '-l'
  517. )
  518. ,(
  519. id : link_i386_ldw;
  520. linkbin : 'ldw';
  521. linkcmd : '$OPT -o $EXE $RES';
  522. bindbin : '';
  523. bindcmd : '';
  524. stripopt : '-s';
  525. libpathprefix : 'SEARCH_DIR(';
  526. libpathsuffix : ')';
  527. groupstart : 'GROUP(';
  528. groupend : ')';
  529. inputstart : 'INPUT(';
  530. inputend : ')';
  531. libprefix : '-l'
  532. )
  533. ,(
  534. id : link_i386_ldos2;
  535. linkbin : 'ld'; { Os/2 }
  536. linkcmd : '-o $EXE @$RES';
  537. bindbin : 'emxbind';
  538. bindcmd : '-b -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB';
  539. stripopt : '-s';
  540. libpathprefix : '-L';
  541. libpathsuffix : '';
  542. groupstart : ''; {Linker is too primitive...}
  543. groupend : '';
  544. inputstart : '';
  545. inputend : '';
  546. libprefix : '-l'
  547. )
  548. {$endif i386}
  549. {$ifdef m68k}
  550. ,(
  551. id : link_m68k_ld;
  552. linkbin : 'ld';
  553. linkcmd : '$OPT -o $EXE $RES';
  554. bindbin : '';
  555. bindcmd : '';
  556. stripopt : '-s';
  557. libpathprefix : 'SEARCH_DIR(';
  558. libpathsuffix : ')';
  559. groupstart : 'GROUP(';
  560. groupend : ')';
  561. inputstart : 'INPUT(';
  562. inputend : ')';
  563. libprefix : '-l'
  564. )
  565. {$endif m68k}
  566. );
  567. {****************************************************************************
  568. Ar Info
  569. ****************************************************************************}
  570. ar_infos : array[1..arcnt] of tarinfo = (
  571. (
  572. id : ar_none;
  573. )
  574. {$ifdef i386}
  575. ,(
  576. id : ar_i386_ar;
  577. arbin : 'ar';
  578. arcmd : 'rs $LIB $FILES'
  579. ),
  580. (
  581. id : ar_i386_arw;
  582. arbin : 'arw';
  583. arcmd : 'rs $LIB $FILES'
  584. )
  585. {$endif i386}
  586. {$ifdef m68k}
  587. ,(
  588. id : ar_m68k_ar;
  589. arbin : 'ar';
  590. arcmd : 'rs $LIB $FILES'
  591. )
  592. {$endif m68k}
  593. );
  594. {****************************************************************************
  595. Targets Info
  596. ****************************************************************************}
  597. target_infos : array[1..targetcnt] of ttargetinfo = (
  598. (
  599. target : target_none;
  600. cpu : no_cpu;
  601. short_name : 'notarget'
  602. )
  603. {$ifdef i386}
  604. ,(
  605. target : target_i386_GO32V1;
  606. cpu : i386;
  607. short_name : 'GO32V1';
  608. unit_env : 'GO32V1UNITS';
  609. system_unit : 'SYSTEM';
  610. smartext : '.sl';
  611. unitext : '.pp1';
  612. unitlibext : '.ppl';
  613. asmext : '.s1';
  614. objext : '.o1';
  615. exeext : ''; { The linker produces a.out }
  616. os : os_i386_GO32V1;
  617. link : link_i386_ldgo32v1;
  618. assem : as_i386_o;
  619. ar : ar_i386_ar;
  620. heapsize : 2048*1024;
  621. maxheapsize : 32768*1024;
  622. stacksize : 16384
  623. ),
  624. (
  625. target : target_i386_GO32V2;
  626. cpu : i386;
  627. short_name : 'GO32V2';
  628. unit_env : 'GO32V2UNITS';
  629. system_unit : 'SYSTEM';
  630. smartext : '.sl';
  631. unitext : '.ppu';
  632. unitlibext : '.ppl';
  633. asmext : '.s';
  634. objext : '.o';
  635. exeext : '.exe';
  636. os : os_i386_GO32V2;
  637. link : link_i386_ldgo32v2;
  638. assem : as_i386_o;
  639. ar : ar_i386_ar;
  640. heapsize : 2048*1024;
  641. maxheapsize : 32768*1024;
  642. stacksize : 16384
  643. ),
  644. (
  645. target : target_i386_LINUX;
  646. cpu : i386;
  647. short_name : 'LINUX';
  648. unit_env : 'LINUXUNITS';
  649. system_unit : 'syslinux';
  650. smartext : '.sl';
  651. unitext : '.ppu';
  652. unitlibext : '.ppl';
  653. asmext : '.s';
  654. objext : '.o';
  655. exeext : '';
  656. os : os_i386_Linux;
  657. link : link_i386_ld;
  658. assem : as_i386_o;
  659. ar : ar_i386_ar;
  660. heapsize : 2048*1024;
  661. maxheapsize : 32768*1024;
  662. stacksize : 8192
  663. ),
  664. (
  665. target : target_i386_OS2;
  666. cpu : i386;
  667. short_name : 'OS2';
  668. unit_env : 'OS2UNITS';
  669. system_unit : 'SYSOS2';
  670. smartext : '.sl';
  671. unitext : '.ppo';
  672. unitlibext : '.ppl';
  673. asmext : '.so2';
  674. objext : '.oo2';
  675. exeext : ''; { The linker produces a.out }
  676. os : os_i386_OS2;
  677. link : link_i386_ldos2;
  678. assem : as_i386_o_aout;
  679. ar : ar_i386_ar;
  680. heapsize : 256*1024;
  681. maxheapsize : 32768*1024;
  682. stacksize : 32768
  683. ),
  684. (
  685. target : target_i386_WIN32;
  686. cpu : i386;
  687. short_name : 'WIN32';
  688. unit_env : 'WIN32UNITS';
  689. system_unit : 'SYSWIN32';
  690. smartext : '.slw';
  691. unitext : '.ppw';
  692. unitlibext : '.ppl';
  693. asmext : '.sw';
  694. objext : '.ow';
  695. exeext : '.exe';
  696. os : os_i386_Win32;
  697. link : link_i386_ldw;
  698. assem : as_i386_asw;
  699. ar : ar_i386_arw;
  700. heapsize : 2048*1024;
  701. maxheapsize : 32768*1024;
  702. stacksize : 32768
  703. )
  704. {$endif i386}
  705. {$ifdef m68k}
  706. ,(
  707. target : target_m68k_Amiga;
  708. cpu : m68k;
  709. short_name : 'AMIGA';
  710. unit_env : '';
  711. system_unit : 'sysamiga';
  712. smartext : '.sl';
  713. unitext : '.ppa';
  714. unitlibext : '.ppl';
  715. asmext : '.asm';
  716. objext : '.o';
  717. exeext : '';
  718. os : os_m68k_Amiga;
  719. link : link_m68k_ld;
  720. assem : as_m68k_o;
  721. ar : ar_m68k_ar;
  722. heapsize : 128*1024;
  723. maxheapsize : 32768*1024;
  724. stacksize : 8192
  725. ),
  726. (
  727. target : target_m68k_Atari;
  728. cpu : m68k;
  729. short_name : 'ATARI';
  730. unit_env : '';
  731. system_unit : 'SYSATARI';
  732. smartext : '.sl';
  733. unitext : '.ppt';
  734. unitlibext : '.ppl';
  735. asmext : '.s';
  736. objext : '.o';
  737. exeext : '.ttp';
  738. os : os_m68k_Atari;
  739. link : link_m68k_ld;
  740. assem : as_m68k_o;
  741. ar : ar_m68k_ar;
  742. heapsize : 16*1024;
  743. maxheapsize : 32768*1024;
  744. stacksize : 8192
  745. ),
  746. (
  747. target : target_m68k_Mac;
  748. cpu : m68k;
  749. short_name : 'MACOS';
  750. unit_env : '';
  751. system_unit : 'sysmac';
  752. smartext : '.sl';
  753. unitext : '.ppt';
  754. unitlibext : '.ppl';
  755. asmext : '.a';
  756. objext : '.o';
  757. exeext : '';
  758. os : os_m68k_Mac;
  759. link : link_m68k_ld;
  760. assem : as_m68k_mpw;
  761. ar : ar_m68k_ar;
  762. heapsize : 128*1024;
  763. maxheapsize : 32768*1024;
  764. stacksize : 8192
  765. ),
  766. (
  767. target : target_m68k_linux;
  768. cpu : m68k;
  769. short_name : 'LINUX';
  770. unit_env : 'LINUXUNITS';
  771. system_unit : 'syslinux';
  772. smartext : '.sl';
  773. unitext : '.ppu';
  774. unitlibext : '.ppl';
  775. asmext : '.s';
  776. objext : '.o';
  777. exeext : '';
  778. os : os_m68k_Linux;
  779. link : link_m68k_ld;
  780. assem : as_m68k_o;
  781. ar : ar_m68k_ar;
  782. heapsize : 128*1024;
  783. maxheapsize : 32768*1024;
  784. stacksize : 8192
  785. ),
  786. (
  787. target : target_m68k_PalmOS;
  788. cpu : m68k;
  789. short_name : 'PALMOS';
  790. unit_env : 'PALMUNITS';
  791. system_unit : 'syspalm';
  792. smartext : '.sl';
  793. unitext : '.ppu';
  794. unitlibext : '.ppl';
  795. asmext : '.s';
  796. objext : '.o';
  797. exeext : '';
  798. os : os_m68k_PalmOS;
  799. link : link_m68k_ld;
  800. assem : as_m68k_o;
  801. ar : ar_m68k_ar;
  802. heapsize : 128*1024;
  803. maxheapsize : 32768*1024;
  804. stacksize : 8192
  805. )
  806. {$endif m68k}
  807. );
  808. {****************************************************************************
  809. AsmModeInfo
  810. ****************************************************************************}
  811. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  812. (
  813. id : asmmode_none;
  814. idtxt : 'none'
  815. )
  816. {$ifdef i386}
  817. ,(
  818. id : asmmode_i386_direct;
  819. idtxt : 'DIRECT'
  820. ),
  821. (
  822. id : asmmode_i386_att;
  823. idtxt : 'ATT'
  824. ),
  825. (
  826. id : asmmode_i386_intel;
  827. idtxt : 'INTEL'
  828. )
  829. {$endif i386}
  830. {$ifdef m68k}
  831. ,(
  832. id : asmmode_m68k_mot;
  833. idtxt : 'MOT'
  834. )
  835. {$endif m68k}
  836. );
  837. {****************************************************************************
  838. Helpers
  839. ****************************************************************************}
  840. function set_target_os(t:tos):boolean;
  841. var
  842. i : longint;
  843. begin
  844. set_target_os:=false;
  845. { target 1 is none }
  846. for i:=2 to oscnt do
  847. if os_infos[i].id=t then
  848. begin
  849. target_os:=os_infos[i];
  850. set_target_os:=true;
  851. exit;
  852. end;
  853. end;
  854. function set_target_asm(t:tasm):boolean;
  855. var
  856. i : longint;
  857. begin
  858. set_target_asm:=false;
  859. for i:=1 to asmcnt do
  860. if as_infos[i].id=t then
  861. begin
  862. target_asm:=as_infos[i];
  863. set_target_asm:=true;
  864. exit;
  865. end;
  866. end;
  867. function set_target_link(t:tlink):boolean;
  868. var
  869. i : longint;
  870. begin
  871. set_target_link:=false;
  872. for i:=1 to linkcnt do
  873. if link_infos[i].id=t then
  874. begin
  875. target_link:=link_infos[i];
  876. set_target_link:=true;
  877. exit;
  878. end;
  879. end;
  880. function set_target_ar(t:tar):boolean;
  881. var
  882. i : longint;
  883. begin
  884. set_target_ar:=false;
  885. for i:=1 to arcnt do
  886. if ar_infos[i].id=t then
  887. begin
  888. target_ar:=ar_infos[i];
  889. set_target_ar:=true;
  890. exit;
  891. end;
  892. end;
  893. function set_target_info(t:ttarget):boolean;
  894. var
  895. i : longint;
  896. begin
  897. set_target_info:=false;
  898. for i:=1 to targetcnt do
  899. if target_infos[i].target=t then
  900. begin
  901. target_info:=target_infos[i];
  902. set_target_os(target_info.os);
  903. set_target_asm(target_info.assem);
  904. set_target_link(target_info.link);
  905. set_target_ar(target_info.ar);
  906. target_cpu:=target_info.cpu;
  907. set_target_info:=true;
  908. exit;
  909. end;
  910. end;
  911. {****************************************************************************
  912. Load from string
  913. ****************************************************************************}
  914. function set_string_target(s : string) : boolean;
  915. var
  916. i : longint;
  917. begin
  918. set_string_target:=false;
  919. { this should be case insensitive !! PM }
  920. s:=upper(s);
  921. for i:=1 to targetcnt do
  922. if target_infos[i].short_name=s then
  923. begin
  924. target_info:=target_infos[i];
  925. set_target_os(target_info.os);
  926. set_target_asm(target_info.assem);
  927. set_target_link(target_info.link);
  928. set_target_ar(target_info.ar);
  929. target_cpu:=target_info.cpu;
  930. set_string_target:=true;
  931. exit;
  932. end;
  933. end;
  934. function set_string_asm(s : string) : boolean;
  935. var
  936. i : longint;
  937. begin
  938. set_string_asm:=false;
  939. { this should be case insensitive !! PM }
  940. s:=upper(s);
  941. for i:=1 to asmcnt do
  942. if as_infos[i].idtxt=s then
  943. begin
  944. target_asm:=as_infos[i];
  945. set_string_asm:=true;
  946. end;
  947. end;
  948. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  949. var
  950. i : longint;
  951. begin
  952. set_string_asmmode:=false;
  953. { this should be case insensitive !! PM }
  954. s:=upper(s);
  955. for i:=1 to asmmodecnt do
  956. if asmmodeinfos[i].idtxt=s then
  957. begin
  958. t:=asmmodeinfos[i].id;
  959. set_string_asmmode:=true;
  960. end;
  961. end;
  962. {****************************************************************************
  963. Initialization of default target
  964. ****************************************************************************}
  965. procedure default_os(t:ttarget);
  966. begin
  967. set_target_info(t);
  968. if source_os.name='' then
  969. source_os:=target_os;
  970. end;
  971. procedure set_source_os(t:tos);
  972. var
  973. i : longint;
  974. begin
  975. if source_os.name<>'' then
  976. Message(exec_w_source_os_redefined);
  977. for i:=1 to oscnt do
  978. if os_infos[i].id=t then
  979. begin
  980. source_os:=os_infos[i];
  981. exit;
  982. end;
  983. end;
  984. begin
  985. { first get source OS }
  986. source_os.name:='';
  987. { please note then we use cpu86 and cpu68 here on purpose !! }
  988. {$ifdef cpu86}
  989. {$ifdef GO32V1}
  990. set_source_os(os_i386_GO32V1);
  991. {$else}
  992. {$ifdef GO32V2}
  993. set_source_os(os_i386_GO32V2);
  994. {$else}
  995. {$ifdef OS2}
  996. set_source_os(os_i386_OS2);
  997. {$else}
  998. {$ifdef LINUX}
  999. set_source_os(os_i386_LINUX);
  1000. {$else}
  1001. {$ifdef WIN32}
  1002. set_source_os(os_i386_WIN32);
  1003. {$endif win32}
  1004. {$endif linux}
  1005. {$endif os2}
  1006. {$endif go32v2}
  1007. {$endif go32v1}
  1008. {$endif cpu86}
  1009. {$ifdef cpu68}
  1010. {$ifdef AMIGA}
  1011. set_source_os(os_m68k_Amiga);
  1012. {$else}
  1013. {$ifdef ATARI}
  1014. set_source_os(os_m68k_Atari);
  1015. {$else}
  1016. {$ifdef MACOS}
  1017. set_source_os(os_m68k_MAC);
  1018. {$else}
  1019. {$ifdef LINUX}
  1020. set_source_os(os_m68k_linux);
  1021. {$endif linux}
  1022. {$endif macos}
  1023. {$endif atari}
  1024. {$endif amiga}
  1025. {$endif cpu68}
  1026. { Now default target !! }
  1027. {$ifdef i386}
  1028. {$ifdef GO32V1}
  1029. default_os(target_i386_GO32V1);
  1030. {$else}
  1031. {$ifdef GO32V2}
  1032. default_os(target_i386_GO32V2);
  1033. {$else}
  1034. {$ifdef OS2}
  1035. default_os(target_i386_OS2);
  1036. {$else}
  1037. {$ifdef LINUX}
  1038. default_os(target_i386_LINUX);
  1039. {$else}
  1040. {$ifdef WIN32}
  1041. default_os(target_i386_WIN32);
  1042. {$else}
  1043. default_os(target_i386_GO32V2);
  1044. {$endif win32}
  1045. {$endif linux}
  1046. {$endif os2}
  1047. {$endif go32v2}
  1048. {$endif go32v1}
  1049. {$endif i386}
  1050. {$ifdef m68k}
  1051. {$ifdef AMIGA}
  1052. default_os(target_m68k_Amiga);
  1053. {$else}
  1054. {$ifdef ATARI}
  1055. default_os(target_m68k_Atari);
  1056. {$else}
  1057. {$ifdef MACOS}
  1058. default_os(target_m68k_Mac);
  1059. {$else}
  1060. {$ifdef LINUX}
  1061. default_os(target_m68k_linux);
  1062. {$else}
  1063. default_os(target_m68k_Amiga);
  1064. {$endif linux}
  1065. {$endif macos}
  1066. {$endif atari}
  1067. {$endif amiga}
  1068. {$endif m68k}
  1069. end.
  1070. {
  1071. $Log$
  1072. Revision 1.43 1998-10-14 08:08:56 pierre
  1073. * following Peters remark, removed all ifdef in
  1074. the systems unit enums
  1075. * last bugs of cg68k removed for sysamiga
  1076. (sysamiga assembles with as68k !!)
  1077. Revision 1.42 1998/10/13 16:50:23 pierre
  1078. * undid some changes of Peter that made the compiler wrong
  1079. for m68k (I had to reinsert some ifdefs)
  1080. * removed several memory leaks under m68k
  1081. * removed the meory leaks for assembler readers
  1082. * cross compiling shoud work again better
  1083. ( crosscompiling sysamiga works
  1084. but as68k still complain about some code !)
  1085. Revision 1.41 1998/10/13 13:10:31 peter
  1086. * new style for m68k/i386 infos and enums
  1087. Revision 1.40 1998/10/13 09:13:09 pierre
  1088. * assembler type output command line was case sensitive
  1089. Revision 1.39 1998/10/13 08:19:42 pierre
  1090. + source_os is now set correctly for cross-processor compilers
  1091. (tos contains all target_infos and
  1092. we use CPU86 and CPU68 conditionnals to
  1093. get the source operating system
  1094. this only works if you do not undefine
  1095. the source target !!)
  1096. * several cg68k memory leaks fixed
  1097. + started to change the code so that it should be possible to have
  1098. a complete compiler (both for m68k and i386 !!)
  1099. Revision 1.38 1998/10/07 04:26:58 carl
  1100. * bugfixes
  1101. + added mpw support
  1102. Revision 1.37 1998/10/06 20:40:58 peter
  1103. * remove -D from assemblers
  1104. Revision 1.36 1998/09/16 16:41:50 peter
  1105. * merged fixes
  1106. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1107. * win32 .o -> .ow and .a -> .aw
  1108. Revision 1.35 1998/09/11 17:35:33 peter
  1109. * fixed tabs
  1110. Revision 1.34 1998/09/11 12:27:55 pierre
  1111. * restored m68k part
  1112. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1113. * fixed tabs
  1114. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1115. * m68k part restored
  1116. Revision 1.33 1998/09/10 15:25:39 daniel
  1117. + Added maxheapsize.
  1118. * Corrected semi-bug in calling the assembler and the linker
  1119. Revision 1.31 1998/09/01 09:07:13 peter
  1120. * m68k fixes, splitted cg68k like cgi386
  1121. Revision 1.30 1998/08/31 12:26:34 peter
  1122. * m68k and palmos updates from surebugfixes
  1123. Revision 1.29 1998/08/26 10:09:21 peter
  1124. * more lowercase extensions
  1125. Revision 1.28 1998/08/25 12:42:47 pierre
  1126. * CDECL changed to CVAR for variables
  1127. specifications are read in structures also
  1128. + started adding GPC compatibility mode ( option -Sp)
  1129. * names changed to lowercase
  1130. Revision 1.27 1998/08/21 15:16:57 peter
  1131. * win32 compiles a bit better, no growheap crash
  1132. Revision 1.26 1998/08/19 16:07:55 jonas
  1133. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1134. Revision 1.25 1998/08/18 09:24:45 pierre
  1135. * small warning position bug fixed
  1136. * support_mmx switches splitting was missing
  1137. * rhide error and warning output corrected
  1138. Revision 1.24 1998/08/17 09:17:54 peter
  1139. * static/shared linking updates
  1140. Revision 1.23 1998/06/25 08:48:20 florian
  1141. * first version of rtti support
  1142. Revision 1.22 1998/06/17 14:10:21 peter
  1143. * small os2 fixes
  1144. * fixed interdependent units with newppu (remake3 under linux works now)
  1145. Revision 1.20 1998/06/15 15:38:14 pierre
  1146. * small bug in systems.pas corrected
  1147. + operators in different units better hanlded
  1148. Revision 1.19 1998/06/15 13:34:24 daniel
  1149. * Fixed spelling mistakes in comments.
  1150. * Fixed some OS/2 parameters.
  1151. Revision 1.18 1998/06/08 22:59:54 peter
  1152. * smartlinking works for win32
  1153. * some defines to exclude some compiler parts
  1154. Revision 1.17 1998/06/04 23:52:04 peter
  1155. * m68k compiles
  1156. + .def file creation moved to gendef.pas so it could also be used
  1157. for win32
  1158. Revision 1.16 1998/06/01 16:50:22 peter
  1159. + boolean -> ord conversion
  1160. * fixed ord -> boolean conversion
  1161. Revision 1.15 1998/05/30 14:31:11 peter
  1162. + $ASMMODE
  1163. Revision 1.14 1998/05/29 13:24:45 peter
  1164. + asw assembler
  1165. Revision 1.13 1998/05/27 00:20:33 peter
  1166. * some scanner optimizes
  1167. * automaticly aout2exe for go32v1
  1168. * fixed dynamiclinker option which was added at the wrong place
  1169. Revision 1.12 1998/05/23 01:21:32 peter
  1170. + aktasmmode, aktoptprocessor, aktoutputformat
  1171. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1172. + $LIBNAME to set the library name where the unit will be put in
  1173. * splitted cgi386 a bit (codeseg to large for bp7)
  1174. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1175. Revision 1.11 1998/05/22 12:32:49 peter
  1176. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1177. Revision 1.10 1998/05/11 13:07:58 peter
  1178. + $ifdef NEWPPU for the new ppuformat
  1179. + $define GDB not longer required
  1180. * removed all warnings and stripped some log comments
  1181. * no findfirst/findnext anymore to remove smartlink *.o files
  1182. Revision 1.9 1998/05/06 08:38:49 pierre
  1183. * better position info with UseTokenInfo
  1184. UseTokenInfo greatly simplified
  1185. + added check for changed tree after first time firstpass
  1186. (if we could remove all the cases were it happen
  1187. we could skip all firstpass if firstpasscount > 1)
  1188. Only with ExtDebug
  1189. Revision 1.8 1998/05/04 20:19:54 peter
  1190. * small fix for go32v2
  1191. Revision 1.7 1998/05/04 17:54:29 peter
  1192. + smartlinking works (only case jumptable left todo)
  1193. * redesign of systems.pas to support assemblers and linkers
  1194. + Unitname is now also in the PPU-file, increased version to 14
  1195. Revision 1.6 1998/05/01 07:43:57 florian
  1196. + basics for rtti implemented
  1197. + switch $m (generate rtti for published sections)
  1198. Revision 1.5 1998/04/29 10:34:06 pierre
  1199. + added some code for ansistring (not complete nor working yet)
  1200. * corrected operator overloading
  1201. * corrected nasm output
  1202. + started inline procedures
  1203. + added starstarn : use ** for exponentiation (^ gave problems)
  1204. + started UseTokenInfo cond to get accurate positions
  1205. Revision 1.4 1998/04/27 15:45:20 peter
  1206. + -Xl for smartlink
  1207. + target_info.arext = .a
  1208. Revision 1.3 1998/04/16 10:50:45 daniel
  1209. * Fixed some things that were broken for OS/2.
  1210. }