systems.pas 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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. { target operanting system }
  23. ttarget = (target_GO32V1,target_OS2,target_LINUX,
  24. target_WIN32,target_GO32V2,
  25. target_Amiga,target_Atari,target_Mac68k);
  26. tendian = (endian_little,en_big_endian);
  27. ttargetinfo = record
  28. target : ttarget;
  29. target_name : string[30];
  30. short_name : string[8];
  31. unit_env : string[20];
  32. system_unit : string[8];
  33. exeext,
  34. objext,
  35. dllext,
  36. arext,
  37. unitext,
  38. libext,
  39. asmext,
  40. sourceext,
  41. pasext : string[4];
  42. newline : string[3];
  43. labelprefix : string[2];
  44. Cprefix : string[2];
  45. use_function_relative_addresses : boolean;
  46. endian : tendian;
  47. end;
  48. tsourceinfo = record
  49. source:ttarget;
  50. source_name:string[30];
  51. exeext,
  52. scriptext : string[4];
  53. endian : tendian;
  54. end;
  55. var
  56. source_info : tsourceinfo;
  57. target_info : ttargetinfo;
  58. function set_string_target(const s : string) : boolean;
  59. implementation
  60. const
  61. target_infos : array[ttarget] of ttargetinfo = (
  62. (
  63. target : target_GO32V1;
  64. target_name : 'GO32 V1 DOS extender';
  65. short_name : 'GO32V1';
  66. unit_env : 'GO32V1UNITS';
  67. system_unit : 'SYSTEM';
  68. exeext : '';
  69. objext : '.O1';
  70. dllext : '.DLL';
  71. arext : '.A';
  72. unitext : '.PP1';
  73. libext : '.PPL';
  74. asmext : '.S1';
  75. sourceext : '.PP';
  76. pasext : '.PAS';
  77. newline : #13#10;
  78. labelprefix : '.L';
  79. Cprefix : '_';
  80. use_function_relative_addresses : true;
  81. endian : endian_little
  82. ),
  83. (
  84. target : target_OS2;
  85. target_name : 'OS/2 (32 bit)';
  86. short_name : 'OS2';
  87. unit_env : 'OS2UNITS';
  88. system_unit : 'SYSOS2';
  89. exeext : '';
  90. objext : '.oo2';
  91. dllext : '.ao2';
  92. arext : '.a';
  93. unitext : '.ppo';
  94. libext : '.ppl';
  95. asmext : '.so2';
  96. sourceext : '.pas';
  97. pasext : '.pp';
  98. newline : #13#10;
  99. labelprefix : 'L';
  100. Cprefix : '_';
  101. use_function_relative_addresses : false;
  102. endian : endian_little
  103. ),
  104. (
  105. target : target_LINUX;
  106. target_name : 'Linux';
  107. short_name : 'LINUX';
  108. unit_env : 'LINUXUNITS';
  109. system_unit : 'syslinux';
  110. exeext : '';
  111. objext : '.o';
  112. dllext : '.so';
  113. arext : '.a';
  114. unitext : '.ppu';
  115. libext : '.ppl';
  116. asmext : '.s';
  117. sourceext : '.pp';
  118. pasext : '.pas';
  119. newline : #10;
  120. labelprefix : '.L';
  121. Cprefix : '';
  122. use_function_relative_addresses : true;
  123. endian : endian_little
  124. ),
  125. (
  126. target : target_WIN32;
  127. target_name : 'Win32';
  128. short_name : 'WIN32';
  129. unit_env : 'WIN32UNITS';
  130. system_unit : 'SYSWIN32';
  131. exeext : '.exe';
  132. objext : '.o';
  133. dllext : '.dll';
  134. arext : '.a';
  135. unitext : '.ppw';
  136. libext : '.ppl';
  137. asmext : '.s';
  138. sourceext : '.pp';
  139. pasext : '.pas';
  140. newline : #13#10;
  141. labelprefix : '.L';
  142. Cprefix : '_'; {???}
  143. use_function_relative_addresses : true; {????}
  144. endian : endian_little
  145. ),
  146. (
  147. target : target_GO32V2;
  148. target_name : 'GO32 V2.0 DOS extender';
  149. short_name : 'GO32V2';
  150. unit_env : 'GO32V2UNITS';
  151. system_unit : 'SYSTEM';
  152. exeext : '.EXE';
  153. objext : '.O';
  154. dllext : '.DLL';
  155. arext : '.A';
  156. unitext : '.PPU';
  157. libext : '.PPL';
  158. asmext : '.S';
  159. sourceext : '.PP';
  160. pasext : '.PAS';
  161. newline : #13#10;
  162. labelprefix : '.L';
  163. Cprefix : '_';
  164. use_function_relative_addresses : true;
  165. endian : endian_little
  166. ),
  167. (
  168. target : target_Amiga;
  169. target_name : 'Commodore Amiga';
  170. short_name : 'AMIGA';
  171. unit_env : '';
  172. system_unit : 'sysamiga'; { case sensitive }
  173. exeext : '';
  174. objext : '.o';
  175. dllext : '.library';
  176. arext : '.a';
  177. unitext : '.ppa';
  178. libext : '.ppl';
  179. asmext : '.asm';
  180. sourceext : '.pp';
  181. pasext : '.pas';
  182. newline : #10; { ??? }
  183. labelprefix : '.L';
  184. Cprefix : '';
  185. use_function_relative_addresses : true;
  186. endian : endian_little
  187. ),
  188. (
  189. target : target_Atari;
  190. target_name : 'Atari ST/STE';
  191. short_name : 'ATARI';
  192. unit_env : '';
  193. system_unit : 'SYSATARI';
  194. exeext : '.ttp';
  195. objext : '.o';
  196. dllext : '.dll';
  197. arext : '.a';
  198. unitext : '.PPT';
  199. libext : '.PPL';
  200. asmext : '.s';
  201. sourceext : '.pp';
  202. pasext : '.pas';
  203. newline : #13#10;
  204. labelprefix : '.L';
  205. Cprefix : '';
  206. use_function_relative_addresses : true;
  207. endian : endian_little
  208. ),
  209. (
  210. target : target_Mac68k;
  211. target_name : 'Macintosh m68k';
  212. short_name : 'MAC OS';
  213. unit_env : '';
  214. system_unit : 'sysmac'; { case sensitive }
  215. exeext : '';
  216. objext : '.o';
  217. dllext : '.dll';
  218. arext : '.a';
  219. unitext : '.ppm';
  220. libext : '.ppl';
  221. asmext : '.asm';
  222. sourceext : '.pp';
  223. pasext : '.pas';
  224. newline : #13; { ??? }
  225. labelprefix : '__L';{ only ascii A..Z,a..z or _ allowed as first }
  226. Cprefix : '';
  227. use_function_relative_addresses : true;
  228. endian : endian_little
  229. )
  230. );
  231. source_infos : array[ttarget] of tsourceinfo = (
  232. (
  233. source : target_GO32V1;
  234. source_name : 'GO32 V1 DOS extender';
  235. exeext : '.EXE';
  236. scriptext : '.BAT';
  237. endian : endian_little
  238. ),
  239. (
  240. source : target_OS2;
  241. source_name : 'OS/2 (32 bit)';
  242. exeext : '.EXE';
  243. scriptext : '.CMD';
  244. endian : endian_little
  245. ),
  246. (
  247. source : target_LINUX;
  248. source_name : 'Linux';
  249. exeext : '';
  250. scriptext : '.sh';
  251. endian : endian_little
  252. ),
  253. (
  254. source : target_WIN32;
  255. source_name : 'Win32';
  256. exeext : '.EXE';
  257. scriptext : '.BAT';
  258. endian : endian_little
  259. ),
  260. (
  261. source : target_GO32V2;
  262. source_name : 'GO32 V2.0 DOS extender';
  263. exeext : '.EXE';
  264. scriptext : '.BAT';
  265. endian : endian_little
  266. ),
  267. (
  268. source : target_Amiga;
  269. source_name : 'Commodore Amiga';
  270. exeext : '';
  271. scriptext : '';
  272. endian : en_big_endian
  273. ),
  274. (
  275. source : target_Atari;
  276. source_name : 'Atari ST/STE';
  277. exeext : '.ttp';
  278. scriptext : '';
  279. endian : en_big_endian
  280. ),
  281. (
  282. source : target_Mac68k;
  283. source_name : 'Macintosh m68k';
  284. exeext : '';
  285. scriptext : '';
  286. endian : en_big_endian
  287. )
  288. );
  289. procedure set_target(t : ttarget);
  290. begin
  291. target_info:=target_infos[t];
  292. end;
  293. function set_string_target(const s : string) : boolean;
  294. var
  295. t : ttarget;
  296. begin
  297. set_string_target:=false;
  298. for t:=target_GO32V1 to target_mac68k do
  299. if target_infos[t].short_name=s then
  300. begin
  301. set_string_target:=true;
  302. set_target(t);
  303. end;
  304. end;
  305. procedure default_os(t:ttarget);
  306. begin
  307. set_target(t);
  308. source_info:=source_infos[t];
  309. end;
  310. begin
  311. {$ifdef tp}
  312. default_os(target_GO32V2);
  313. {$else}
  314. {$ifdef DOS}
  315. default_os(target_GO32V1);
  316. {$endif}
  317. {$ifdef GO32V1}
  318. default_os(target_GO32V1);
  319. {$endif}
  320. {$ifdef GO32V2}
  321. default_os(target_GO32V2);
  322. {$endif}
  323. {$ifdef OS2}
  324. default_os(target_OS2);
  325. {$endif}
  326. {$ifdef LINUX}
  327. default_os(target_LINUX);
  328. {$endif}
  329. {$ifdef WIN32}
  330. default_os(target_WIN32);
  331. {$endif}
  332. {$ifdef AMIGA}
  333. default_os(target_AMIGA);
  334. {$endif}
  335. {$ifdef ATARI}
  336. default_os(target_ATARI);
  337. {$endif}
  338. {$ifdef MACOS}
  339. default_os(target_MAC68k);
  340. {$endif}
  341. {$endif}
  342. end.
  343. {
  344. $Log$
  345. Revision 1.4 1998-04-27 15:45:20 peter
  346. + -Xl for smartlink
  347. + target_info.arext = .a
  348. Revision 1.3 1998/04/16 10:50:45 daniel
  349. * Fixed some things that were broken for OS/2.
  350. Revision 1.2 1998/03/30 15:53:01 florian
  351. * last changes before release:
  352. - gdb fixed
  353. - ratti386 warning removed (about unset function result)
  354. Revision 1.1.1.1 1998/03/25 11:18:15 root
  355. * Restored version
  356. Revision 1.33 1998/03/10 23:48:37 florian
  357. * a couple of bug fixes to get the compiler with -OGaxz compiler, sadly
  358. enough, it doesn't run
  359. Revision 1.32 1998/03/10 16:27:46 pierre
  360. * better line info in stabs debug
  361. * symtabletype and lexlevel separated into two fields of tsymtable
  362. + ifdef MAKELIB for direct library output, not complete
  363. + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
  364. working
  365. + ifdef TESTFUNCRET for setting func result in underfunction, not
  366. working
  367. Revision 1.31 1998/03/10 01:17:29 peter
  368. * all files have the same header
  369. * messages are fully implemented, EXTDEBUG uses Comment()
  370. + AG... files for the Assembler generation
  371. Revision 1.30 1998/03/05 22:43:53 florian
  372. * some win32 support stuff added
  373. Revision 1.29 1998/03/02 22:04:36 carl
  374. + Added mac line break
  375. Revision 1.28 1998/03/02 13:38:51 peter
  376. + importlib object
  377. * doesn't crash on a systemunit anymore
  378. * updated makefile and depend
  379. Revision 1.25 1998/02/28 00:20:34 florian
  380. * more changes to get import libs for Win32 working
  381. Revision 1.24 1998/02/27 22:28:01 florian
  382. + win_targ unit
  383. + support of sections
  384. + new asmlists: sections, exports and resource
  385. Revision 1.23 1998/02/27 21:24:20 florian
  386. * dll support changed (dll name can be also a string contants)
  387. Revision 1.22 1998/02/23 02:55:08 carl
  388. + added correct extension to AMIGA libext
  389. Revision 1.21 1998/02/22 23:03:39 peter
  390. * renamed msource->mainsource and name->unitname
  391. * optimized filename handling, filename is not seperate anymore with
  392. path+name+ext, this saves stackspace and a lot of fsplit()'s
  393. * recompiling of some units in libraries fixed
  394. * shared libraries are working again
  395. + $LINKLIB <lib> to support automatic linking to libraries
  396. + libraries are saved/read from the ppufile, also allows more libraries
  397. per ppufile
  398. Revision 1.20 1998/02/18 14:14:44 michael
  399. * removed entries for dos_targ and lin_targ
  400. Revision 1.19 1998/02/17 21:21:05 peter
  401. + Script unit
  402. + __EXIT is called again to exit a program
  403. - target_info.link/assembler calls
  404. * linking works again for dos
  405. * optimized a few filehandling functions
  406. * fixed stabs generation for procedures
  407. Revision 1.18 1998/02/14 01:45:35 peter
  408. * more fixes
  409. - pmode target is removed
  410. - search_as_ld is removed, this is done in the link.pas/assemble.pas
  411. + findexe() to search for an executable (linker,assembler,binder)
  412. Revision 1.17 1998/02/13 22:26:45 peter
  413. * fixed a few SigSegv's
  414. * INIT$$ was not written for linux!
  415. * assembling and linking works again for linux and dos
  416. + assembler object, only attasmi3 supported yet
  417. * restore pp.pas with AddPath etc.
  418. Revision 1.16 1998/02/13 10:35:50 daniel
  419. * Made Motorola version compilable.
  420. * Fixed optimizer
  421. Revision 1.15 1998/02/12 17:19:32 florian
  422. * fixed to get remake3 work, but needs additional fixes (output, I don't like
  423. also that aktswitches isn't a pointer)
  424. Revision 1.14 1998/02/12 11:50:50 daniel
  425. Yes! Finally! After three retries, my patch!
  426. Changes:
  427. Complete rewrite of psub.pas.
  428. Added support for DLL's.
  429. Compiler requires less memory.
  430. Platform units for each platform.
  431. Revision 1.11 1998/01/26 16:42:01 daniel
  432. * Reversed source_ext and pas_ext for OS/2 target. The .pas extension is
  433. recognized by the Workplace Shell of OS/2, the .pp is not.
  434. Revision 1.10 1998/01/26 13:35:33 florian
  435. * adapted to work with TP
  436. Revision 1.9 1998/01/25 18:45:50 peter
  437. + Search for as and ld at startup
  438. + source_info works the same as target_info
  439. + externlink allows only external linking
  440. Revision 1.8 1998/01/22 08:57:55 peter
  441. + added target_info.pasext and target_info.libext
  442. Revision 1.7 1998/01/09 19:44:09 carl
  443. * labels for mac68k target now use the MPW correct syntax
  444. Revision 1.6 1997/12/12 13:28:42 florian
  445. + version 0.99.0
  446. * all WASM options changed into MASM
  447. + -O2 for Pentium II optimizations
  448. Revision 1.5 1997/12/09 14:12:21 carl
  449. + added planned m68k systems, and fixed some problems in amiga info.
  450. Revision 1.4 1997/12/08 11:53:49 pierre
  451. reverted to old version of systems.pas,
  452. Daniel's version is not compilable due to the bug (corrected) of
  453. mil value for a procvar const !!
  454. Revision 1.1.1.1 1997/11/27 08:33:02 michael
  455. FPC Compiler CVS start
  456. Pre-CVS log:
  457. CEC Carl-Eric Codere
  458. FK Florian Klaempfl
  459. + feature added
  460. - removed
  461. * bug fixed or changed
  462. History:
  463. 15th october 1996:
  464. + ttargetinfo.newline added (FK)
  465. 19th september 1997:
  466. * the suffix of GO32V1 units is now PP1 (FK)
  467. 8th october 1997:
  468. + target amiga added for tests, unit should divided
  469. into sysi386 and sysm68k (FK)
  470. }