systems.pas 15 KB

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