1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
|
Building a PPC NetHack 3.4 with the Metrowerks compilers
You must be familiar with the Metrowerks compiler and know how to construct
projects. The NetHack source may come with the four pre-made projects that
are needed to build NetHack and the files it needs. These four projects are
in :sys:mac and are MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u. If you
do not have them, or wish to construct them yourself, see the section "Project
Contents" below.
1. Move the projects MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u to the
top level of the NetHack tree. If you are building your own, create each
project as needed, in the order given below.
2. Create a folder "lib" in the top level. This is where the files used by
NetHack will be deposited by MakeDefs, DgnComp, and LevComp.
3. Build and run MakeDefs.
You will be presented with a list of options. Initially choose them all (the
default). Later you may wish to only run a few of them. The options are
"odemvpqrhz", each of which makes a file:
-o creates :include:onames.h
-p creates :include:pm.h
-z creates :src:vis_tab.c
-m creates :src:monstr.c
-e creates :dat:dundeon.pdf
-v creates :lib:options
-d creates :lib:data
-r creates :lib:rumors
-h creates :lib:oracles
-q creates :lib:quest.dat
4. If you are _not_ using DLB, follow these directions. As of v3.3, DLB is ON
for the Mac. Copy the following files. You may want to change News or NHDeflts.
a. copy ':sys:mac:MacHelp' to ':lib:MacHelp'
b. copy ':sys:mac:News' to ':lib:News'
c. copy ':sys:mac:NHDeflts' to ':lib:NetHack Defaults'
d. copy ':dat:cmdhelp' to ':lib:cmdhelp'
e. copy ':dat:help' to ':lib:help'
f. copy ':dat:hh' to 'lib:hh'
g. copy ':dat:history' to ':lib:history'
h. copy ':dat:license' to ':lib:license'
i. copy ':dat:opthelp' to ':lib:opthelp'
j. copy ':dat:wizhelp' to ':lib:wizhelp'
5. Create an empty file, ':lib:record'
6. Build and run DgnComp.
This will create a file "dungeon" in the lib directory.
7. Build and run LevComp.
This will build the level files (*.lev) in the lib directory.
8. Build NetHack.
Move NetHack in the lib directory.
------------------------
Building NetHack with MetroWerks IDE 1.x (DR7-DR10, DR11 was never used)
To build NetHack, you will need to create four projects at the top level of
the NetHack directory tree. These four projects are MakeDefs.u, DgnComp.u,
LevComp.u, and NetHack.u. The projects don't have to end in ".u", but you
should append some form of ".XXX" to the end of the project's name to
distinguish the project from the executable that it produces. The files
and libraries to include in these projects are listed in the "Project
Contents" section below. You must create and run Makedefs before creating
NetHack because MakeDefs will create files used by NetHack.
Use the MacOS C/C++ template for each of the projects. The libraries included
will be overkill for all the projects (e.g. the C++ libraries are not needed).
Add the .c and resource files as indicated below. Unless otherwise noted, the
projects can use the default preferences:
Font
The tabbing on all non-mac files is 8. All mac files have a
tab of 4.
PPC Processor
All projects must have the same alignment to build a consistent
NetHack. To share save files with 68K, the alignments
must match for their projects, as well.
Turn on Global Optimization (official version is compiled
with level 1). If you don't turn it on, some files may
not compile because of register overflow. [NetHack
only]
PPC Project
Set name to <MakeDefs, LevComp DgnComp, NetHack>
Other settings [NetHack only]
creator: nh31
preferred heap size:2500
minimum heap size: 2000
stack size: 128 [PPC only]
The SIOUX library may be replaced with console.stubs.c for the NetHack
project.
NOTE: As NetHack 3.3, you must turn on OLDROUTINENAMES -- so you can't use
the default pre-compiled header. You should either remove it from the
preferences or insert another precompiled header that has this define off.
------------------------
Building NetHack with MetroWerks IDE 2.0.
This is for building a PowerPC version only. This doesn't take advantage
of the IDE's subprojects. These will be investigated later.
MakeDefs.u, DgnComp.u, LevComp.u: Select ANSI C Console PPC.
Settings:
PPC Target
+ Change File Name to MakeDefs, DgnComp, or LevComp respectively.
C/C++ Language
+ Turn off ANSI strict, ANSI Keywords Only, Expand Trigraphs
PPC Processor
+ Turn on global optimization (at least to level 1)
NetHack.u: Basic ToolBox PPC
PPC Target
+ Change File Name to NetHack. Other settings
creator: nh31
preferred heap size:2500
minimum heap size: 2000
stack size: 128 [PPC only]
C/C++ Language
+ Options ANSI strict, ANSI Keywords Only, Expand Trigraphs
are already turned off, so you don't have to do anything.
PPC Processor
+ Turn on global optimization (at least to level 1)
------------------------
Creating projects for NetHack with MetroWerks IDE 3.3 (Pro 4)
This is what I changed from the default settings when creating a 68K version. Some of
the settings may not be necessary. For example, NetHack doesn't use floating point,
so I didn't have to check 8 byte doubles. Some are interrelated. For example, the
codegen and the Math and MSL libraries used.
For MakeDefs.u, DgnComp.u, LevComp.u:
1. Select File>>New Project...>>MacOS>>C_C++>>Standard Console>>Std C Console 68K
2. 68K Settings:
Target Settings:
+ Set "Target Name" to {MakeDefs,DgnComp,LevComp}.
68K Target:
+ Set "File Name" to {MakeDefs,DgnComp,LevComp}.
C/C++ Language:
+ Check Require Function Prototypes, uncheck everything else.
+ Clear "Prefix File".
68K Processor:
+ Set "Code Model" to Large.
+ Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
Far String Constants. Uncheck everything else.
3. Libraries 68K
+ Remove the C++ Library (it is not needed).
+ Change math library to MathLib68K Fa(4i_8d).Lib.
+ Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
Note: The actual libraries used must match the CodeGen options in 68K Processor.
For NetHack.u:
1. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K
2. 68K Settings
Target Settings:
+ Set "Target Name" to NetHack Debug and NetHack Final.
68K Target:
+ Set "File Name" to NetHack Debug and NetHack Final.
+ Set "Creator" to 'nh31'.
+ Set "Preferred Heap Size (k)" to 2500.
+ Set "Minimum Heap Size (k)" to 1500.
C/C++ Language:
+ Check Require Function Prototypes, uncheck everything else.
+ Set "Prefix File" to LocalDefines.h. I use this header to define
OLDROUTINENAMES because the pre-compiled header doesn't have it set
any more. One of these days we'll fix up the code...
68K Processor:
+ Set "Code Model" to Large.
+ Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
Far String Constants. Uncheck everything else.
3. Libraries 68K
+ Remove the C++ Library (it is not needed).
+ Change math library to MathLib68K Fa(4i_8d).Lib.
+ Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
Note: The actual libraries used must match the CodeGen options in 68K Processor.
For Recover.u:
1. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K
2. 68K Settings
Target Settings:
+ Set "Target Name" to Recover Debug and Recover Final.
68K Target:
+ Set "File Name" to Recover Debug and Recover Final.
+ Set "Creator" to 'nhRc'.
C/C++ Language:
+ Check Require Function Prototypes, uncheck everything else.
+ Set "Prefix File" to LocalDefines.h. I use this header to define
OLDROUTINENAMES because the pre-compiled header doesn't have it set
any more. One of these days we'll fix up the code...
68K Processor:
+ Set "Code Model" to Large.
+ Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables,
Far String Constants. Uncheck everything else.
3. Libraries 68K
+ Remove the C++ Library (it is not needed).
+ Change math library to MathLib68K Fa(4i_8d).Lib.
+ Change MSL C library to MSL C.68K Fa(4i_8d).Lib.
Note: The actual libraries used must match the CodeGen options in 68K Processor.
------------------------
Project Contents:
MakeDefs.u should contain the following source files:
src
objects.c
monst.c
util
makedefs.c
DgnComp.u should contain the following source files:
src
alloc.c
sys:share
dgn_lex.c
dgn_yacc.c
util
dgn_main.c
panic.c
LevComp.u should contain the following source files:
src
alloc.c
decl.c
drawing.c
monst.c
objects.c
sys:mac
macerrs.c
macfile.c
sys:share
lev_lex.c
lev_yacc.c
util
lev_main.c
panic.c
NetHack.u should contain the following source files:
src
*.c [can do an add all]
sys:mac
*.c except mrecover.c
NetHack.rsrc
machelp.bh [for baloon help]
Sound.rsrc [if you wish to have a few, crude sounds]
Files.r [if you use DLB (on by default)]
sys:share
random.c
win:tty
*.c [can do an add all - termcap.c is not needed, but will compile to nothing]
Note: src:monstr.c and src:vis_tab.c are created by MakeDefs -m and -s
respectively.
Recover.u should contain the following source files:
sys:mac
mrecover.c
mrecover.rsrc
|