1 Building a PPC NetHack 3.4 with the Metrowerks compilers
4 You must be familiar with the Metrowerks compiler and know how to construct
5 projects. The NetHack source may come with the four pre-made projects that
6 are needed to build NetHack and the files it needs. These four projects are
7 in :sys:mac and are MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u. If you
8 do not have them, or wish to construct them yourself, see the section "Project
12 1. Move the projects MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u to the
13 top level of the NetHack tree. If you are building your own, create each
14 project as needed, in the order given below.
16 2. Create a folder "lib" in the top level. This is where the files used by
17 NetHack will be deposited by MakeDefs, DgnComp, and LevComp.
19 3. Build and run MakeDefs.
21 You will be presented with a list of options. Initially choose them all (the
22 default). Later you may wish to only run a few of them. The options are
23 "odemvpqrhz", each of which makes a file:
25 -o creates :include:onames.h
26 -p creates :include:pm.h
27 -z creates :src:vis_tab.c
28 -m creates :src:monstr.c
29 -e creates :dat:dundeon.pdf
30 -v creates :lib:options
32 -r creates :lib:rumors
33 -h creates :lib:oracles
34 -q creates :lib:quest.dat
37 4. If you are _not_ using DLB, follow these directions. As of v3.3, DLB is ON
38 for the Mac. Copy the following files. You may want to change News or NHDeflts.
40 a. copy ':sys:mac:MacHelp' to ':lib:MacHelp'
41 b. copy ':sys:mac:News' to ':lib:News'
42 c. copy ':sys:mac:NHDeflts' to ':lib:NetHack Defaults'
44 d. copy ':dat:cmdhelp' to ':lib:cmdhelp'
45 e. copy ':dat:help' to ':lib:help'
46 f. copy ':dat:hh' to 'lib:hh'
47 g. copy ':dat:history' to ':lib:history'
48 h. copy ':dat:license' to ':lib:license'
49 i. copy ':dat:opthelp' to ':lib:opthelp'
50 j. copy ':dat:wizhelp' to ':lib:wizhelp'
52 5. Create an empty file, ':lib:record'
54 6. Build and run DgnComp.
55 This will create a file "dungeon" in the lib directory.
57 7. Build and run LevComp.
58 This will build the level files (*.lev) in the lib directory.
61 Move NetHack in the lib directory.
64 ------------------------
67 Building NetHack with MetroWerks IDE 1.x (DR7-DR10, DR11 was never used)
70 To build NetHack, you will need to create four projects at the top level of
71 the NetHack directory tree. These four projects are MakeDefs.u, DgnComp.u,
72 LevComp.u, and NetHack.u. The projects don't have to end in ".u", but you
73 should append some form of ".XXX" to the end of the project's name to
74 distinguish the project from the executable that it produces. The files
75 and libraries to include in these projects are listed in the "Project
76 Contents" section below. You must create and run Makedefs before creating
77 NetHack because MakeDefs will create files used by NetHack.
79 Use the MacOS C/C++ template for each of the projects. The libraries included
80 will be overkill for all the projects (e.g. the C++ libraries are not needed).
81 Add the .c and resource files as indicated below. Unless otherwise noted, the
82 projects can use the default preferences:
85 The tabbing on all non-mac files is 8. All mac files have a
88 All projects must have the same alignment to build a consistent
89 NetHack. To share save files with 68K, the alignments
90 must match for their projects, as well.
91 Turn on Global Optimization (official version is compiled
92 with level 1). If you don't turn it on, some files may
93 not compile because of register overflow. [NetHack
96 Set name to <MakeDefs, LevComp DgnComp, NetHack>
97 Other settings [NetHack only]
99 preferred heap size:2500
100 minimum heap size: 2000
101 stack size: 128 [PPC only]
104 The SIOUX library may be replaced with console.stubs.c for the NetHack
107 NOTE: As NetHack 3.3, you must turn on OLDROUTINENAMES -- so you can't use
108 the default pre-compiled header. You should either remove it from the
109 preferences or insert another precompiled header that has this define off.
112 ------------------------
115 Building NetHack with MetroWerks IDE 2.0.
117 This is for building a PowerPC version only. This doesn't take advantage
118 of the IDE's subprojects. These will be investigated later.
121 MakeDefs.u, DgnComp.u, LevComp.u: Select ANSI C Console PPC.
124 + Change File Name to MakeDefs, DgnComp, or LevComp respectively.
126 + Turn off ANSI strict, ANSI Keywords Only, Expand Trigraphs
128 + Turn on global optimization (at least to level 1)
130 NetHack.u: Basic ToolBox PPC
132 + Change File Name to NetHack. Other settings
134 preferred heap size:2500
135 minimum heap size: 2000
136 stack size: 128 [PPC only]
138 + Options ANSI strict, ANSI Keywords Only, Expand Trigraphs
139 are already turned off, so you don't have to do anything.
141 + Turn on global optimization (at least to level 1)
144 ------------------------
145 Creating projects for NetHack with MetroWerks IDE 3.3 (Pro 4)
147 This is what I changed from the default settings when creating a 68K version. Some of
148 the settings may not be necessary. For example, NetHack doesn't use floating point,
149 so I didn't have to check 8 byte doubles. Some are interrelated. For example, the
150 codegen and the Math and MSL libraries used.
152 For MakeDefs.u, DgnComp.u, LevComp.u:
153 1. Select File>>New Project...>>MacOS>>C_C++>>Standard Console>>Std C Console 68K
156 + Set "Target Name" to {MakeDefs,DgnComp,LevComp}.
158 + Set "File Name" to {MakeDefs,DgnComp,LevComp}.
160 + Check Require Function Prototypes, uncheck everything else.
161 + Clear "Prefix File".
163 + Set "Code Model" to Large.
164 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
165 Far String Constants. Uncheck everything else.
167 + Remove the C++ Library (it is not needed).
168 + Change math library to MathLib68K Fa(4i_8d).Lib.
169 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
170 Note: The actual libraries used must match the CodeGen options in 68K Processor.
174 1. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K
177 + Set "Target Name" to NetHack Debug and NetHack Final.
179 + Set "File Name" to NetHack Debug and NetHack Final.
180 + Set "Creator" to 'nh31'.
181 + Set "Preferred Heap Size (k)" to 2500.
182 + Set "Minimum Heap Size (k)" to 1500.
184 + Check Require Function Prototypes, uncheck everything else.
185 + Set "Prefix File" to LocalDefines.h. I use this header to define
186 OLDROUTINENAMES because the pre-compiled header doesn't have it set
187 any more. One of these days we'll fix up the code...
189 + Set "Code Model" to Large.
190 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
191 Far String Constants. Uncheck everything else.
193 + Remove the C++ Library (it is not needed).
194 + Change math library to MathLib68K Fa(4i_8d).Lib.
195 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
196 Note: The actual libraries used must match the CodeGen options in 68K Processor.
200 1. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K
203 + Set "Target Name" to Recover Debug and Recover Final.
205 + Set "File Name" to Recover Debug and Recover Final.
206 + Set "Creator" to 'nhRc'.
208 + Check Require Function Prototypes, uncheck everything else.
209 + Set "Prefix File" to LocalDefines.h. I use this header to define
210 OLDROUTINENAMES because the pre-compiled header doesn't have it set
211 any more. One of these days we'll fix up the code...
213 + Set "Code Model" to Large.
214 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
215 Far String Constants. Uncheck everything else.
217 + Remove the C++ Library (it is not needed).
218 + Change math library to MathLib68K Fa(4i_8d).Lib.
219 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
220 Note: The actual libraries used must match the CodeGen options in 68K Processor.
223 ------------------------
227 MakeDefs.u should contain the following source files:
236 DgnComp.u should contain the following source files:
248 LevComp.u should contain the following source files:
267 NetHack.u should contain the following source files:
270 *.c [can do an add all]
272 *.c except mrecover.c
274 machelp.bh [for baloon help]
275 Sound.rsrc [if you wish to have a few, crude sounds]
276 Files.r [if you use DLB (on by default)]
280 *.c [can do an add all - termcap.c is not needed, but will compile to nothing]
282 Note: src:monstr.c and src:vis_tab.c are created by MakeDefs -m and -s
285 Recover.u should contain the following source files: