systems.pas 34 KB

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