1#	NetHack Makefile.
2#	SCCS Id: @(#)Makefile.src	3.4	2002/03/02
3
4# newer makes predefine $(MAKE) to 'make' and do smarter processing of
5# recursive make calls if $(MAKE) is used
6# these makes allow $(MAKE) to be overridden by the environment if someone
7# wants to (or has to) use something other than the standard make, so we do
8# not want to unconditionally set $(MAKE) here
9#
10# unfortunately, some older makes do not predefine $(MAKE); if you have one of
11# these, uncomment the following line
12# (you will know that you have one if you get complaints about being unable
13# to find 'makedefs')
14# MAKE = make
15
16# This makefile replaces the previous Makefile.unix, Makefile.xenix,
17# Makefile.3B2, Makefile.att, and Makefile.tos.
18# Set SYSTEM to one of:
19#	'Sysunix'	-- generic UNIX
20#	'Sys3B2'	-- AT&T 3B2, 3B5, etc.
21#	'Sysatt'	-- AT&T UNIXPC, 7300, 3B1
22#	'SysV-AT'	-- Microport 286 UNIX (put -DDUMB in CFLAGS)
23#	'Systos'	-- Atari
24#	'SysBe'		-- BeOS
25SYSTEM = Sysunix
26
27#
28# Make sure that your bourne shell is specified here, as you have to spawn
29# some of the commands (eg. depend) in bourne shell for them to work.
30#
31# For Systos users compiling on the ST, you'll either need a bourne shell
32# clone or you'll need to do make depend, etc. by hand. In either case,
33# the line below probably needs changing
34SHELL=/bin/sh
35# for Atari
36# SHELL=E:/GEMINI2/MUPFEL.TTP
37
38# Normally, the C compiler driver is used for linking:
39LINK=$(CC)
40
41# Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
42# system.
43#
44# for UNIX systems
45SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
46	../sys/unix/unixunix.c ../sys/unix/unixres.c
47SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o
48#
49# for Systos
50# SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
51#	../sys/share/pctty.c ../sys/share/pcunix.c
52# SYSOBJ = tos.o pcmain.o pcsys.o pctty.o pcunix.o
53#
54# for BeOS
55#SYSSRC = ../sys/be/bemain.c ../sys/share/unixtty.c ../sys/share/ioctl.c
56#SYSOBJ = bemain.o unixtty.o ioctl.o
57
58
59# if you are using gcc as your compiler:
60#	uncomment the CC definition below if it's not in your environment
61#	if you get setcgtty() warnings during execution, you are feeding gcc
62#		a non-ANSI <sys/ioctl.h> -- either run fixincludes on it or use
63#		-traditional in CFLAGS
64# CC = gcc
65#
66#	For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
67#
68# CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
69#
70#	If you are using GCC 2.2.2 or higher on a DPX/2, just use:
71#
72# CC = gcc -ansi
73#
74#	For HP/UX 10.20 with GCC:
75# CC = gcc -D_POSIX_SOURCE
76#
77#	For cross-compiling, eg. with gcc on Linux (see also CXX further down):
78# CC = arm-linux-gcc
79#
80#
81# if you're debugging and want gcc to check as much as possible, use:
82# CC = gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
83
84# flags may have to be changed as required
85# flags for 286 Xenix:
86# CFLAGS = -Ml2t16 -O -LARGE -I../include
87# LFLAGS = -Ml -F 4000 -SEG 512
88
89# flags for 286 Microport SysV-AT
90# CFLAGS = -DDUMB -Ml -I../include
91# LFLAGS = -Ml
92
93# flags for Atari gcc (3.2.1)
94# CFLAGS = -O -I../include
95# LFLAGS = -s
96# flags for Atari gcc (3.3)
97# CFLAGS = -mshort -O2 -fomit-frame-pointer -I../include
98# LFLAGS = -mshort -s
99
100# flags for AIX 3.1 cc on IBM RS/6000 to define
101# a suitable subset of standard libraries
102# (note that there is more info regarding the "-qchars=signed"
103# switch in file Install.unx note 8)
104# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
105#
106# Some of our subroutines are complex enough that this is required for full
107# optimization under AIX 3.2 (I don't know about 3.1).
108#
109# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -D_ALL_SOURCE -O -I../include -qchars=signed -qmaxmem=5000
110
111# flags for A/UX 2.01 using native cc or c89
112# gcc predefines AUX so that's not needed there
113# Remember to use -lcurses for WINLIB below !
114# CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
115
116# flags for IRIX 4.0.x using native cc
117# The include files are __STDC__, but have bugs involving const
118# CFLAGS = -O -I../include -D__STDC__ -Dconst= -woff 100,293
119# LFLAGS = -s
120
121# flags for BSD/OS 2.0
122# CFLAGS = -O -I../include -I/usr/X11/include
123# LFLAGS = -L/usr/X11/lib
124
125# flags for Linux
126#   compile normally
127# CFLAGS = -O2 -fomit-frame-pointer -I../include
128# LFLAGS = -L/usr/X11R6/lib
129#   OR compile backwards compatible a.out format
130# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include
131# LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
132
133# flags for BeOS
134#   on a Mac/BeBox:
135#CC = mwcc
136#CFLAGS = -r -I../include
137#LINK = mwld
138#LFLAGS = -map nethack.xMAP
139#   on Intel:
140#CFLAGS = -O -I../include
141#LINK = gcc
142#LFLAGS = -Xlinker -soname=_APP_
143
144# Only used for the Gnome interface.
145# When including the Gnome interface, you need to include gnome specific
146# directories.  The ones given below is the usual spot for linux systems.
147# The paths are for glibconfig.h and gnomesupport.h respectively.
148#
149GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome
150
151# flags for debugging:
152# CFLAGS = -g -I../include
153
154CFLAGS = -O -I../include
155LFLAGS = 
156
157# The Qt and Be window systems are written in C++, while the rest of
158# NetHack is standard C.  If using Qt, uncomment the LINK line here to get
159# the C++ libraries linked in.
160CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include
161CXX=g++
162#LINK=g++
163#	For cross-compiling, eg. with gcc on Linux (see also CC further up):
164#CXX=arm-linux-g++
165#LINK=arm-linux-gcc
166
167# Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
168# combination of windowing systems.  Also set windowing systems in config.h.
169# Note that if you are including multiple tiled window systems, you don't
170# want two copies of tile.o, so comment out all but the first.
171#
172# files for a straight tty port using no native windowing system
173WINTTYSRC = ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
174	../win/tty/wintty.c
175WINTTYOBJ = getline.o termcap.o topl.o wintty.o
176#
177# files for an X11 port
178# (tile.c is a generated source file)
179WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
180	../win/X11/winmap.c  ../win/X11/winmenu.c ../win/X11/winmesg.c \
181	../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \
182	../win/X11/winval.c tile.c
183WINX11OBJ = Window.o dialogs.o winX.o winmap.o winmenu.o winmesg.o \
184	winmisc.o winstat.o wintext.o winval.o tile.o
185#
186# Files for a Qt port
187#
188WINQTSRC = ../win/Qt/qt_win.cpp ../win/Qt/qt_clust.cpp ../win/Qt/qttableview.cpp
189WINQTOBJ = qt_win.o qt_clust.o qttableview.o tile.o
190#
191# Files for a Gnome port
192#
193WINGNOMESRC = ../win/gnome/gnaskstr.c ../win/gnome/gnbind.c \
194	../win/gnome/gnglyph.c ../win/gnome/gnmain.c ../win/gnome/gnmap.c \
195	../win/gnome/gnmenu.c ../win/gnome/gnmesg.c ../win/gnome/gnopts.c \
196	../win/gnome/gnplayer.c ../win/gnome/gnsignal.c \
197	../win/gnome/gnstatus.c ../win/gnome/gntext.c ../win/gnome/gnyesno.c \
198	../win/gnome/gnworn.c
199WINGNOMEOBJ = gnaskstr.o gnbind.o gnglyph.o gnmain.o gnmap.o gnmenu.o \
200	gnmesg.o gnopts.o gnplayer.o gnsignal.o gnstatus.o gntext.o \
201	gnyesno.o gnworn.o tile.o
202#
203# Files for a Gem port
204WINGEMSRC = ../win/gem/wingem.c ../win/gem/wingem1.c ../win/gem/load_img.c \
205	../win/gem/gr_rect.c tile.c
206WINGEMOBJ = wingem.o wingem1.o load_img.o gr_rect.o tile.o
207#
208# Files for a BeOS InterfaceKit port -- not ready for prime time
209WINBESRC =
210WINBEOBJ =
211#WINBESRC = ../win/BeOS/winbe.cpp ../win/BeOS/NHWindow.cpp \
212#	../win/BeOS/NHMenuWindow.cpp ../win/BeOS/NHMapWindow.cpp tile.c
213#WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
214
215#
216#
217WINSRC = $(WINTTYSRC)
218WINOBJ = $(WINTTYOBJ)
219
220# on some systems the termcap library is in -ltermcap or -lcurses
221# on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
222# Sysatt uses shared library in lieu of this option
223# Systos needs -lcurses16 if you use -mshort
224# AIX 3.1 on RS/6000 likes -lcurses if TERMINFO defined in unixconf.h
225# and -ltermcap otherwise
226# Linux uses -lncurses (newer) or -ltermcap (older)
227# Be uses -ltermcap
228#
229# libraries for tty ports
230# WINTTYLIB = -ltermcap
231# WINTTYLIB = -lcurses
232# WINTTYLIB = -lcurses16
233# WINTTYLIB = -lncurses
234WINTTYLIB = -ltermlib
235#
236# libraries for X11
237# If USE_XPM is defined in config.h, you will also need -lXpm here.
238WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
239# WINX11LIB = -lXaw -lXmu -lXt -lX11
240# WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
241# WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0
242#
243# libraries for Qt
244WINQTLIB = -L$(QTDIR)/lib -lqt
245#
246# libraries for KDE (with Qt)
247WINKDELIB = -lkdecore -lkdeui -lXext
248#
249# libraries for Gnome
250WINGNOMELIB = -lgnomeui -lgnome -lart_lgpl -lgtk -lgdk -lpopt
251#
252# libraries for Gem port
253WINGEMLIB = -le_gem -lgem
254#
255# libraries for BeOS 
256WINBELIB = -lbe
257
258WINLIB = $(WINTTYLIB)
259
260# any other strange libraries your system needs (for Sysunix only -- the more
261# specialized targets should already be right)
262#
263# on HP-UX 8.x, the malloc(3x) routines in libmalloc.a seem to align things
264# better than the malloc(3) ones in libc.a
265# LIBS = -lmalloc
266#
267# DPX/2's also use the malloc(3x) routines.  In addition, if you are building
268# for X11, you must include libinet.a.
269# LIBS = -lmalloc -linet
270#
271# Linux NetHack uses some bsd style ioctl functions, thus it is necessary to
272# use the bsd libs.  (Only if still compiling as BSD in unixconf.h; recent
273# versions compile fine using SYSV without this.)
274# LIBS = -lbsd
275#
276# for CYGWIN32 aka cygwin 1.1.1
277# LIBS = -lcygwin
278#
279# Solaris 2.x seems to work with the following
280# LIBS = -lsocket -lnsl
281#
282# IRIX 4.0.x needs -lsun if NIS (YP) is being used for passwd file lookup
283# LIBS = -lsun
284#
285LIBS =
286
287# make NetHack
288GAME     = nethack
289# GAME     = nethack.prg
290
291# if you defined RANDOM in unixconf.h/tosconf.h since your system did not come
292# with a reasonable random number generator
293# RANDOBJ = random.o
294RANDOBJ =
295
296
297# used by `make depend' to reconstruct this Makefile; you shouldn't need this
298AWK	= nawk
299
300# ----------------------------------------
301#
302# Nothing below this line should have to be changed.
303#
304# Other things that have to be reconfigured are in config.h,
305# {unixconf.h, pcconf.h, tosconf.h}, and possibly system.h
306
307MAKEDEFS = ../util/makedefs
308
309# timestamp files to reduce `make' overhead and shorten .o dependency lists
310CONFIG_H = ../src/config.h-t
311HACK_H	= ../src/hack.h-t
312
313# all .c that are part of the main NetHack program and are not operating- or
314# windowing-system specific
315HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
316	   botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
317	   do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
318	   dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
319	   files.c fountain.c hack.c hacklib.c invent.c light.c lock.c \
320	   mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c minion.c \
321	   mklev.c mkmap.c \
322	   mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \
323	   mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \
324	   options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
325	   priest.c quest.c questpgr.c read.c rect.c region.c restore.c rip.c \
326	   rnd.c role.c rumors.c save.c shk.c shknam.c sit.c sounds.c sp_lev.c \
327	   spell.c steal.c steed.c teleport.c timeout.c topten.c track.c trap.c \
328	   u_init.c uhitm.c vault.c version.c vision.c weapon.c were.c wield.c \
329	   windows.c wizard.c worm.c worn.c write.c zap.c
330
331# all operating-system-dependent .c (for dependencies and such)
332SYSCSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
333	../sys/share/pctty.c ../sys/share/pcunix.c ../sys/share/random.c \
334	../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
335	../sys/unix/unixunix.c ../sys/unix/unixres.c ../sys/be/bemain.c
336
337# generated source files (tile.c is handled separately via WINxxxSRC)
338GENCSRC = monstr.c vis_tab.c	#tile.c
339
340# all windowing-system-dependent .c (for dependencies and such)
341WINCSRC = $(WINTTYSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC)
342# all windowing-system-dependent .cpp (for dependencies and such)
343WINCXXSRC = $(WINQTSRC) $(WINBESRC)
344
345# .c files for this version (for date.h)
346VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(GENCSRC)
347
348# .c files for all versions using this Makefile (for lint and tags)
349CSOURCES = $(HACKCSRC) $(SYSSRC) $(WINCSRC) $(GENCSRC)
350
351
352# all .h files except date.h, onames.h, pm.h, and vis_tab.h which would
353# cause dependency loops if run through "make depend"
354# and dgn_comp.h, dgn_file.h, lev_comp.h, special level & dungeon files.
355#
356HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h color.h \
357	config.h config1.h coord.h decl.h def_os2.h display.h dlb.h dungeon.h \
358	edog.h emin.h engrave.h epri.h eshk.h extern.h flag.h func_tab.h \
359	global.h hack.h lev.h macconf.h mfndpos.h micro.h mkroom.h \
360	monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \
361	os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h rm.h \
362	sp_lev.h spell.h system.h tcap.h timeout.h tosconf.h tradstdc.h \
363	trampoli.h trap.h unixconf.h vault.h vision.h vmsconf.h wintty.h \
364	winX.h winprocs.h wintype.h you.h youprop.h
365
366HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h\
367		lev_comp.h dgn_comp.h dgn_file.h
368
369# the following .o's _must_ be made before any others (for makedefs)
370FIRSTOBJ = monst.o objects.o
371
372HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \
373	bones.o botl.o cmd.o dbridge.o decl.o detect.o dig.o display.o dlb.o \
374	do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o \
375	drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \
376	extralev.o files.o fountain.o hack.o hacklib.o invent.o light.o \
377	lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o \
378	minion.o mklev.o mkmap.o \
379	mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o monstr.o \
380	mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o \
381	pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \
382	quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \
383	role.o rumors.o save.o shk.o shknam.o sit.o sounds.o sp_lev.o spell.o \
384	steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o \
385	uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o \
386	wizard.o worm.o worn.o write.o zap.o \
387	$(RANDOBJ) $(SYSOBJ) $(WINOBJ) version.o
388# the .o files from the HACKCSRC, SYSSRC, and WINSRC lists
389
390$(GAME):	$(SYSTEM)
391	@echo "$(GAME) is up to date."
392
393Sysunix:	$(HOBJ) Makefile
394	@echo "Loading ..."
395	$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS)
396	@touch Sysunix
397
398Sys3B2:	$(HOBJ) Makefile
399	@echo "Loading ..."
400	@$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) -lmalloc
401	@touch Sys3B2
402
403Sysatt:	$(HOBJ) Makefile
404	@echo "Loading ..."
405	@$(LD) $(LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAME) $(HOBJ)
406	@touch Sysatt
407
408Systos:	$(HOBJ) Makefile
409	@echo "Loading ..."
410	@$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB)
411	@touch Systos
412
413SysV-AT:	DUMB.Setup $(HOBJ) Makefile
414	@echo "Loading ..."
415	@$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB)
416	@touch SysV-AT
417
418SysBe: $(HOBJ) Makefile
419	@echo "Loading ..."
420	@$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS)
421	@xres -o $(GAME) ../win/BeOS/nethack.rsrc
422	@mimeset -f $(GAME)
423	@touch SysBe
424
425DUMB.Setup:	../include/extern.h
426	cp ../include/extern.h ../include/extern.h.BAK
427	cat ../include/extern.h | \
428		sed -e '/^E\ int\ /!b' \
429			-e '/[^;/ 	]$$/N' \
430			-e '/[(][*]occupation[)]/b' \
431			-e '/[(][*]afternmv[)]/b' \
432			-e '/float_down/b' \
433			-e '/done1/b' \
434			-e '/identify/b' \
435			-e '/Hear_again/b' \
436			-e '/hangup/b' \
437			-e 's/^\(.*\)$$/\/\* \1 \/\*\*\//' | \
438		sed -e '/^E\ void\ /!b' \
439			-e '/[^;/ 	]$$/N' \
440			-e 's/^\(.*\)$$/\/\* \1 \/\*\*\//' \
441				>../include/extern.DUMB
442	cp ../include/extern.DUMB ../include/extern.h
443	@touch DUMB.Setup
444
445all:	$(GAME)
446
447
448#	dependencies for makedefs and its outputs, which the util
449#	Makefile is responsible for keeping up to date
450#
451
452# special rules, to force update of makedefs, real dependencies should be
453# below in the 'make depend' output.
454monst.o:
455	$(CC) $(CFLAGS) -c monst.c
456	@rm -f $(MAKEDEFS)
457
458objects.o:
459	$(CC) $(CFLAGS) -c objects.c
460	@rm -f $(MAKEDEFS)
461
462# Qt windowport meta-object-compiler output
463qt_kde0.moc: ../include/qt_kde0.h
464	$(QTDIR)/bin/moc -o qt_kde0.moc ../include/qt_kde0.h
465
466qt_win.moc: ../include/qt_win.h
467	$(QTDIR)/bin/moc -o qt_win.moc ../include/qt_win.h
468
469qttableview.moc: ../include/qttableview.h
470	$(QTDIR)/bin/moc -o qttableview.moc ../include/qttableview.h
471
472$(MAKEDEFS): ../util/makedefs.c  $(CONFIG_H) ../include/permonst.h \
473		../include/objclass.h ../include/monsym.h \
474		../include/artilist.h ../include/dungeon.h ../include/obj.h \
475		../include/monst.h ../include/you.h ../include/flag.h \
476		../include/dlb.h ../include/patchlevel.h ../include/qtext.h
477	@( cd ../util ; $(MAKE) makedefs)
478
479../include/onames.h: $(MAKEDEFS)
480	@( cd ../util ; $(MAKE) ../include/onames.h )
481../include/pm.h: $(MAKEDEFS)
482	@( cd ../util ; $(MAKE) ../include/pm.h )
483monstr.c: $(MAKEDEFS)
484	@( cd ../util ; $(MAKE) ../src/monstr.c )
485../include/vis_tab.h: $(MAKEDEFS)
486	@( cd ../util ; $(MAKE) ../include/vis_tab.h )
487# makedefs -z makes both vis_tab.h and vis_tab.c, but writes the .h first
488vis_tab.c: ../include/vis_tab.h
489tile.c: ../win/share/tilemap.c $(HACK_H)
490	@( cd ../util ; $(MAKE) ../src/tile.c )
491
492../win/gnome/gn_rip.h: ../win/X11/rip.xpm
493	cp ../win/X11/rip.xpm ../win/gnome/gn_rip.h
494
495#	date.h should be remade any time any of the source or include code
496#	is modified.  Unfortunately, this would make the contents of this
497#	file far more complex.  Since "hack.h" depends on most of the include
498#	files, we kludge around this by making date.h dependent on hack.h,
499#	even though it doesn't include this file.
500#
501#	hack.h depends on makedefs' output, so we know makedefs will be
502#	up to date before being executed
503../include/date.h:	$(VERSOURCES) $(HACK_H)
504	../util/makedefs -v
505
506
507lint:
508# lint cannot have -p here because (i) capitals are meaningful:
509# [Ww]izard, (ii) identifiers may coincide in the first six places:
510# doweararm() versus dowearring().
511# _flsbuf comes from <stdio.h>, a bug in the system libraries.
512	@echo lint -axbh -DLINT ...
513	@lint -axbh -I../include -DLINT $(CSOURCES) | sed '/_flsbuf/d'
514
515
516tags: $(CSOURCES)
517	@echo ctags -tw ...
518	@ctags -tw $(CSOURCES)
519	@( cd ../include ; ctags -tw $(HSOURCES) )
520	@( cd ../util ; $(MAKE) tags )
521
522clean:
523	-rm -f *.o $(HACK_H) $(CONFIG_H)
524
525spotless: clean
526	-rm -f a.out core $(GAME) Sys*
527	-rm -f ../include/date.h ../include/onames.h ../include/pm.h
528	-rm -f monstr.c ../include/vis_tab.h vis_tab.c tile.c *.moc
529	-rm -f ../win/gnome/gn_rip.h
530
531
532depend: ../sys/unix/depend.awk \
533		$(SYSCSRC) $(WINCSRC) $(WINCXXSRC) $(GENCSRC) $(HACKCSRC)
534	$(AWK) -f ../sys/unix/depend.awk ../include/*.h \
535		$(SYSCSRC) $(WINCSRC) $(WINCXXSRC) $(GENCSRC) $(HACKCSRC) >makedep
536	@echo '/^# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT/+2,$$d' >eddep
537	@echo '$$r makedep' >>eddep
538	@echo 'w' >>eddep
539	@cp Makefile Makefile.bak
540	ed - Makefile < eddep
541	@rm -f eddep makedep
542	@echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
543	@echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
544	@echo '# see make depend above' >> Makefile
545	- diff Makefile.bak Makefile
546	@rm -f Makefile.bak
547
548# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT
549
550# config.h timestamp
551$(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \
552		../include/global.h ../include/coord.h ../include/vmsconf.h \
553		../include/system.h ../include/unixconf.h ../include/os2conf.h \
554		../include/micro.h ../include/pcconf.h ../include/tosconf.h \
555		../include/amiconf.h ../include/macconf.h ../include/beconf.h \
556		../include/wceconf.h ../include/ntconf.h ../include/nhlan.h
557	touch $(CONFIG_H)
558# hack.h timestamp
559$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/align.h \
560		../include/dungeon.h ../include/monsym.h ../include/mkroom.h \
561		../include/objclass.h ../include/youprop.h ../include/prop.h \
562		../include/permonst.h ../include/monattk.h \
563		../include/monflag.h ../include/mondata.h ../include/pm.h \
564		../include/wintype.h ../include/decl.h ../include/quest.h \
565		../include/spell.h ../include/color.h ../include/obj.h \
566		../include/you.h ../include/attrib.h ../include/monst.h \
567		../include/skills.h ../include/onames.h ../include/timeout.h \
568		../include/trap.h ../include/flag.h ../include/rm.h \
569		../include/vision.h ../include/display.h ../include/engrave.h \
570		../include/rect.h ../include/region.h ../include/winprocs.h \
571		../include/wintty.h ../include/trampoli.h
572	touch $(HACK_H)
573#
574tos.o: ../sys/atari/tos.c $(HACK_H) ../include/tcap.h
575	$(CC) $(CFLAGS) -c ../sys/atari/tos.c
576pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h \
577		#../include/win32api.h
578	$(CC) $(CFLAGS) -c ../sys/share/pcmain.c
579pcsys.o: ../sys/share/pcsys.c $(HACK_H)
580	$(CC) $(CFLAGS) -c ../sys/share/pcsys.c
581pctty.o: ../sys/share/pctty.c $(HACK_H)
582	$(CC) $(CFLAGS) -c ../sys/share/pctty.c
583pcunix.o: ../sys/share/pcunix.c $(HACK_H)
584	$(CC) $(CFLAGS) -c ../sys/share/pcunix.c
585random.o: ../sys/share/random.c $(HACK_H)
586	$(CC) $(CFLAGS) -c ../sys/share/random.c
587ioctl.o: ../sys/share/ioctl.c $(HACK_H) ../include/tcap.h
588	$(CC) $(CFLAGS) -c ../sys/share/ioctl.c
589unixtty.o: ../sys/share/unixtty.c $(HACK_H)
590	$(CC) $(CFLAGS) -c ../sys/share/unixtty.c
591unixmain.o: ../sys/unix/unixmain.c $(HACK_H) ../include/dlb.h
592	$(CC) $(CFLAGS) -c ../sys/unix/unixmain.c
593unixunix.o: ../sys/unix/unixunix.c $(HACK_H)
594	$(CC) $(CFLAGS) -c ../sys/unix/unixunix.c
595unixres.o: ../sys/unix/unixres.c $(CONFIG_H)
596	$(CC) $(CFLAGS) -c ../sys/unix/unixres.c
597bemain.o: ../sys/be/bemain.c $(HACK_H) ../include/dlb.h
598	$(CC) $(CFLAGS) -c ../sys/be/bemain.c
599getline.o: ../win/tty/getline.c $(HACK_H) ../include/func_tab.h
600	$(CC) $(CFLAGS) -c ../win/tty/getline.c
601termcap.o: ../win/tty/termcap.c $(HACK_H) ../include/tcap.h
602	$(CC) $(CFLAGS) -c ../win/tty/termcap.c
603topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h
604	$(CC) $(CFLAGS) -c ../win/tty/topl.c
605wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h \
606		../include/patchlevel.h ../include/tcap.h
607	$(CC) $(CFLAGS) -c ../win/tty/wintty.c
608Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \
609		$(CONFIG_H)
610	$(CC) $(CFLAGS) -c ../win/X11/Window.c
611dialogs.o: ../win/X11/dialogs.c $(CONFIG_H)
612	$(CC) $(CFLAGS) -c ../win/X11/dialogs.c
613winX.o: ../win/X11/winX.c $(HACK_H) ../include/winX.h ../include/dlb.h \
614		../include/patchlevel.h ../win/X11/nh72icon \
615		../win/X11/nh56icon ../win/X11/nh32icon
616	$(CC) $(CFLAGS) -c ../win/X11/winX.c
617winmap.o: ../win/X11/winmap.c ../include/xwindow.h $(HACK_H) ../include/dlb.h \
618		../include/winX.h ../include/tile2x11.h
619	$(CC) $(CFLAGS) -c ../win/X11/winmap.c
620winmenu.o: ../win/X11/winmenu.c $(HACK_H) ../include/winX.h
621	$(CC) $(CFLAGS) -c ../win/X11/winmenu.c
622winmesg.o: ../win/X11/winmesg.c ../include/xwindow.h $(HACK_H) ../include/winX.h
623	$(CC) $(CFLAGS) -c ../win/X11/winmesg.c
624winmisc.o: ../win/X11/winmisc.c $(HACK_H) ../include/func_tab.h \
625		../include/winX.h
626	$(CC) $(CFLAGS) -c ../win/X11/winmisc.c
627winstat.o: ../win/X11/winstat.c $(HACK_H) ../include/winX.h
628	$(CC) $(CFLAGS) -c ../win/X11/winstat.c
629wintext.o: ../win/X11/wintext.c $(HACK_H) ../include/winX.h ../include/xwindow.h
630	$(CC) $(CFLAGS) -c ../win/X11/wintext.c
631winval.o: ../win/X11/winval.c $(HACK_H) ../include/winX.h
632	$(CC) $(CFLAGS) -c ../win/X11/winval.c
633tile.o: tile.c $(HACK_H)
634gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \
635		../win/gnome/gnmain.h
636	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnaskstr.c
637gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnmain.h \
638		../win/gnome/gnmenu.h ../win/gnome/gnaskstr.h \
639		../win/gnome/gnyesno.h
640	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnbind.c
641gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h ../include/tile2x11.h
642	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnglyph.c
643gnmain.o: ../win/gnome/gnmain.c ../win/gnome/gnmain.h ../win/gnome/gnsignal.h \
644		../win/gnome/gnbind.h ../win/gnome/gnopts.h $(HACK_H) \
645		../include/date.h
646	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnmain.c
647gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h ../win/gnome/gnglyph.h \
648		../win/gnome/gnsignal.h $(HACK_H)
649	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnmap.c
650gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h ../win/gnome/gnmain.h \
651		../win/gnome/gnbind.h ../include/func_tab.h
652	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnmenu.c
653gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h ../win/gnome/gnsignal.h
654	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnmesg.c
655gnopts.o: ../win/gnome/gnopts.c ../win/gnome/gnopts.h ../win/gnome/gnglyph.h \
656		../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H)
657	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnopts.c
658gnplayer.o: ../win/gnome/gnplayer.c ../win/gnome/gnplayer.h \
659		../win/gnome/gnmain.h $(HACK_H)
660	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnplayer.c
661gnsignal.o: ../win/gnome/gnsignal.c ../win/gnome/gnsignal.h \
662		../win/gnome/gnmain.h
663	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnsignal.c
664gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h \
665		../win/gnome/gnsignal.h ../win/gnome/gn_xpms.h \
666		../win/gnome/gnomeprv.h
667	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnstatus.c
668gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \
669		../win/gnome/gn_rip.h
670	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gntext.c
671gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h
672	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnyesno.c
673gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \
674		../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h
675	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnworn.c
676wingem.o: ../win/gem/wingem.c $(HACK_H) ../include/func_tab.h ../include/dlb.h \
677		../include/patchlevel.h ../include/wingem.h
678	$(CC) $(CFLAGS) -c ../win/gem/wingem.c
679wingem1.o: ../win/gem/wingem1.c ../include/gem_rsc.h ../include/load_img.h \
680		../include/gr_rect.h ../include/wintype.h ../include/wingem.h
681	$(CC) $(CFLAGS) -c ../win/gem/wingem1.c
682load_img.o: ../win/gem/load_img.c ../include/load_img.h
683	$(CC) $(CFLAGS) -c ../win/gem/load_img.c
684gr_rect.o: ../win/gem/gr_rect.c ../include/gr_rect.h
685	$(CC) $(CFLAGS) -c ../win/gem/gr_rect.c
686tile.o: tile.c $(HACK_H)
687qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../include/func_tab.h \
688		../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \
689		../include/qt_win.h ../include/qt_clust.h ../include/qt_kde0.h \
690		../include/qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc
691	$(CXX) $(CXXFLAGS) -c ../win/Qt/qt_win.cpp
692qt_clust.o: ../win/Qt/qt_clust.cpp ../include/qt_clust.h
693	$(CXX) $(CXXFLAGS) -c ../win/Qt/qt_clust.cpp
694qttableview.o: ../win/Qt/qttableview.cpp ../include/qttableview.h
695	$(CXX) $(CXXFLAGS) -c ../win/Qt/qttableview.cpp
696monstr.o: monstr.c $(CONFIG_H)
697vis_tab.o: vis_tab.c $(CONFIG_H) ../include/vis_tab.h
698allmain.o: allmain.c $(HACK_H)
699alloc.o: alloc.c $(CONFIG_H)
700apply.o: apply.c $(HACK_H) ../include/edog.h
701artifact.o: artifact.c $(HACK_H) ../include/artifact.h ../include/artilist.h
702attrib.o: attrib.c $(HACK_H)
703ball.o: ball.c $(HACK_H)
704bones.o: bones.c $(HACK_H) ../include/lev.h
705botl.o: botl.c $(HACK_H)
706cmd.o: cmd.c $(HACK_H) ../include/func_tab.h
707dbridge.o: dbridge.c $(HACK_H)
708decl.o: decl.c $(HACK_H)
709detect.o: detect.c $(HACK_H) ../include/artifact.h
710dig.o: dig.c $(HACK_H) ../include/edog.h
711display.o: display.c $(HACK_H)
712dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h
713do.o: do.c $(HACK_H) ../include/lev.h
714do_name.o: do_name.c $(HACK_H)
715do_wear.o: do_wear.c $(HACK_H)
716dog.o: dog.c $(HACK_H) ../include/edog.h
717dogmove.o: dogmove.c $(HACK_H) ../include/mfndpos.h ../include/edog.h
718dokick.o: dokick.c $(HACK_H) ../include/eshk.h
719dothrow.o: dothrow.c $(HACK_H) ../include/edog.h
720drawing.o: drawing.c $(HACK_H) ../include/tcap.h
721dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h
722eat.o: eat.c $(HACK_H)
723end.o: end.c $(HACK_H) ../include/eshk.h ../include/dlb.h
724engrave.o: engrave.c $(HACK_H) ../include/lev.h
725exper.o: exper.c $(HACK_H)
726explode.o: explode.c $(HACK_H)
727extralev.o: extralev.c $(HACK_H)
728files.o: files.c $(HACK_H) ../include/dlb.h
729fountain.o: fountain.c $(HACK_H)
730hack.o: hack.c $(HACK_H)
731hacklib.o: hacklib.c $(HACK_H)
732invent.o: invent.c $(HACK_H)
733light.o: light.c $(HACK_H) ../include/lev.h
734lock.o: lock.c $(HACK_H)
735mail.o: mail.c $(HACK_H) ../include/mail.h
736makemon.o: makemon.c $(HACK_H) ../include/epri.h ../include/emin.h \
737		../include/edog.h
738mapglyph.o: mapglyph.c $(HACK_H)
739mcastu.o: mcastu.c $(HACK_H)
740mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h ../include/edog.h
741mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h ../include/edog.h
742minion.o: minion.c $(HACK_H) ../include/emin.h ../include/epri.h
743mklev.o: mklev.c $(HACK_H)
744mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
745mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h ../include/lev.h
746mkobj.o: mkobj.c $(HACK_H)
747mkroom.o: mkroom.c $(HACK_H)
748mon.o: mon.c $(HACK_H) ../include/mfndpos.h ../include/edog.h
749mondata.o: mondata.c $(HACK_H) ../include/eshk.h ../include/epri.h
750monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h ../include/artifact.h \
751		../include/epri.h
752monst.o: monst.c $(CONFIG_H) ../include/permonst.h ../include/align.h \
753		../include/monattk.h ../include/monflag.h ../include/monsym.h \
754		../include/dungeon.h ../include/eshk.h ../include/vault.h \
755		../include/epri.h ../include/color.h
756mplayer.o: mplayer.c $(HACK_H)
757mthrowu.o: mthrowu.c $(HACK_H)
758muse.o: muse.c $(HACK_H) ../include/edog.h
759music.o: music.c $(HACK_H) #interp.c
760o_init.o: o_init.c $(HACK_H) ../include/lev.h
761objects.o: objects.c $(CONFIG_H) ../include/obj.h ../include/objclass.h \
762		../include/prop.h ../include/skills.h ../include/color.h
763objnam.o: objnam.c $(HACK_H)
764options.o: options.c $(CONFIG_H) ../include/objclass.h ../include/flag.h \
765		$(HACK_H) ../include/tcap.h
766pager.o: pager.c $(HACK_H) ../include/dlb.h
767pickup.o: pickup.c $(HACK_H)
768pline.o: pline.c $(HACK_H) ../include/epri.h ../include/edog.h
769polyself.o: polyself.c $(HACK_H)
770potion.o: potion.c $(HACK_H)
771pray.o: pray.c $(HACK_H) ../include/epri.h
772priest.o: priest.c $(HACK_H) ../include/mfndpos.h ../include/eshk.h \
773		../include/epri.h ../include/emin.h
774quest.o: quest.c $(HACK_H) ../include/qtext.h
775questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h ../include/qtext.h
776read.o: read.c $(HACK_H)
777rect.o: rect.c $(HACK_H)
778region.o: region.c $(HACK_H) ../include/lev.h
779restore.o: restore.c $(HACK_H) ../include/lev.h ../include/tcap.h
780rip.o: rip.c $(HACK_H)
781rnd.o: rnd.c $(HACK_H)
782role.o: role.c $(HACK_H)
783rumors.o: rumors.c $(HACK_H) ../include/lev.h ../include/dlb.h
784save.o: save.c $(HACK_H) ../include/lev.h
785shk.o: shk.c $(HACK_H) ../include/eshk.h
786shknam.o: shknam.c $(HACK_H) ../include/eshk.h
787sit.o: sit.c $(HACK_H) ../include/artifact.h
788sounds.o: sounds.c $(HACK_H) ../include/edog.h
789sp_lev.o: sp_lev.c $(HACK_H) ../include/dlb.h ../include/sp_lev.h
790spell.o: spell.c $(HACK_H)
791steal.o: steal.c $(HACK_H)
792steed.o: steed.c $(HACK_H)
793teleport.o: teleport.c $(HACK_H)
794timeout.o: timeout.c $(HACK_H) ../include/lev.h
795topten.o: topten.c $(HACK_H) ../include/dlb.h ../include/patchlevel.h
796track.o: track.c $(HACK_H)
797trap.o: trap.c $(HACK_H)
798u_init.o: u_init.c $(HACK_H)
799uhitm.o: uhitm.c $(HACK_H)
800vault.o: vault.c $(HACK_H) ../include/vault.h
801version.o: version.c $(HACK_H) ../include/date.h ../include/patchlevel.h
802vision.o: vision.c $(HACK_H) ../include/vis_tab.h
803weapon.o: weapon.c $(HACK_H)
804were.o: were.c $(HACK_H)
805wield.o: wield.c $(HACK_H)
806windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h
807wizard.o: wizard.c $(HACK_H) ../include/qtext.h ../include/epri.h
808worm.o: worm.c $(HACK_H) ../include/lev.h
809worn.o: worn.c $(HACK_H)
810write.o: write.c $(HACK_H)
811zap.o: zap.c $(HACK_H)
812# DEPENDENCIES MUST END AT END OF FILE
813# IF YOU PUT STUFF HERE IT WILL GO AWAY
814# see make depend above
815