systems.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. {
  2. $Id$
  3. Copyright (C) 1995,97 by Florian Klaempfl
  4. This unit contains informations about the target systems supported
  5. (these are not processor specific)
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 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. ttarget = (target_GO32V1,target_GO32V2,target_LINUX,target_OS2,
  23. target_WIN32,target_Amiga,target_Atari,target_Mac68k);
  24. tos = (os_GO32V1, os_GO32V2, os_Linux, os_OS2,
  25. os_WIN32, os_Amiga, os_Atari, os_Mac68k);
  26. tasm = (as_as
  27. {$ifdef i386}
  28. ,as_nasmcoff, as_nasmelf, as_nasmobj
  29. {$endif}
  30. {$ifdef m68k}
  31. ,as_as68k
  32. {$endif}
  33. );
  34. tlink = (link_ld
  35. {$ifdef i386}
  36. ,link_ldgo32v1, link_ldgo32v2, link_ldw, link_ldos2);
  37. {$endif i386}
  38. {$ifdef m68k}
  39. );
  40. {$endif}
  41. tendian = (endian_little,en_big_endian);
  42. tosinfo = record
  43. name : string[30];
  44. sharedlibext,
  45. staticlibext,
  46. sourceext,
  47. pasext,
  48. exeext,
  49. scriptext : string[4];
  50. Cprefix : string[2];
  51. newline : string[2];
  52. endian : tendian;
  53. use_function_relative_addresses : boolean;
  54. end;
  55. tasminfo = record
  56. id : tasm;
  57. idtxt : string[8];
  58. asmbin : string[8];
  59. asmcmd : string[50];
  60. labelprefix : string[2];
  61. comment : string[2];
  62. end;
  63. tlinkinfo = record
  64. linkbin : string[8];
  65. linkcmd : string[50];
  66. stripopt : string[2];
  67. groupstart,
  68. groupend,
  69. inputstart,
  70. inputend : string[8];
  71. libprefix : string[2];
  72. end;
  73. ttargetinfo = record
  74. target : ttarget;
  75. short_name : string[8];
  76. unit_env : string[12];
  77. system_unit : string[8];
  78. smartext,
  79. unitext,
  80. unitlibext,
  81. asmext,
  82. objext : string[4];
  83. os : tos;
  84. link : tlink;
  85. assem : tasm;
  86. end;
  87. var
  88. target_info : ttargetinfo;
  89. target_os : tosinfo;
  90. target_asm : tasminfo;
  91. target_link : tlinkinfo;
  92. source_os : tosinfo;
  93. function set_string_target(const s : string) : boolean;
  94. implementation
  95. const
  96. os_infos : array[tos] of tosinfo = (
  97. (
  98. name : 'GO32 V1 DOS extender';
  99. sharedlibext : '.DLL';
  100. staticlibext : '.A';
  101. sourceext : '.PP';
  102. pasext : '.PAS';
  103. exeext : '.EXE';
  104. scriptext : '.BAT';
  105. Cprefix : '_';
  106. newline : #13#10;
  107. endian : endian_little;
  108. use_function_relative_addresses : true
  109. ),
  110. (
  111. name : 'GO32 V2 DOS extender';
  112. sharedlibext : '.DLL';
  113. staticlibext : '.A';
  114. sourceext : '.PP';
  115. pasext : '.PAS';
  116. exeext : '.EXE';
  117. scriptext : '.BAT';
  118. Cprefix : '_';
  119. newline : #13#10;
  120. endian : endian_little;
  121. use_function_relative_addresses : true
  122. ),
  123. (
  124. name : 'Linux';
  125. sharedlibext : '.so';
  126. staticlibext : '.a';
  127. sourceext : '.pp';
  128. pasext : '.pas';
  129. exeext : '';
  130. scriptext : '.sh';
  131. Cprefix : '';
  132. newline : #10;
  133. endian : endian_little;
  134. use_function_relative_addresses : true
  135. ),
  136. (
  137. name : 'OS/2 (32bit)';
  138. sharedlibext : '.ao2';
  139. staticlibext : '.a';
  140. sourceext : '.pp';
  141. pasext : '.pas';
  142. exeext : '.exe';
  143. scriptext : '.cmd';
  144. Cprefix : '_';
  145. newline : #13#10;
  146. endian : endian_little;
  147. use_function_relative_addresses : false
  148. ),
  149. (
  150. name : 'Win32';
  151. sharedlibext : '.dll';
  152. staticlibext : '.a';
  153. sourceext : '.pp';
  154. pasext : '.pas';
  155. exeext : '.exe';
  156. scriptext : '.bat';
  157. Cprefix : '_';
  158. newline : #13#10;
  159. endian : endian_little;
  160. use_function_relative_addresses : true
  161. ),
  162. (
  163. name : 'Commodore Amiga';
  164. sharedlibext : '.library';
  165. staticlibext : '.a';
  166. sourceext : '.pp';
  167. pasext : '.pas';
  168. exeext : '';
  169. scriptext : '';
  170. Cprefix : '';
  171. newline : #10;
  172. endian : en_big_endian;
  173. use_function_relative_addresses : false
  174. ),
  175. (
  176. name : 'Atari ST/STE';
  177. sharedlibext : '.dll';
  178. staticlibext : '.a';
  179. sourceext : '.pp';
  180. pasext : '.pas';
  181. exeext : '.tpp';
  182. scriptext : '';
  183. Cprefix : '';
  184. newline : #10;
  185. endian : en_big_endian;
  186. use_function_relative_addresses : false
  187. ),
  188. (
  189. name : 'Macintosh m68k';
  190. sharedlibext : '.dll';
  191. staticlibext : '.a';
  192. sourceext : '.pp';
  193. pasext : '.pas';
  194. exeext : '.tpp';
  195. scriptext : '';
  196. Cprefix : '';
  197. newline : #10;
  198. endian : en_big_endian;
  199. use_function_relative_addresses : false
  200. )
  201. );
  202. as_infos : array[tasm] of tasminfo = (
  203. (
  204. id : as_as;
  205. idtxt : 'O';
  206. asmbin : 'as';
  207. asmcmd : '-D -o $OBJ $ASM';
  208. labelprefix : '.L';
  209. comment : '# '
  210. )
  211. {$ifdef i386}
  212. ,(
  213. id : as_nasmcoff;
  214. {$ifdef linux}
  215. idtxt : 'NASM';
  216. {$else}
  217. idtxt : 'NASMCOFF';
  218. {$endif}
  219. asmbin : 'nasm';
  220. asmcmd : '-f coff -o $OBJ $ASM';
  221. labelprefix : 'L';
  222. comment : '; '
  223. )
  224. ,(
  225. id : as_nasmelf;
  226. {$ifdef linux}
  227. idtxt : 'NASM';
  228. {$else}
  229. idtxt : 'NASMELF';
  230. {$endif}
  231. asmbin : 'nasm';
  232. asmcmd : '-f elf -o $OBJ $ASM';
  233. labelprefix : 'L';
  234. comment : '; '
  235. )
  236. ,(
  237. id : as_nasmobj;
  238. idtxt : 'OBJ';
  239. asmbin : 'nasm';
  240. asmcmd : '-f obj -o $OBJ $ASM';
  241. labelprefix : 'L';
  242. comment : '; '
  243. )
  244. {$endif}
  245. {$ifdef m68k}
  246. ,(
  247. id : as_as68k;
  248. idtxt : 'O';
  249. asmbin : 'as68k'; { Gas for the Amiga}
  250. asmcmd : '-D --register-prefix-optional -o $OBJ $ASM';
  251. labelprefix : '__L';
  252. comment : '| '
  253. )
  254. {$endif}
  255. );
  256. link_infos : array[tlink] of tlinkinfo = (
  257. (
  258. linkbin : 'ld';
  259. linkcmd : '$OPT -o $EXE $RES';
  260. stripopt : '-s';
  261. groupstart : 'GROUP(';
  262. groupend : ')';
  263. inputstart : 'INPUT(';
  264. inputend : ')';
  265. libprefix : '-l'
  266. )
  267. {$ifdef i386}
  268. ,(
  269. linkbin : 'ld';
  270. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  271. stripopt : '-s';
  272. groupstart : '-(';
  273. groupend : '-)';
  274. inputstart : '';
  275. inputend : '';
  276. libprefix : '-l'
  277. )
  278. ,(
  279. linkbin : 'ld';
  280. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  281. stripopt : '-s';
  282. groupstart : '-(';
  283. groupend : '-)';
  284. inputstart : '';
  285. inputend : '';
  286. libprefix : '-l'
  287. )
  288. ,(
  289. linkbin : 'ldw';
  290. linkcmd : '$OPT -o $EXE $RES';
  291. stripopt : '-s';
  292. groupstart : 'GROUP(';
  293. groupend : ')';
  294. inputstart : 'INPUT(';
  295. inputend : ')';
  296. libprefix : '-l'
  297. )
  298. ,(
  299. linkbin : 'ld';
  300. linkcmd : '-o $EXE @$RES';
  301. stripopt : '-s';
  302. groupstart : '-(';
  303. groupend : '-)';
  304. inputstart : '';
  305. inputend : '';
  306. libprefix : ''
  307. )
  308. {$endif i386}
  309. );
  310. target_infos : array[ttarget] of ttargetinfo = (
  311. (
  312. target : target_GO32V1;
  313. short_name : 'GO32V1';
  314. unit_env : 'GO32V1UNITS';
  315. system_unit : 'SYSTEM';
  316. smartext : '.SL';
  317. unitext : '.PP1';
  318. unitlibext : '.PPL';
  319. asmext : '.S1';
  320. objext : '.O1';
  321. os : os_GO32V1;
  322. link : link_ldgo32v1;
  323. assem : as_as
  324. ),
  325. (
  326. target : target_GO32V2;
  327. short_name : 'GO32V2';
  328. unit_env : 'GO32V2UNITS';
  329. system_unit : 'SYSTEM';
  330. {$ifndef UseAnsiString}
  331. smartext : '.SL';
  332. unitext : '.PPU';
  333. unitlibext : '.PPL';
  334. asmext : '.S';
  335. objext : '.O';
  336. {$else UseAnsiString}
  337. smartext : '.SL';
  338. unitext : '.PAU';
  339. unitlibext : '.PPL';
  340. asmext : '.SA';
  341. objext : '.OA';
  342. {$endif UseAnsiString}
  343. os : os_GO32V2;
  344. link : link_ldgo32v2;
  345. assem : as_as
  346. ),
  347. (
  348. target : target_LINUX;
  349. short_name : 'LINUX';
  350. unit_env : 'LINUXUNITS';
  351. system_unit : 'syslinux';
  352. smartext : '.sl';
  353. unitext : '.ppu';
  354. unitlibext : '.ppl';
  355. asmext : '.s';
  356. objext : '.o';
  357. os : os_Linux;
  358. link : link_ld;
  359. assem : as_as
  360. ),
  361. (
  362. target : target_OS2;
  363. short_name : 'OS2';
  364. unit_env : 'OS2UNITS';
  365. system_unit : 'SYSOS2';
  366. smartext : '.sl';
  367. unitext : '.ppo';
  368. unitlibext : '.ppl';
  369. asmext : '.so2';
  370. objext : '.oo2';
  371. os : os_OS2;
  372. link : link_ldos2;
  373. assem : as_as
  374. ),
  375. (
  376. target : target_WIN32;
  377. short_name : 'WIN32';
  378. unit_env : 'WIN32UNITS';
  379. system_unit : 'SYSWIN32';
  380. smartext : '.sl';
  381. unitext : '.ppw';
  382. unitlibext : '.ppl';
  383. asmext : '.s';
  384. objext : '.o';
  385. os : os_Win32;
  386. link : link_ldw;
  387. assem : as_as
  388. ),
  389. (
  390. target : target_Amiga;
  391. short_name : 'AMIGA';
  392. unit_env : '';
  393. system_unit : 'sysamiga';
  394. smartext : '.sl';
  395. unitext : '.ppa';
  396. unitlibext : '.ppl';
  397. asmext : '.asm';
  398. objext : '.o';
  399. os : os_Amiga;
  400. link : link_ld;
  401. assem : as_as
  402. ),
  403. (
  404. target : target_Atari;
  405. short_name : 'ATARI';
  406. unit_env : '';
  407. system_unit : 'SYSATARI';
  408. smartext : '.sl';
  409. unitext : '.ppt';
  410. unitlibext : '.ppl';
  411. asmext : '.s';
  412. objext : '.o';
  413. os : os_Atari;
  414. link : link_ld;
  415. assem : as_as
  416. ),
  417. (
  418. target : target_Mac68k;
  419. short_name : 'MACOS';
  420. unit_env : '';
  421. system_unit : 'sysmac';
  422. smartext : '.sl';
  423. unitext : '.ppt';
  424. unitlibext : '.ppl';
  425. asmext : '.s';
  426. objext : '.o';
  427. os : os_Mac68k;
  428. link : link_ld;
  429. assem : as_as
  430. )
  431. );
  432. procedure set_target(t : ttarget);
  433. begin
  434. target_info:=target_infos[t];
  435. target_os:=os_infos[target_info.os];
  436. target_asm:=as_infos[target_info.assem];
  437. target_link:=link_infos[target_info.link];
  438. end;
  439. function set_string_target(const s : string) : boolean;
  440. var
  441. t : ttarget;
  442. begin
  443. set_string_target:=false;
  444. for t:=target_GO32V1 to target_mac68k do
  445. if target_infos[t].short_name=s then
  446. begin
  447. set_string_target:=true;
  448. set_target(t);
  449. end;
  450. end;
  451. procedure default_os(t:ttarget);
  452. begin
  453. set_target(t);
  454. source_os:=os_infos[target_info.os];
  455. end;
  456. begin
  457. {$ifdef tp}
  458. default_os(target_GO32V2);
  459. {$else}
  460. {$ifdef DOS}
  461. default_os(target_GO32V1);
  462. {$endif}
  463. {$ifdef GO32V1}
  464. default_os(target_GO32V1);
  465. {$endif}
  466. {$ifdef GO32V2}
  467. default_os(target_GO32V2);
  468. {$endif}
  469. {$ifdef OS2}
  470. default_os(target_OS2);
  471. {$endif}
  472. {$ifdef LINUX}
  473. default_os(target_LINUX);
  474. {$endif}
  475. {$ifdef WIN32}
  476. default_os(target_WIN32);
  477. {$endif}
  478. {$ifdef AMIGA}
  479. default_os(target_AMIGA);
  480. {$endif}
  481. {$ifdef ATARI}
  482. default_os(target_ATARI);
  483. {$endif}
  484. {$ifdef MACOS}
  485. default_os(target_MAC68k);
  486. {$endif}
  487. {$endif}
  488. end.
  489. {
  490. $Log$
  491. Revision 1.10 1998-05-11 13:07:58 peter
  492. + $ifdef NEWPPU for the new ppuformat
  493. + $define GDB not longer required
  494. * removed all warnings and stripped some log comments
  495. * no findfirst/findnext anymore to remove smartlink *.o files
  496. Revision 1.9 1998/05/06 08:38:49 pierre
  497. * better position info with UseTokenInfo
  498. UseTokenInfo greatly simplified
  499. + added check for changed tree after first time firstpass
  500. (if we could remove all the cases were it happen
  501. we could skip all firstpass if firstpasscount > 1)
  502. Only with ExtDebug
  503. Revision 1.8 1998/05/04 20:19:54 peter
  504. * small fix for go32v2
  505. Revision 1.7 1998/05/04 17:54:29 peter
  506. + smartlinking works (only case jumptable left todo)
  507. * redesign of systems.pas to support assemblers and linkers
  508. + Unitname is now also in the PPU-file, increased version to 14
  509. Revision 1.6 1998/05/01 07:43:57 florian
  510. + basics for rtti implemented
  511. + switch $m (generate rtti for published sections)
  512. Revision 1.5 1998/04/29 10:34:06 pierre
  513. + added some code for ansistring (not complete nor working yet)
  514. * corrected operator overloading
  515. * corrected nasm output
  516. + started inline procedures
  517. + added starstarn : use ** for exponentiation (^ gave problems)
  518. + started UseTokenInfo cond to get accurate positions
  519. Revision 1.4 1998/04/27 15:45:20 peter
  520. + -Xl for smartlink
  521. + target_info.arext = .a
  522. Revision 1.3 1998/04/16 10:50:45 daniel
  523. * Fixed some things that were broken for OS/2.
  524. }