home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / mpw-README < prev    next >
Text File  |  1996-09-28  |  9KB  |  242 lines

  1. This is preliminary information about the Macintosh(tm) MPW(tm) port
  2. of the Cygnus GNU tools.
  3.  
  4.  
  5. INSTALLING CYGNUS GNU TOOLS
  6.  
  7. To use these tools, you will need a Mac with a 68020 or better or else
  8. any PowerMac, System 7.1 or later, and MPW 3.3 or 3.4.  You will *not*
  9. need MPW C unless you want to rebuild from sources, nor even any
  10. include files, unless you are building actual Mac applications.
  11.  
  12. The Cygnus GNU tools can go in any directory that is in your
  13. {Commands} list.  We generally put all the tools in something like
  14. {Boot}Cygnus:latest:bin, and something like this in a UserStartup
  15. file:
  16.  
  17.     set Commands "{Boot}Cygnus:latest:bin:,{Commands}"
  18.  
  19. However, the cpp and cc1 programs of GCC are not normally stored here.
  20. Instead, they will be in a "lib" directory that is alongside "bin",
  21. and organized by target and version underneath, with names like
  22.  
  23.     :lib:gcc-lib:<target>:cygnus-<version>:
  24.  
  25. If you built and installed everything yourself according to the build
  26. instructions, then you will not have any problems.  However, you may
  27. discover that GCC seems unable to find the right cpp and cc1; usually
  28. this will be because directory names have changed.  (Even renaming
  29. your hard disk will make this happen.)  In such cases, you have
  30. several choices.  One is just to add this directory to {Commands}, but
  31. then you will not be able to get any other cpp or cc1, such as those
  32. used by a different target or version.  Another way is to rename your
  33. disk and directories to match the prefix used when the tools were
  34. compiled.  Finally, you can set the variable GCC_EXEC_PREFIX to point
  35. to the library directory:
  36.  
  37.     set GCC_EXEC_PREFIX MyDisk:Stuff:lib:gcc-lib:
  38.     export GCC_EXEC_PREFIX
  39.  
  40.  
  41. USING CYGNUS GNU TOOLS
  42.  
  43. To compile and link a file "foo.c", say
  44.  
  45.     gC foo.c
  46.  
  47. This port of GCC exactly the same option syntax as its Unix
  48. counterpart.  It also has similar compilation rules, so it will run
  49. the assembler on .s files and so forth.  For the example above, the
  50. output file will be an MPW binary file named "a.out".
  51.  
  52. The GCC manual includes full information on the available options.
  53. One option that may be especially useful is "-v", which shows you what
  54. tools and options are being used; unlike MPW C, GCC directs assembly
  55. and linking in addition to compilation.
  56.  
  57. To find standard include files you can set the variable GCCIncludes:
  58.  
  59.     set GCCIncludes MyDisk:MyIncludes:
  60.     export GCCIncludes
  61.  
  62. GCCIncludes is similar to MPW's CIncludes or CW's MWCIncludes.  In
  63. order to use MPW's usual include files, just say:
  64.  
  65.     set GCCIncludes "{CIncludes}"
  66.     export GCCIncludes
  67.  
  68. The assembler ("as") and linker ("ld") are faithful ports of their
  69. Unix counterparts.  Similarly, the binutils "ar", "cplusfilt", "nm",
  70. "objcopy", "objdump", "ranlib", "size", "strings", and "strip" are all
  71. like they are under Unix.  (Note that "cplusfilt" is actually called
  72. "c++filt" under Unix.)
  73.  
  74. There are two flavors of GDB.  "gdb" is an MPW tool that works very
  75. much like it does in Unix; put a command into the MPW worksheet and
  76. type the <enter> key to send it to GDB.  While "gdb" is running, you
  77. cannot do anything else in MPW, although you can switch to other
  78. applications and use them.
  79.  
  80. "SiowGDB" is also a Mac application, but it is GDB using the SIOW
  81. package to provide console emulation.  Commands are exactly as for the
  82. MPW tool, but since this is its own application, you can switch
  83. between it and MPW.
  84.  
  85. Currently, both flavors of GDB can only do cross-debugging, via the
  86. serial port.
  87.  
  88.  
  89. BUILDING CYGNUS GNU TOOLS
  90.  
  91. This port of the Cygnus GNU tools uses a configure script similar to
  92. that used for GNU tools under Unix, but rewritten for MPW.  As with
  93. Unix configuration, there is an "object" directory that may be
  94. different from the "source" directory.  In the example commands below,
  95. we will assume that we are currently in the object directory, and that
  96. the source directory is "{Boot}Cygnus:src".
  97.  
  98. In addition to the sources, you will need a set of tools that the
  99. configure and build scripts assume to be available.  These tools
  100. (and their versions, if relevant) are as follows:
  101.  
  102.     byacc tool
  103.     flex (2.3.7) tool (and Flex.skel file)
  104.     forward-include script
  105.     MoveIfChange script
  106.     mpw-touch script
  107.     mpw-true script
  108.     null-command script
  109.     open-brace script
  110.     sed (1.13) tool
  111.     tr-7to8 script
  112.     true script
  113.  
  114. The scripts are in the sources, under utils:mpw:. You must arrange to
  115. get the other tools yourself (they are readily available from the
  116. "usual" net sites, and are also on many CDROMS).  In addition, there
  117. will usually be a set of these available at ftp.cygnus.com, in pub/mac.
  118.  
  119. You may put the build tools in your usual Tools or Scripts
  120. directories, or keep them in a separate directories.  We prefer to
  121. make a directory called "buildtools" and we put this in our
  122. UserStartup:
  123.  
  124.     set Commands "{Boot}Cygnus:buildtools:,{Commands}"
  125.  
  126. Flex uses an environment variable FLEX_SKELETON to locate its skeleton
  127. file, so you need to do something like this, preferably in UserStartup:
  128.  
  129.     Set FLEX_SKELETON "{Boot}"Cygnus:buildtools:Flex.skel
  130.     Export FLEX_SKELETON
  131.  
  132. To build everything, setdirectory to the object directory and do:
  133.  
  134.     {Boot}Cygnus:src:mpw-configure --target <name> --cc <compiler> --srcdir {Boot}Cygnus:src: --prefix <whatever>
  135.  
  136. If the the source directory is not in your {Commands} list, then you must
  137. supply a full pathname to mpw-configure, since mpw-configure invokes
  138. itself after switching into each subdirectory.  Using a relative
  139. pathname, even something like ':mpw-configure', will therefore not work.
  140.  
  141. <name> must be a known target.  Valid ones include "m68k-apple-macos",
  142. "powerpc-apple-macos", "i386-unknown-go32", "mips-idt-ecoff", and
  143. "sh-hitachi-hms".  Not all target types are accepted for all of the
  144. tools yet.
  145.  
  146. <compiler> must be the name of the compiler to use.  It defaults to "mpwc".
  147.  
  148.     (m68k)
  149.     mpwc    MPW C
  150.     sc68k    Symantec C
  151.     mwc68k    Metrowerks C (Codewarrior)
  152.     gcc68k    GCC
  153.  
  154.     (powerpc)
  155.     ppcc    PPCC
  156.     mrc    Macintosh on RisC (Mister C, aka(?) Frankenstein)
  157.     scppc    Symantec C
  158.     mwcppc    Metrowerks C (Codewarrior)
  159.     gccppc    GCC
  160.  
  161. Not all compilers will compile all tools equally well!  For m68k Macs,
  162. MPW C has the best record so far (it has problems, but they can be
  163. worked around), while for PowerMacs, CodeWarrior is the only compiler
  164. that has successfully compiled everything into running code.
  165.  
  166. <prefix> is the path that "gcc" will prepend when looking for tools
  167. to execute.
  168.  
  169. Then the command
  170.  
  171.     mpw-build
  172.  
  173. will build everything, and
  174.  
  175.     mpw-build install
  176.  
  177. will install it.  Building will take over an hour on a Quadra 800.
  178.  
  179. If you use CodeWarrior, you *must* set MWCIncludes to {CIncludes}.
  180. This is because you will be building MPW tools, and their standard I/O
  181. works by making references to data that is part of the MPW Shell,
  182. which means that the code must be compiled and linked with macros
  183. that refer to that data, and those macros are in {CIncludes}, not
  184. the default {MWCIncludes}.  Without this change, you will encounter
  185. problems compiling libiberty/mpw.c, but tweaking that file only
  186. masks the real problem, and does not fix it.
  187.  
  188. Most versions of MPW C have problems with compiling GNU software.
  189.  
  190. MPW C 3.2.x has preprocessing bugs that render it incapable of
  191. compiling the BFD library, so it can't be used at all for building BFD.
  192.  
  193. MPW C 3.3, 3.3.1, and 3.3.2 will spontaneously claim to have found
  194. errors in the source code, but in fact the code is perfectly fine.  If
  195. this happens, just set the working directory back to the top-level
  196. objdir (where the configure command above was performed), and type
  197. "mpw-build all" again.  If it goes on through the supposed error, then
  198. you got one of the spurious errors.  A full build may require a number
  199. of these restarts.
  200.  
  201. MPW C 3.3.3 seems to work OK, at least with the aid of a number of
  202. workarounds that are in the sources (look for #ifdef MPW_C).
  203.  
  204. Versions of MPW Make earlier than 4.0d2 have exhibited bizarre behavior,
  205. failure to substitute variables and the like.
  206.  
  207. Metrowerks CW6 PPC linker (MWLinkPPC) seems to do bad things with memory
  208. if the "Modern Memory Manager" is turned on (in the Memory control panel),
  209. but works OK if it is turned off.
  210.  
  211. Metrowerks CW6 loses bigtime compiling opcodes:ppc-opc.c, which has
  212. some deeply nested macros.  (CW7 is OK.)  There is a way to patch the
  213. file, by substituting constant values.  If you need to do this,
  214. contact shebs@cygnus.com for details.
  215.  
  216. <Gestalt.h> is missing from {CIncludes} in the MPW version that comes
  217. with CW 7.  You can just copy the one in CW7's {MWCIncludes}.
  218.  
  219. KNOWN BUGS
  220.  
  221. '/' or ' ' embedded in any device, directory, or file name may or may not work.
  222.  
  223. objcopy -O srec foo.o makes random output filenames.
  224.  
  225. Mac-x-mips requires -mgas but Unix hosts don't.
  226.  
  227. GDB will frequently require a '/' on the front of a device name in order
  228. to recognize it as an absolute rather than a relative pathname.
  229.  
  230. GDB doesn't seem to use the printer port correctly, although it tries.
  231.  
  232. The cursor doesn't always spin as much as it should.  To get elaborate
  233. statistics and warnings about spin rates, add this to UserStartup:
  234.  
  235.     set MEASURE_SPIN all
  236.     export MEASURE_SPIN
  237.  
  238. This is not a bug, but - watch out for cr/nl translation!  For instance,
  239. if config/mpw-mh-mpw is not properly translated because it has been
  240. copied or updated separately, then everything will almost build, but
  241. you will get puzzling error messages from make or the compiler.
  242.