systems.pas 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  1. {
  2. $Id$
  3. Copyright (C) 1995-98 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. tasmmode= (asmmode_none
  31. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  32. ,asmmode_m68k_mot
  33. );
  34. ttargetflags = (tf_needs_isconsole,tf_supports_stack_checking);
  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. shortname : string[8];
  97. sharedlibext,
  98. staticlibext,
  99. sourceext,
  100. pasext,
  101. exeext,
  102. scriptext : string[4];
  103. libprefix : string[3];
  104. Cprefix : string[2];
  105. newline : string[2];
  106. endian : tendian;
  107. stackalignment : {longint this is a little overkill no ?? }byte;
  108. size_of_pointer : byte;
  109. size_of_longint : byte;
  110. use_bound_instruction : boolean;
  111. use_function_relative_addresses : boolean;
  112. end;
  113. tasminfo = packed record
  114. id : tasm;
  115. idtxt : string[8];
  116. asmbin : string[8];
  117. asmcmd : string[50];
  118. externals : boolean;
  119. labelprefix : string[2];
  120. comment : string[2];
  121. end;
  122. tlinkinfo = packed record
  123. id : tlink;
  124. linkbin : string[8];
  125. linkcmd : string[127];
  126. binders : word;
  127. bindbin : array[1..2]of string[8];
  128. bindcmd : array[1..2]of string[127];
  129. stripopt : string[2];
  130. libpathprefix : string[13];
  131. libpathsuffix : string[2];
  132. groupstart : string[8];
  133. groupend : string[2];
  134. inputstart : string[8];
  135. inputend : string[2];
  136. libprefix : string[2];
  137. end;
  138. tarinfo = packed record
  139. id : tar;
  140. arbin : string[8];
  141. arcmd : string[50];
  142. end;
  143. ttargetinfo = packed record
  144. target : ttarget;
  145. cpu : ttargetcpu;
  146. short_name : string[8];
  147. unit_env : string[12];
  148. system_unit : string[8];
  149. smartext,
  150. unitext,
  151. unitlibext,
  152. asmext,
  153. objext,
  154. exeext : string[4];
  155. os : tos;
  156. link : tlink;
  157. assem : tasm;
  158. ar : tar;
  159. heapsize,
  160. maxheapsize,
  161. stacksize : longint;
  162. flags : set of ttargetflags;
  163. end;
  164. tasmmodeinfo=packed record
  165. id : tasmmode;
  166. idtxt : string[8];
  167. end;
  168. var
  169. target_cpu : ttargetcpu;
  170. target_info : ttargetinfo;
  171. target_os : tosinfo;
  172. target_asm : tasminfo;
  173. target_link : tlinkinfo;
  174. target_ar : tarinfo;
  175. source_os : tosinfo;
  176. function set_string_target(s : string) : boolean;
  177. function set_string_asm(s : string) : boolean;
  178. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  179. implementation
  180. const
  181. {****************************************************************************
  182. OS Info
  183. ****************************************************************************}
  184. os_infos : array[1..oscnt] of tosinfo = (
  185. (
  186. id : os_none;
  187. name : 'No operating system';
  188. shortname : 'none'
  189. ),
  190. (
  191. id : os_i386_go32v1;
  192. name : 'GO32 V1 DOS extender';
  193. shortname : 'go32v1';
  194. sharedlibext : '.dll';
  195. staticlibext : '.a';
  196. sourceext : '.pp';
  197. pasext : '.pas';
  198. exeext : ''; { No .exe, the linker only output a.out ! }
  199. scriptext : '.bat';
  200. libprefix : '';
  201. Cprefix : '_';
  202. newline : #13#10;
  203. endian : endian_little;
  204. stackalignment : 2;
  205. size_of_pointer : 4;
  206. size_of_longint : 4;
  207. use_bound_instruction : false;
  208. use_function_relative_addresses : true
  209. ),
  210. (
  211. id : os_i386_go32v2;
  212. name : 'GO32 V2 DOS extender';
  213. shortname : 'go32v2';
  214. sharedlibext : '.dll';
  215. staticlibext : '.a';
  216. sourceext : '.pp';
  217. pasext : '.pas';
  218. exeext : '.exe';
  219. scriptext : '.bat';
  220. libprefix : '';
  221. Cprefix : '_';
  222. newline : #13#10;
  223. endian : endian_little;
  224. stackalignment : 2;
  225. size_of_pointer : 4;
  226. size_of_longint : 4;
  227. use_bound_instruction : true;
  228. use_function_relative_addresses : true
  229. ),
  230. (
  231. id : os_i386_linux;
  232. name : 'Linux for i386';
  233. shortname : 'linux';
  234. sharedlibext : '.so';
  235. staticlibext : '.a';
  236. sourceext : '.pp';
  237. pasext : '.pas';
  238. exeext : '';
  239. scriptext : '.sh';
  240. libprefix : 'lib';
  241. Cprefix : '';
  242. newline : #10;
  243. endian : endian_little;
  244. stackalignment : 4;
  245. size_of_pointer : 4;
  246. size_of_longint : 4;
  247. use_bound_instruction : false;
  248. use_function_relative_addresses : true
  249. ),
  250. (
  251. id : os_i386_os2;
  252. name : 'OS/2 via EMX';
  253. shortname : 'os2';
  254. sharedlibext : '.ao2';
  255. staticlibext : '.ao2';
  256. sourceext : '.pas';
  257. pasext : '.pp';
  258. exeext : '.exe';
  259. scriptext : '.cmd';
  260. libprefix : '';
  261. Cprefix : '_';
  262. newline : #13#10;
  263. endian : endian_little;
  264. stackalignment : 2;
  265. size_of_pointer : 4;
  266. size_of_longint : 4;
  267. use_bound_instruction : false;
  268. use_function_relative_addresses : false
  269. ),
  270. (
  271. id : os_i386_win32;
  272. name : 'Win32 for i386';
  273. shortname : 'win32';
  274. sharedlibext : '.dll';
  275. staticlibext : '.aw';
  276. sourceext : '.pp';
  277. pasext : '.pas';
  278. exeext : '.exe';
  279. scriptext : '.bat';
  280. libprefix : 'lib';
  281. Cprefix : '_';
  282. newline : #13#10;
  283. endian : endian_little;
  284. stackalignment : 4;
  285. size_of_pointer : 4;
  286. size_of_longint : 4;
  287. use_bound_instruction : true;
  288. use_function_relative_addresses : true
  289. ),
  290. (
  291. id : os_m68k_amiga;
  292. name : 'Commodore Amiga';
  293. shortname : 'amiga';
  294. sharedlibext : '.library';
  295. staticlibext : '.a';
  296. sourceext : '.pp';
  297. pasext : '.pas';
  298. exeext : '';
  299. scriptext : '';
  300. libprefix : '';
  301. Cprefix : '_';
  302. newline : #10;
  303. endian : endian_big;
  304. stackalignment : 2;
  305. size_of_pointer : 4;
  306. size_of_longint : 4;
  307. use_bound_instruction : false;
  308. use_function_relative_addresses : false
  309. ),
  310. (
  311. id : os_m68k_atari;
  312. name : 'Atari ST/STE';
  313. shortname : 'atari';
  314. sharedlibext : '.dll';
  315. staticlibext : '.a';
  316. sourceext : '.pp';
  317. pasext : '.pas';
  318. exeext : '.tpp';
  319. scriptext : '';
  320. libprefix : '';
  321. Cprefix : '_';
  322. newline : #10;
  323. endian : endian_big;
  324. stackalignment : 2;
  325. size_of_pointer : 4;
  326. size_of_longint : 4;
  327. use_bound_instruction : false;
  328. use_function_relative_addresses : false
  329. ),
  330. (
  331. id : os_m68k_mac;
  332. name : 'Macintosh m68k';
  333. shortname : 'mac';
  334. sharedlibext : '.dll';
  335. staticlibext : '.a';
  336. sourceext : '.pp';
  337. pasext : '.pas';
  338. exeext : '.tpp';
  339. scriptext : '';
  340. libprefix : '';
  341. Cprefix : '_';
  342. newline : #13;
  343. endian : endian_big;
  344. stackalignment : 2;
  345. size_of_pointer : 4;
  346. size_of_longint : 4;
  347. use_bound_instruction : false;
  348. use_function_relative_addresses : false
  349. ),
  350. (
  351. id : os_m68k_linux;
  352. name : 'Linux for m68k';
  353. shortname : 'linux';
  354. sharedlibext : '.so';
  355. staticlibext : '.a';
  356. sourceext : '.pp';
  357. pasext : '.pas';
  358. exeext : '';
  359. scriptext : '.sh';
  360. libprefix : 'lib';
  361. Cprefix : '';
  362. newline : #10;
  363. endian : endian_big;
  364. stackalignment : 2;
  365. size_of_pointer : 4;
  366. size_of_longint : 4;
  367. use_bound_instruction : false;
  368. use_function_relative_addresses : true
  369. ),
  370. (
  371. id : os_m68k_palmos;
  372. name : 'PalmOS';
  373. shortname : 'palmos';
  374. sharedlibext : '.so';
  375. staticlibext : '.a';
  376. sourceext : '.pp';
  377. pasext : '.pas';
  378. exeext : '';
  379. scriptext : '.sh';
  380. libprefix : 'lib';
  381. Cprefix : '_';
  382. newline : #10;
  383. endian : endian_big;
  384. stackalignment : 2;
  385. size_of_pointer : 4;
  386. size_of_longint : 4;
  387. use_bound_instruction : false;
  388. use_function_relative_addresses : false
  389. )
  390. );
  391. {****************************************************************************
  392. Assembler Info
  393. ****************************************************************************}
  394. as_infos : array[1..asmcnt] of tasminfo = (
  395. (
  396. id : as_none;
  397. idtxt : 'no'
  398. )
  399. {$ifdef i386}
  400. ,(
  401. id : as_i386_o;
  402. idtxt : 'O';
  403. asmbin : 'as';
  404. asmcmd : '-o $OBJ $ASM';
  405. externals : false;
  406. labelprefix : '.L';
  407. comment : '# '
  408. )
  409. ,(
  410. id : as_i386_o_aout;
  411. idtxt : 'O_AOUT';
  412. asmbin : 'as';
  413. asmcmd : '-o $OBJ $ASM';
  414. externals : false;
  415. labelprefix : 'L';
  416. comment : '# '
  417. )
  418. ,(
  419. id : as_i386_asw;
  420. idtxt : 'ASW';
  421. asmbin : 'asw';
  422. asmcmd : '-o $OBJ $ASM';
  423. externals : false;
  424. labelprefix : '.L';
  425. comment : '# '
  426. )
  427. ,(
  428. id : as_i386_nasmcoff;
  429. idtxt : 'NASMCOFF';
  430. asmbin : 'nasm';
  431. asmcmd : '-f coff -o $OBJ $ASM';
  432. externals : true;
  433. labelprefix : 'L';
  434. comment : '; '
  435. )
  436. ,(
  437. id : as_i386_nasmelf;
  438. idtxt : 'NASMELF';
  439. asmbin : 'nasm';
  440. asmcmd : '-f elf -o $OBJ $ASM';
  441. externals : true;
  442. labelprefix : 'L';
  443. comment : '; '
  444. )
  445. ,(
  446. id : as_i386_nasmobj;
  447. idtxt : 'NASMOBJ';
  448. asmbin : 'nasm';
  449. asmcmd : '-f obj -o $OBJ $ASM';
  450. externals : true;
  451. labelprefix : 'L';
  452. comment : '; '
  453. )
  454. ,(
  455. id : as_i386_tasm;
  456. idtxt : 'TASM';
  457. asmbin : 'tasm';
  458. asmcmd : '/m2 $ASM $OBJ';
  459. externals : true;
  460. labelprefix : '.L';
  461. comment : '; '
  462. )
  463. ,(
  464. id : as_i386_masm;
  465. idtxt : 'MASM';
  466. asmbin : 'masm';
  467. asmcmd : '$ASM $OBJ';
  468. externals : true;
  469. labelprefix : '.L';
  470. comment : '; '
  471. )
  472. {$endif i386}
  473. {$ifdef m68k}
  474. ,(
  475. id : as_m68k_o;
  476. idtxt : 'O';
  477. asmbin : 'as';
  478. asmcmd : '-o $OBJ $ASM';
  479. externals : false;
  480. labelprefix : '.L';
  481. comment : '# '
  482. )
  483. ,(
  484. id : as_m68k_gas;
  485. idtxt : 'GAS';
  486. asmbin : 'as68k'; { Gas for the Amiga}
  487. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  488. externals : false;
  489. labelprefix : '.L';
  490. comment : '| '
  491. )
  492. ,(
  493. id : as_m68k_mit;
  494. idtxt : 'MIT';
  495. asmbin : '';
  496. asmcmd : '-o $OBJ $ASM';
  497. externals : false;
  498. labelprefix : '.L';
  499. comment : '| '
  500. )
  501. ,(
  502. id : as_m68k_mot;
  503. idtxt : 'MOT';
  504. asmbin : '';
  505. asmcmd : '-o $OBJ $ASM';
  506. externals : false;
  507. labelprefix : '__L';
  508. comment : '| '
  509. )
  510. ,(
  511. id : as_m68k_mpw;
  512. idtxt : 'MPW';
  513. asmbin : '';
  514. asmcmd : '-model far -o $OBJ $ASM';
  515. externals : false;
  516. labelprefix : '__L';
  517. comment : '| '
  518. )
  519. {$endif m68k}
  520. );
  521. {****************************************************************************
  522. Linker Info
  523. ****************************************************************************}
  524. link_infos : array[1..linkcnt] of tlinkinfo = (
  525. (
  526. id : link_none
  527. )
  528. {$ifdef i386}
  529. ,(
  530. id : link_i386_ld;
  531. linkbin : 'ld';
  532. linkcmd : '$OPT -o $EXE $RES';
  533. {* Changes made by Ozerski 23.10.1998}
  534. binders:0;
  535. bindbin : ('','');
  536. bindcmd : ('','');
  537. {* End changes}
  538. stripopt : '-s';
  539. libpathprefix : 'SEARCH_DIR(';
  540. libpathsuffix : ')';
  541. groupstart : 'GROUP(';
  542. groupend : ')';
  543. inputstart : 'INPUT(';
  544. inputend : ')';
  545. libprefix : '-l'
  546. )
  547. ,(
  548. id : link_i386_ldgo32v1;
  549. linkbin : 'ld';
  550. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  551. {* Changes made by Ozerski 23.10.1998}
  552. binders:1;
  553. bindbin : ('aout2exe','');
  554. bindcmd : ('$EXE','');
  555. {* End changes}
  556. stripopt : '-s';
  557. libpathprefix : '-L';
  558. libpathsuffix : '';
  559. groupstart : '-(';
  560. groupend : '-)';
  561. inputstart : '';
  562. inputend : '';
  563. libprefix : '-l'
  564. )
  565. ,(
  566. id : link_i386_ldgo32v2;
  567. linkbin : 'ld';
  568. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  569. {* Changes made by Ozerski 23.10.1998}
  570. binders:0;
  571. bindbin : ('','');
  572. bindcmd : ('','');
  573. {* End changes}
  574. stripopt : '-s';
  575. libpathprefix : '-L';
  576. libpathsuffix : '';
  577. groupstart : '-(';
  578. groupend : '-)';
  579. inputstart : '';
  580. inputend : '';
  581. libprefix : '-l'
  582. )
  583. ,(
  584. id : link_i386_ldw;
  585. linkbin : 'ldw';
  586. linkcmd : '$OPT -o $EXE $RES';
  587. {* Changes made by Ozerski 23.10.1998}
  588. binders:0;
  589. bindbin : ('dlltool','ldw');
  590. bindcmd : ('--as asw.exe --dllname $EXE --output-exp exp.$$$',
  591. '-s $OPT -o $EXE $RES exp.$$$');
  592. {* End changes}
  593. stripopt : '-s';
  594. libpathprefix : 'SEARCH_DIR(';
  595. libpathsuffix : ')';
  596. groupstart : 'GROUP(';
  597. groupend : ')';
  598. inputstart : 'INPUT(';
  599. inputend : ')';
  600. libprefix : '-l'
  601. )
  602. ,(
  603. id : link_i386_ldos2;
  604. linkbin : 'ld'; { Os/2 }
  605. linkcmd : '-o $EXE @$RES';
  606. {* Changes made by Ozerski 23.10.1998}
  607. binders:1;
  608. bindbin : ('emxbind','');
  609. bindcmd : ('-b -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB','');
  610. {* End changes}
  611. stripopt : '-s';
  612. libpathprefix : '-L';
  613. libpathsuffix : '';
  614. groupstart : ''; {Linker is too primitive...}
  615. groupend : '';
  616. inputstart : '';
  617. inputend : '';
  618. libprefix : '-l'
  619. )
  620. {$endif i386}
  621. {$ifdef m68k}
  622. ,(
  623. id : link_m68k_ld;
  624. linkbin : 'ld';
  625. linkcmd : '$OPT -o $EXE $RES';
  626. {* Changes made by Ozerski 23.10.1998}
  627. binders:0;
  628. bindbin : ('','');
  629. bindcmd : ('','');
  630. {* End changes}
  631. stripopt : '-s';
  632. libpathprefix : 'SEARCH_DIR(';
  633. libpathsuffix : ')';
  634. groupstart : 'GROUP(';
  635. groupend : ')';
  636. inputstart : 'INPUT(';
  637. inputend : ')';
  638. libprefix : '-l'
  639. )
  640. {$endif m68k}
  641. );
  642. {****************************************************************************
  643. Ar Info
  644. ****************************************************************************}
  645. ar_infos : array[1..arcnt] of tarinfo = (
  646. (
  647. id : ar_none
  648. )
  649. {$ifdef i386}
  650. ,(
  651. id : ar_i386_ar;
  652. arbin : 'ar';
  653. arcmd : 'rs $LIB $FILES'
  654. ),
  655. (
  656. id : ar_i386_arw;
  657. arbin : 'arw';
  658. arcmd : 'rs $LIB $FILES'
  659. )
  660. {$endif i386}
  661. {$ifdef m68k}
  662. ,(
  663. id : ar_m68k_ar;
  664. arbin : 'ar';
  665. arcmd : 'rs $LIB $FILES'
  666. )
  667. {$endif m68k}
  668. );
  669. {****************************************************************************
  670. Targets Info
  671. ****************************************************************************}
  672. target_infos : array[1..targetcnt] of ttargetinfo = (
  673. (
  674. target : target_none;
  675. cpu : no_cpu;
  676. short_name : 'notarget'
  677. )
  678. {$ifdef i386}
  679. ,(
  680. target : target_i386_GO32V1;
  681. cpu : i386;
  682. short_name : 'GO32V1';
  683. unit_env : 'GO32V1UNITS';
  684. system_unit : 'SYSTEM';
  685. smartext : '.sl';
  686. unitext : '.pp1';
  687. unitlibext : '.ppl';
  688. asmext : '.s1';
  689. objext : '.o1';
  690. exeext : ''; { The linker produces a.out }
  691. os : os_i386_GO32V1;
  692. link : link_i386_ldgo32v1;
  693. assem : as_i386_o;
  694. ar : ar_i386_ar;
  695. heapsize : 2048*1024;
  696. maxheapsize : 32768*1024;
  697. stacksize : 16384
  698. ),
  699. (
  700. target : target_i386_GO32V2;
  701. cpu : i386;
  702. short_name : 'GO32V2';
  703. unit_env : 'GO32V2UNITS';
  704. system_unit : 'SYSTEM';
  705. smartext : '.sl';
  706. unitext : '.ppu';
  707. unitlibext : '.ppl';
  708. asmext : '.s';
  709. objext : '.o';
  710. exeext : '.exe';
  711. os : os_i386_GO32V2;
  712. link : link_i386_ldgo32v2;
  713. assem : as_i386_o;
  714. ar : ar_i386_ar;
  715. heapsize : 2048*1024;
  716. maxheapsize : 32768*1024;
  717. stacksize : 16384
  718. ),
  719. (
  720. target : target_i386_LINUX;
  721. cpu : i386;
  722. short_name : 'LINUX';
  723. unit_env : 'LINUXUNITS';
  724. system_unit : 'syslinux';
  725. smartext : '.sl';
  726. unitext : '.ppu';
  727. unitlibext : '.ppl';
  728. asmext : '.s';
  729. objext : '.o';
  730. exeext : '';
  731. os : os_i386_Linux;
  732. link : link_i386_ld;
  733. assem : as_i386_o;
  734. ar : ar_i386_ar;
  735. heapsize : 2048*1024;
  736. maxheapsize : 32768*1024;
  737. stacksize : 8192
  738. ),
  739. (
  740. target : target_i386_OS2;
  741. cpu : i386;
  742. short_name : 'OS2';
  743. unit_env : 'OS2UNITS';
  744. system_unit : 'SYSOS2';
  745. smartext : '.sl';
  746. unitext : '.ppo';
  747. unitlibext : '.ppl';
  748. asmext : '.so2';
  749. objext : '.oo2';
  750. exeext : ''; { The linker produces a.out }
  751. os : os_i386_OS2;
  752. link : link_i386_ldos2;
  753. assem : as_i386_o_aout;
  754. ar : ar_i386_ar;
  755. heapsize : 256*1024;
  756. maxheapsize : 32768*1024;
  757. stacksize : 32768
  758. ),
  759. (
  760. target : target_i386_WIN32;
  761. cpu : i386;
  762. short_name : 'WIN32';
  763. unit_env : 'WIN32UNITS';
  764. system_unit : 'SYSWIN32';
  765. smartext : '.slw';
  766. unitext : '.ppw';
  767. unitlibext : '.ppl';
  768. asmext : '.sw';
  769. objext : '.ow';
  770. exeext : '.exe';
  771. os : os_i386_Win32;
  772. link : link_i386_ldw;
  773. assem : as_i386_asw;
  774. ar : ar_i386_arw;
  775. heapsize : 2048*1024;
  776. maxheapsize : 32768*1024;
  777. stacksize : 32768
  778. )
  779. {$endif i386}
  780. {$ifdef m68k}
  781. ,(
  782. target : target_m68k_Amiga;
  783. cpu : m68k;
  784. short_name : 'AMIGA';
  785. unit_env : '';
  786. system_unit : 'sysamiga';
  787. smartext : '.sl';
  788. unitext : '.ppa';
  789. unitlibext : '.ppl';
  790. asmext : '.asm';
  791. objext : '.o';
  792. exeext : '';
  793. os : os_m68k_Amiga;
  794. link : link_m68k_ld;
  795. assem : as_m68k_o;
  796. ar : ar_m68k_ar;
  797. heapsize : 128*1024;
  798. maxheapsize : 32768*1024;
  799. stacksize : 8192
  800. ),
  801. (
  802. target : target_m68k_Atari;
  803. cpu : m68k;
  804. short_name : 'ATARI';
  805. unit_env : '';
  806. system_unit : 'SYSATARI';
  807. smartext : '.sl';
  808. unitext : '.ppt';
  809. unitlibext : '.ppl';
  810. asmext : '.s';
  811. objext : '.o';
  812. exeext : '.ttp';
  813. os : os_m68k_Atari;
  814. link : link_m68k_ld;
  815. assem : as_m68k_o;
  816. ar : ar_m68k_ar;
  817. heapsize : 16*1024;
  818. maxheapsize : 32768*1024;
  819. stacksize : 8192
  820. ),
  821. (
  822. target : target_m68k_Mac;
  823. cpu : m68k;
  824. short_name : 'MACOS';
  825. unit_env : '';
  826. system_unit : 'sysmac';
  827. smartext : '.sl';
  828. unitext : '.ppt';
  829. unitlibext : '.ppl';
  830. asmext : '.a';
  831. objext : '.o';
  832. exeext : '';
  833. os : os_m68k_Mac;
  834. link : link_m68k_ld;
  835. assem : as_m68k_mpw;
  836. ar : ar_m68k_ar;
  837. heapsize : 128*1024;
  838. maxheapsize : 32768*1024;
  839. stacksize : 8192
  840. ),
  841. (
  842. target : target_m68k_linux;
  843. cpu : m68k;
  844. short_name : 'LINUX';
  845. unit_env : 'LINUXUNITS';
  846. system_unit : 'syslinux';
  847. smartext : '.sl';
  848. unitext : '.ppu';
  849. unitlibext : '.ppl';
  850. asmext : '.s';
  851. objext : '.o';
  852. exeext : '';
  853. os : os_m68k_Linux;
  854. link : link_m68k_ld;
  855. assem : as_m68k_o;
  856. ar : ar_m68k_ar;
  857. heapsize : 128*1024;
  858. maxheapsize : 32768*1024;
  859. stacksize : 8192
  860. ),
  861. (
  862. target : target_m68k_PalmOS;
  863. cpu : m68k;
  864. short_name : 'PALMOS';
  865. unit_env : 'PALMUNITS';
  866. system_unit : 'syspalm';
  867. smartext : '.sl';
  868. unitext : '.ppu';
  869. unitlibext : '.ppl';
  870. asmext : '.s';
  871. objext : '.o';
  872. exeext : '';
  873. os : os_m68k_PalmOS;
  874. link : link_m68k_ld;
  875. assem : as_m68k_o;
  876. ar : ar_m68k_ar;
  877. heapsize : 128*1024;
  878. maxheapsize : 32768*1024;
  879. stacksize : 8192
  880. )
  881. {$endif m68k}
  882. );
  883. {****************************************************************************
  884. AsmModeInfo
  885. ****************************************************************************}
  886. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  887. (
  888. id : asmmode_none;
  889. idtxt : 'none'
  890. )
  891. {$ifdef i386}
  892. ,(
  893. id : asmmode_i386_direct;
  894. idtxt : 'DIRECT'
  895. ),
  896. (
  897. id : asmmode_i386_att;
  898. idtxt : 'ATT'
  899. ),
  900. (
  901. id : asmmode_i386_intel;
  902. idtxt : 'INTEL'
  903. )
  904. {$endif i386}
  905. {$ifdef m68k}
  906. ,(
  907. id : asmmode_m68k_mot;
  908. idtxt : 'MOT'
  909. )
  910. {$endif m68k}
  911. );
  912. {****************************************************************************
  913. Helpers
  914. ****************************************************************************}
  915. function upper(const s : string) : string;
  916. var
  917. i : longint;
  918. begin
  919. for i:=1 to length(s) do
  920. if s[i] in ['a'..'z'] then
  921. upper[i]:=char(byte(s[i])-32)
  922. else
  923. upper[i]:=s[i];
  924. {$ifndef TP}
  925. {$ifopt H+}
  926. SetLength(upper,length(s));
  927. {$else}
  928. upper[0]:=s[0];
  929. {$endif}
  930. {$else}
  931. upper[0]:=s[0];
  932. {$endif}
  933. end;
  934. function set_target_os(t:tos):boolean;
  935. var
  936. i : longint;
  937. begin
  938. set_target_os:=false;
  939. { target 1 is none }
  940. for i:=2 to oscnt do
  941. if os_infos[i].id=t then
  942. begin
  943. target_os:=os_infos[i];
  944. set_target_os:=true;
  945. exit;
  946. end;
  947. end;
  948. function set_target_asm(t:tasm):boolean;
  949. var
  950. i : longint;
  951. begin
  952. set_target_asm:=false;
  953. for i:=1 to asmcnt do
  954. if as_infos[i].id=t then
  955. begin
  956. target_asm:=as_infos[i];
  957. set_target_asm:=true;
  958. exit;
  959. end;
  960. end;
  961. function set_target_link(t:tlink):boolean;
  962. var
  963. i : longint;
  964. begin
  965. set_target_link:=false;
  966. for i:=1 to linkcnt do
  967. if link_infos[i].id=t then
  968. begin
  969. target_link:=link_infos[i];
  970. set_target_link:=true;
  971. exit;
  972. end;
  973. end;
  974. function set_target_ar(t:tar):boolean;
  975. var
  976. i : longint;
  977. begin
  978. set_target_ar:=false;
  979. for i:=1 to arcnt do
  980. if ar_infos[i].id=t then
  981. begin
  982. target_ar:=ar_infos[i];
  983. set_target_ar:=true;
  984. exit;
  985. end;
  986. end;
  987. function set_target_info(t:ttarget):boolean;
  988. var
  989. i : longint;
  990. begin
  991. set_target_info:=false;
  992. for i:=1 to targetcnt do
  993. if target_infos[i].target=t then
  994. begin
  995. target_info:=target_infos[i];
  996. set_target_os(target_info.os);
  997. set_target_asm(target_info.assem);
  998. set_target_link(target_info.link);
  999. set_target_ar(target_info.ar);
  1000. target_cpu:=target_info.cpu;
  1001. set_target_info:=true;
  1002. exit;
  1003. end;
  1004. end;
  1005. {****************************************************************************
  1006. Load from string
  1007. ****************************************************************************}
  1008. function set_string_target(s : string) : boolean;
  1009. var
  1010. i : longint;
  1011. begin
  1012. set_string_target:=false;
  1013. { this should be case insensitive !! PM }
  1014. s:=upper(s);
  1015. for i:=1 to targetcnt do
  1016. if target_infos[i].short_name=s then
  1017. begin
  1018. target_info:=target_infos[i];
  1019. set_target_os(target_info.os);
  1020. set_target_asm(target_info.assem);
  1021. set_target_link(target_info.link);
  1022. set_target_ar(target_info.ar);
  1023. target_cpu:=target_info.cpu;
  1024. set_string_target:=true;
  1025. exit;
  1026. end;
  1027. end;
  1028. function set_string_asm(s : string) : boolean;
  1029. var
  1030. i : longint;
  1031. begin
  1032. set_string_asm:=false;
  1033. { this should be case insensitive !! PM }
  1034. s:=upper(s);
  1035. for i:=1 to asmcnt do
  1036. if as_infos[i].idtxt=s then
  1037. begin
  1038. target_asm:=as_infos[i];
  1039. set_string_asm:=true;
  1040. end;
  1041. end;
  1042. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1043. var
  1044. i : longint;
  1045. begin
  1046. set_string_asmmode:=false;
  1047. { this should be case insensitive !! PM }
  1048. s:=upper(s);
  1049. for i:=1 to asmmodecnt do
  1050. if asmmodeinfos[i].idtxt=s then
  1051. begin
  1052. t:=asmmodeinfos[i].id;
  1053. set_string_asmmode:=true;
  1054. end;
  1055. end;
  1056. {****************************************************************************
  1057. Initialization of default target
  1058. ****************************************************************************}
  1059. procedure default_os(t:ttarget);
  1060. begin
  1061. set_target_info(t);
  1062. if source_os.name='' then
  1063. source_os:=target_os;
  1064. end;
  1065. procedure set_source_os(t:tos);
  1066. var
  1067. i : longint;
  1068. begin
  1069. { can't use message() here (PFV) }
  1070. if source_os.name<>'' then
  1071. Writeln('Warning: Source OS Redefined!');
  1072. for i:=1 to oscnt do
  1073. if os_infos[i].id=t then
  1074. begin
  1075. source_os:=os_infos[i];
  1076. exit;
  1077. end;
  1078. end;
  1079. begin
  1080. { first get source OS }
  1081. source_os.name:='';
  1082. { please note then we use cpu86 and cpu68 here on purpose !! }
  1083. {$ifdef cpu86}
  1084. {$ifdef GO32V1}
  1085. set_source_os(os_i386_GO32V1);
  1086. {$else}
  1087. {$ifdef GO32V2}
  1088. set_source_os(os_i386_GO32V2);
  1089. {$else}
  1090. {$ifdef OS2}
  1091. set_source_os(os_i386_OS2);
  1092. {$else}
  1093. {$ifdef LINUX}
  1094. set_source_os(os_i386_LINUX);
  1095. {$else}
  1096. {$ifdef WIN32}
  1097. set_source_os(os_i386_WIN32);
  1098. {$endif win32}
  1099. {$endif linux}
  1100. {$endif os2}
  1101. {$endif go32v2}
  1102. {$endif go32v1}
  1103. {$endif cpu86}
  1104. {$ifdef cpu68}
  1105. {$ifdef AMIGA}
  1106. set_source_os(os_m68k_Amiga);
  1107. {$else}
  1108. {$ifdef ATARI}
  1109. set_source_os(os_m68k_Atari);
  1110. {$else}
  1111. {$ifdef MACOS}
  1112. set_source_os(os_m68k_MAC);
  1113. {$else}
  1114. {$ifdef LINUX}
  1115. set_source_os(os_m68k_linux);
  1116. {$endif linux}
  1117. {$endif macos}
  1118. {$endif atari}
  1119. {$endif amiga}
  1120. {$endif cpu68}
  1121. { Now default target !! }
  1122. {$ifdef i386}
  1123. {$ifdef GO32V1}
  1124. default_os(target_i386_GO32V1);
  1125. {$else}
  1126. {$ifdef GO32V2}
  1127. default_os(target_i386_GO32V2);
  1128. {$else}
  1129. {$ifdef OS2}
  1130. default_os(target_i386_OS2);
  1131. {$else}
  1132. {$ifdef LINUX}
  1133. default_os(target_i386_LINUX);
  1134. {$else}
  1135. {$ifdef WIN32}
  1136. default_os(target_i386_WIN32);
  1137. {$else}
  1138. default_os(target_i386_GO32V2);
  1139. {$endif win32}
  1140. {$endif linux}
  1141. {$endif os2}
  1142. {$endif go32v2}
  1143. {$endif go32v1}
  1144. {$endif i386}
  1145. {$ifdef m68k}
  1146. {$ifdef AMIGA}
  1147. default_os(target_m68k_Amiga);
  1148. {$else}
  1149. {$ifdef ATARI}
  1150. default_os(target_m68k_Atari);
  1151. {$else}
  1152. {$ifdef MACOS}
  1153. default_os(target_m68k_Mac);
  1154. {$else}
  1155. {$ifdef LINUX}
  1156. default_os(target_m68k_linux);
  1157. {$else}
  1158. default_os(target_m68k_Amiga);
  1159. {$endif linux}
  1160. {$endif macos}
  1161. {$endif atari}
  1162. {$endif amiga}
  1163. {$endif m68k}
  1164. end.
  1165. {
  1166. $Log$
  1167. Revision 1.3 1998-12-26 15:20:31 florian
  1168. + more changes for the new version
  1169. Revision 1.2 1998/12/15 22:18:58 florian
  1170. * some code added
  1171. Revision 1.1 1998/12/15 16:32:59 florian
  1172. + first version, derived from old routines
  1173. }