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 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
|
# Makefile for NetHack's utility programs.
# SCCS Id: @(#)Makefile.utl 3.2 96/05/09
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone
# wants to (or has to) use something other than the standard make, so we do
# not want to unconditionally set $(MAKE) here
#
# unfortunately, some older makes do not predefine $(MAKE); if you have one of
# these, uncomment the following line
# (you will know that you have one if you get complaints about unable to
# execute things like 'foo.o')
# MAKE = make
# if you are using gcc as your compiler,
# uncomment the CC definition below if it's not in your environment
CC = gcc
#
# For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
#
# CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
#
# If you are using GCC 2.2.2 or higher on a DPX/2, just use:
#
# CC = gcc -ansi
#
# if your make doesn't define a default SHELL properly, you may need
# the line below (Atari users will need a bourne work-alike)
# SHELL = /bin/sh
# flags may have to be changed as required
# flags for 286 Xenix:
# CFLAGS = -Ml2t16 -O -LARGE -I../include
# LFLAGS = -Ml -F 4000 -SEG 512
# flags for 286 Microport SysV-AT
# CFLAGS = -DDUMB -Ml -I../include
# LFLAGS = -Ml
# flags for Atari GCC
# CFLAGS = -O -I../include
# LFLAGS = -s
# flags for Apollos using their native cc
# (as long as it claims to be __STDC__ but isn't)
# CFLAGS = -DAPOLLO -O -I../include
# flags for AIX 3.1 cc on IBM RS/6000 to define
# a suitable subset of standard libraries
# (note that there is more info regarding the "-qchars=signed"
# switch in file Install.unx note 8)
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
# and for AIX 3.2:
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -D_ALL_SOURCE -O -I../include -qchars=signed
# flags for A/UX 2.01 using native cc or c89
# gcc predefines AUX so that's not needed there
# CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
# flags for IRIX 4.0.x using native cc
# SGI cc 3.10 will fail to compile makedefs with -O
# CFLAGS = -I../include -D__STDC__ -woff 100,293
# flags for Linux
# compile normally
# CFLAGS = -O2 -fomit-frame-pointer -I../include -I/usr/X11/include
# LFLAGS = -L/usr/X11/lib
# OR compile backwards compatible a.out format
# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include -I/usr/X11/include
# LFLAGS = -b i486-linuxaout -L/usr/X11/lib
# flags for BeBox using the command line
# remember to uncomment flex and bison below
#CC = mwcc
#CFLAGS = -I../include
# flags for debugging:
# CFLAGS = -g -I../include
CFLAGS = -O2 -I../include
LFLAGS = -s
# yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
# if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
# YACC = yacc
# LEX = lex
YACC = bison -y
# YACC = byacc
LEX = flex
# these are the names of the output files from YACC/LEX. Under MS-DOS
# and similar systems, they may differ
YTABC = y.tab.c
YTABH = y.tab.h
LEXYYC = lex.yy.c
# YTABC = y_tab.c
# YTABH = y_tab.h
# LEXYYC = lexyy.c
# Nothing below this line should have to be changed.
# utility .c files
MAKESRC = makedefs.c
SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c panic.c
DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c
RECOVSRC = recover.c
DLBSRC = dlb_main.c
UTILSRCS = $(MAKESRC) $(SPLEVSRC) $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC)
# object files for makedefs
MAKEOBJS = makedefs.o ../src/monst.o ../src/objects.o
# object files that provide access to NetHack's names
NAMEOBJS = ../src/drawing.o ../src/decl.o ../src/monst.o ../src/objects.o
# object files for special levels compiler
SPLEVOBJS = lev_yacc.o lev_lex.o lev_main.o panic.o \
../src/alloc.o $(NAMEOBJS)
# object files for dungeon compiler
DGNCOMPOBJS = dgn_yacc.o dgn_lex.o dgn_main.o panic.o ../src/alloc.o
# object files for recovery utility
RECOVOBJS = recover.o
# flags for creating distribution versions of sys/share/*_lex.c, using
# a more portable flex skeleton, which is not included in the distribution.
# hopefully keeping this out of the section to be edited will keep too
# many people from being confused by it...
# FLEXDIST = -L # -S../sys/share/flexhack.skel
FLEXDIST =
#
# flags for creating distribution versions of sys/share/*_yacc.c, without
# line numbers so patches from version to version are practical
# YACCDIST = -l
YACCDIST =
# dependencies for makedefs
#
makedefs: $(MAKEOBJS)
$(CC) $(LFLAGS) -o makedefs $(MAKEOBJS)
makedefs.o: makedefs.c ../include/config.h ../include/permonst.h \
../include/objclass.h ../include/monsym.h \
../include/artilist.h ../include/dungeon.h ../include/obj.h \
../include/monst.h ../include/you.h ../include/flag.h \
../include/patchlevel.h ../include/qtext.h
../include/onames.h: makedefs
./makedefs -o
../include/pm.h: makedefs
./makedefs -p
../src/monstr.c: makedefs
./makedefs -m
../include/vis_tab.h: makedefs
./makedefs -z
../src/vis_tab.c: makedefs
./makedefs -z
lintdefs:
@lint -axbh -I../include -DLINT $(MAKESRC) ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
# we defer this makedefs call to the src Makefile, since it knows all about
# the main src and include files date.h is a timestamp for
../include/date.h::
@( cd ../src ; $(MAKE) ../include/date.h )
# dependencies for lev_comp
#
lev_comp: $(SPLEVOBJS)
$(CC) $(LFLAGS) -o lev_comp $(SPLEVOBJS)
lev_yacc.o: ../include/hack.h ../include/sp_lev.h
lev_main.o: ../include/hack.h ../include/sp_lev.h ../include/termcap.h \
../include/date.h
panic.o: ../include/config.h
# see lev_comp.l for WEIRD_LEX discussion
# egrep will return failure if it doesn't find anything, but we know there
# is one "_cplusplus" inside a comment
lev_lex.o: ../include/hack.h ../include/lev_comp.h ../include/sp_lev.h lev_lex.c
@echo $(CC) -c $(CFLAGS) lev_lex.c
@$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus lev_lex.c` lev_lex.c
../include/lev_comp.h: lev_yacc.c
lev_yacc.c: lev_comp.y
$(YACC) $(YACCDIST) -d lev_comp.y
mv $(YTABC) lev_yacc.c
mv $(YTABH) ../include/lev_comp.h
lev_lex.c: lev_comp.l
$(LEX) $(FLEXDIST) lev_comp.l
mv $(LEXYYC) lev_lex.c
# with all of extern.h's functions to complain about, we drown in
# 'defined but not used' without -u
lintlev:
@lint -axhu -I../include -DLINT $(SPLEVSRC) ../src/alloc.c ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
# dependencies for dgn_comp
#
dgn_comp: $(DGNCOMPOBJS)
$(CC) $(LFLAGS) -o dgn_comp $(DGNCOMPOBJS)
dgn_yacc.o: ../include/config.h ../include/dgn_file.h ../include/date.h
dgn_main.o: ../include/config.h
# see dgn_comp.l for WEIRD_LEX discussion
dgn_lex.o: ../include/config.h ../include/dgn_comp.h ../include/dgn_file.h dgn_lex.c
@echo $(CC) -c $(CFLAGS) dgn_lex.c
@$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus dgn_lex.c` dgn_lex.c
../include/dgn_comp.h: dgn_yacc.c
dgn_yacc.c: dgn_comp.y
$(YACC) $(YACCDIST) -d dgn_comp.y
mv $(YTABC) dgn_yacc.c
mv $(YTABH) ../include/dgn_comp.h
dgn_lex.c: dgn_comp.l
$(LEX) $(FLEXDIST) dgn_comp.l
mv $(LEXYYC) dgn_lex.c
# with all of extern.h's functions to complain about, we drown in
# 'defined but not used' without -u
lintdgn:
@lint -axhu -I../include -DLINT $(DGNCOMPSRC) panic.c ../src/alloc.c | sed '/_flsbuf/d'
# dependencies for recover
#
recover: $(RECOVOBJS)
$(CC) $(LFLAGS) -o recover $(RECOVOBJS)
recover.o: ../include/config.h
# dependencies for dlb
#
dlb: dlb_main.o ../src/dlb.o ../src/alloc.o panic.o
$(CC) $(LFLAGS) -o dlb dlb_main.o ../src/dlb.o ../src/alloc.o panic.o
dlb_main.o: dlb_main.c ../include/config.h ../include/dlb.h
$(CC) $(CFLAGS) -c dlb_main.c
# dependencies for tile utilities
#
TEXT_IO = tiletext.o tiletxt.o $(NAMEOBJS)
GIFREADERS = gifread.o ../src/alloc.o panic.o
PPMWRITERS = ppmwrite.o ../src/alloc.o panic.o
tileutils: tilemap gif2txt txt2ppm tile2x11
gif2txt: $(GIFREADERS) $(TEXT_IO)
$(CC) $(LFLAGS) -o gif2txt $(GIFREADERS) $(TEXT_IO)
txt2ppm: $(PPMWRITERS) $(TEXT_IO)
$(CC) $(LFLAGS) -o txt2ppm $(PPMWRITERS) $(TEXT_IO)
tile2x11: tile2x11.o $(TEXT_IO)
$(CC) $(LFLAGS) -o tile2x11 tile2x11.o $(TEXT_IO)
tilemap: ../win/share/tilemap.c ../include/hack.h
$(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c
../src/tile.c: tilemap
./tilemap
../include/tile.h: ../win/share/tile.h
cp ../win/share/tile.h ../include/tile.h
tiletext.o: ../win/share/tiletext.c ../include/config.h ../include/tile.h
$(CC) $(CFLAGS) -c ../win/share/tiletext.c
tiletxt.o: ../win/share/tilemap.c ../include/hack.h
$(CC) $(CFLAGS) -c -DTILETEXT ../win/share/tilemap.c
mv tilemap.o tiletxt.o
gifread.o: ../win/share/gifread.c ../include/config.h ../include/tile.h
$(CC) $(CFLAGS) -c ../win/share/gifread.c
ppmwrite.o: ../win/share/ppmwrite.c ../include/config.h ../include/tile.h
$(CC) $(CFLAGS) -c ../win/share/ppmwrite.c
tile2x11.o: ../win/X11/tile2x11.c ../include/hack.h ../include/tile.h \
../include/tile2x11.h
$(CC) $(CFLAGS) -c ../win/X11/tile2x11.c
# using dependencies like
# ../src/foo::
# @( cd ../src ; $(MAKE) foo )
# would always force foo to be up-to-date according to the src Makefile
# when it's needed here. unfortunately, some makes believe this syntax
# means foo always changes, instead of foo should always be checked.
# therefore, approximate via config.h dependencies, and hope that anybody
# changing anything other than basic configuration also knows when not
# to improvise things not in the instructions, like 'make makedefs' here
# in util...
# make sure object files from src are available when needed
#
../src/alloc.o: ../src/alloc.c ../include/config.h
@( cd ../src ; $(MAKE) alloc.o )
../src/drawing.o: ../src/drawing.c ../include/config.h
@( cd ../src ; $(MAKE) drawing.o )
../src/decl.o: ../src/decl.c ../include/config.h
@( cd ../src ; $(MAKE) decl.o )
../src/monst.o: ../src/monst.c ../include/config.h
@( cd ../src ; $(MAKE) monst.o )
../src/objects.o: ../src/objects.c ../include/config.h
@( cd ../src ; $(MAKE) objects.o )
../src/dlb.o: ../src/dlb.c ../include/hack.h ../include/dlb.h
@( cd ../src ; $(MAKE) dlb.o )
# make sure hack.h dependencies get transitive information
../include/hack.h: ../include/config.h
@( cd ../src ; $(MAKE) ../include/hack.h )
tags: $(UTILSRCS)
@ctags -tw $(UTILSRCS)
clean:
-rm -f *.o
spotless: clean
-rm -f lev_lex.c lev_yacc.c dgn_lex.c dgn_yacc.c
-rm -f ../include/lev_comp.h ../include/dgn_comp.h
-rm -f ../include/tile.h
-rm -f makedefs lev_comp dgn_comp recover dlb
-rm -f gif2txt txt2ppm tile2x11 tilemap
|