systems.pas 38 KB

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