#	NetHack Makefile.
#       @configure_input@
#	SCCS Id: @(#)Makefile.dat	3.4	1992/09/18

VPATH=@srcdir@
srcdir=@srcdir@

EXEEXT = @EXEEXT@

# for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP
# UUDECODE=uudecode

VARDAT = data rumors quest.dat oracles options

all:	$(VARDAT) spec_levs quest_levs dungeon

../util/makedefs:
	(cd ../util ; make makedefs)

../util/dgn_comp:
	(cd ../util ; make dgn_comp)

../util/lev_comp:
	(cd ../util ; make lev_comp)

../util/tile2x11:
	(cd ../util ; make tile2x11)

../util/tile2beos:
	(cd ../util ; make tile2beos)

../util/tile2png:
	(cd ../util ; make tile2png)

../util/magtile:
	(cd ../util ; make magtile)

../util/bigtile:
	(cd ../util ; make bigtile)

../util/txtmerge:
	(cd ../util ; make txtmerge)

../util/txtbg:
	(cd ../util ; make txtbg)

../util/mapmerge:
	(cd ../util ; make mapmerge)

../util/tile2bmp$(EXEEXT):
	(cd ../util ; make tile2bmp$(EXEEXT))

../util/uudecode$(EXEEXT):
	(cd ../util ; make uudecode$(EXEEXT))

x11tiles: ../util/tile2x11 $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
				$(srcdir)/../win/share/other.txt
	../util/tile2x11 $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
				$(srcdir)/../win/share/other.txt

x11tiles.map: ../util/mapmerge $(srcdir)/../win/share/monsters.map \
				$(srcdir)/../win/share/objects.map $(srcdir)/../win/share/other.map
	../util/mapmerge x11tiles.map $(srcdir)/../win/share/monsters.map \
				$(srcdir)/../win/share/objects.map $(srcdir)/../win/share/other.map

x11bigtiles:	../util/tile2x11 ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt
	../util/tile2x11 -o x11bigtiles ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt

x11bigtiles.map:	x11tiles.map
	cp x11tiles.map x11bigtiles.map

x11big3dtiles:	../util/tile2x11 ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt
	../util/tile2x11 -o x11big3dtiles ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt

x11big3dtiles.map:	x11tiles.map
	cp x11tiles.map x11big3dtiles.map

beostiles: ../util/tile2beos $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
			$(srcdir)/../win/share/other.txt
	../util/tile2beos $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
			$(srcdir)/../win/share/other.txt

gltile16.png: ../util/tile2png $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
				$(srcdir)/../win/share/other.txt
	../util/tile2png -o $@ $(srcdir)/../win/share/monsters.txt $(srcdir)/../win/share/objects.txt \
				$(srcdir)/../win/share/other.txt

gltile16.map: ../util/mapmerge $(srcdir)/../win/share/monsters.map \
				$(srcdir)/../win/share/objects.map $(srcdir)/../win/share/other.map
	../util/mapmerge gltile16.map $(srcdir)/../win/share/monsters.map \
				$(srcdir)/../win/share/objects.map $(srcdir)/../win/share/other.map

gltile32.png:	../util/tile2png ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt
	../util/tile2png -o $@ -t ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt

gltile32.map:	gltile16.map
	cp gltile16.map gltile32.map

gltile64.png:	../util/tile2png ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt
	../util/tile2png -o $@ -t ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt

gltile64.map:	gltile16.map
	cp gltile16.map gltile64.map

glfont8.png:	../util/tile2png $(srcdir)/../win/gl/font8.txt
	../util/tile2png -o $@ -f $(srcdir)/../win/gl/font8.txt

glfont14.png:	../util/tile2png $(srcdir)/../win/gl/font14.txt
	../util/tile2png -o $@ -f $(srcdir)/../win/gl/font14.txt

glfont20.png:	../util/tile2png $(srcdir)/../win/gl/font20.txt
	../util/tile2png -o $@ -f $(srcdir)/../win/gl/font20.txt

glfont22.png:	../util/tile2png $(srcdir)/../win/gl/font22.txt
	../util/tile2png -o $@ -f $(srcdir)/../win/gl/font22.txt

gllogo.png:	../util/tile2png $(srcdir)/../win/gl/logo.txt
	../util/tile2png -o $@ -a 28 $(srcdir)/../win/gl/logo.txt

glrip.png:	../util/tile2png $(srcdir)/../win/gl/rip.txt
	../util/tile2png -o $@ -a 20 $(srcdir)/../win/gl/rip.txt

../win/share/monmag.txt:	../util/magtile $(srcdir)/../win/share/monsters.txt
	../util/magtile $(srcdir)/

../win/share/objmag.txt:	../util/magtile $(srcdir)/../win/share/objects.txt
	../util/magtile $(srcdir)/

../win/share/othmag.txt:	../util/magtile $(srcdir)/../win/share/other.txt
	../util/magtile $(srcdir)/

../win/share/monbig.txt:	../util/bigtile ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	../util/bigtile

../win/share/objbig.txt:	../util/bigtile ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	../util/bigtile

../win/share/othbig.txt:	../util/bigtile ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	../util/bigtile

../win/share/mon32.txt:	../util/txtbg ../win/share/mon32-t.txt
	../util/txtbg ../win/share/mon32-t.txt ../win/share/mon32.txt

../win/share/obj32.txt:	../util/txtbg ../win/share/obj32-t.txt
	../util/txtbg ../win/share/obj32-t.txt ../win/share/obj32.txt

../win/share/oth32.txt:	../util/txtbg ../win/share/oth32-t.txt
	../util/txtbg ../win/share/oth32-t.txt ../win/share/oth32.txt

../win/share/mon32-t.txt:	../util/txtmerge ../win/share/monmag.txt \
		$(srcdir)/../win/share/mon32mi.txt $(srcdir)/../win/share/mon32alg.txt \
		$(srcdir)/../win/share/mon32aw.txt $(srcdir)/../win/share/mon32se.txt \
		$(srcdir)/../win/share/palette.txt
	../util/txtmerge -p $(srcdir)/../win/share/palette.txt ../win/share/mon32-t.txt \
		../win/share/monmag.txt -b $(srcdir)/../win/share/mon32mi.txt \
		-b $(srcdir)/../win/share/mon32se.txt -bff00ff $(srcdir)/../win/share/mon32alg.txt \
		-bff00ff $(srcdir)/../win/share/mon32aw.txt 

../win/share/obj32-t.txt:	../util/txtmerge ../win/share/objmag.txt \
		$(srcdir)/../win/share/obj32mi.txt $(srcdir)/../win/share/obj32se.txt \
		$(srcdir)/../win/share/obj32alg.txt $(srcdir)/../win/share/palette.txt
	../util/txtmerge -p $(srcdir)/../win/share/palette.txt ../win/share/obj32-t.txt \
		../win/share/objmag.txt -b $(srcdir)/../win/share/obj32mi.txt \
		-b $(srcdir)/../win/share/obj32se.txt -bff00ff $(srcdir)/../win/share/obj32alg.txt

../win/share/oth32-t.txt:	../util/txtmerge ../win/share/othmag.txt \
		$(srcdir)/../win/share/oth32mi.txt $(srcdir)/../win/share/oth32se.txt \
		$(srcdir)/../win/share/oth32alg.txt $(srcdir)/../win/share/palette.txt
	../util/txtmerge -p $(srcdir)/../win/share/palette.txt ../win/share/oth32-t.txt \
		../win/share/othmag.txt -b $(srcdir)/../win/share/oth32mi.txt \
		-b $(srcdir)/../win/share/oth32se.txt -bff00ff $(srcdir)/../win/share/oth32alg.txt

../win/share/mon3d.txt:	../util/txtmerge ../win/share/monbig.txt \
		$(srcdir)/../win/share/mon3dmi.txt $(srcdir)/../win/share/palette.txt
	../util/txtmerge -p $(srcdir)/../win/share/palette.txt ../win/share/mon3d.txt \
		../win/share/monbig.txt -b $(srcdir)/../win/share/mon3dmi.txt

../win/share/obj3d.txt:	../util/txtmerge ../win/share/objbig.txt
	cp ../win/share/objbig.txt ../win/share/obj3d.txt

../win/share/oth3d.txt:	../util/txtmerge ../win/share/othbig.txt \
		$(srcdir)/../win/share/oth3dmi.txt $(srcdir)/../win/share/oth-2kmi.txt \
		$(srcdir)/../win/share/oth3dse.txt $(srcdir)/../win/share/palette.txt
	../util/txtmerge -p $(srcdir)/../win/share/palette.txt ../win/share/oth3d.txt \
		../win/share/othbig.txt -b $(srcdir)/../win/share/oth3dmi.txt \
		-b $(srcdir)/../win/share/oth-2kmi.txt -b $(srcdir)/../win/share/oth3dse.txt

tiles.bmp: ../util/tile2bmp$(EXEEXT) $(srcdir)/../win/share/monsters.txt \
		$(srcdir)/../win/share/objects.txt \
		$(srcdir)/../win/share/other.txt
	../util/tile2bmp $@ $(srcdir)/../win/share/monsters.txt \
		$(srcdir)/../win/share/objects.txt \
		$(srcdir)/../win/share/other.txt

mnsel.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/mnsel.uu
	../util/uudecode $(srcdir)/../win/win32/mnsel.uu

mnselcnt.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/mnselcnt.uu
	../util/uudecode $(srcdir)/../win/win32/mnselcnt.uu

mnunsel.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/mnunsel.uu
	../util/uudecode $(srcdir)/../win/win32/mnunsel.uu

rip.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/rip.uu
	../util/uudecode $(srcdir)/../win/win32/rip.uu

petmark.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/petmark.uu
	../util/uudecode $(srcdir)/../win/win32/petmark.uu

SlashEM.ico: ../util/uudecode$(EXEEXT) $(srcdir)/../sys/winnt/seico.uu
	../util/uudecode $(srcdir)/../sys/winnt/seico.uu

splash.bmp: ../util/uudecode$(EXEEXT) $(srcdir)/../win/win32/splash.uu
	../util/uudecode $(srcdir)/../win/win32/splash.uu

SlashEM.ad: $(srcdir)/../win/X11/SlashEM.ad
	cp $(srcdir)/../win/X11/SlashEM.ad SlashEM.ad

pet_mark.xbm: $(srcdir)/../win/X11/pet_mark.xbm
	cp $(srcdir)/../win/X11/pet_mark.xbm pet_mark.xbm

rip.xpm: $(srcdir)/../win/X11/rip.xpm
	cp $(srcdir)/../win/X11/rip.xpm rip.xpm

mapbg.xpm: $(srcdir)/../win/gnome/mapbg.xpm
	cp $(srcdir)/../win/gnome/mapbg.xpm mapbg.xpm

nhsplash.xpm: $(srcdir)/../win/Qt/nhsplash.xpm
	cp $(srcdir)/../win/Qt/nhsplash.xpm nhsplash.xpm

nethack.icns: $(srcdir)/../win/Qt/nhicns.uu
	$(UUDECODE) $(srcdir)/../win/Qt/nhicns.uu

Info.plist: $(srcdir)/../win/Qt/Info.pli
	cp $(srcdir)/../win/Qt/Info.pli Info.plist

../util/tile2img.ttp:
	(cd ../util ; make tile2img.ttp)

../util/xpm2img.ttp:
	(cd ../util ; make xpm2img.ttp)
nh16.img: ../util/tile2img.ttp $(srcdir)/../win/share/monsters.txt \
                              $(srcdir)/../win/share/objects.txt $(srcdir)/../win/share/other.txt
	../util/tile2img.ttp nh16.img

rip.img: ../util/xpm2img.ttp
	../util/xpm2img.ttp $(srcdir)/../win/X11/rip.xpm rip.img
title.img:
	# cp $(srcdir)/../win/gem/title.img title.img
	$(UUDECODE) $(srcdir)/../win/gem/title.uu

GEM_RSC.RSC:
	# cp $(srcdir)/../win/gem/GEM_RSC.RSC GEM_RSC.RSC
	$(UUDECODE) $(srcdir)/../win/gem/gem_rsc.uu

data:	data.base ../util/makedefs
	../util/makedefs -d

rumors:	rumors.tru rumors.fal ../util/makedefs
	../util/makedefs -r

quest.dat:	quest.txt ../util/makedefs
	../util/makedefs -q

oracles:	oracles.txt ../util/makedefs
	../util/makedefs -h

# note: 'options' should have already been made when include/date.h was created
options:	../util/makedefs
	../util/makedefs -v


spec_levs: ../util/lev_comp \
	beholder.des bigroom.des blkmar.des castle.des grund.des dragons.des \
	endgame.des frnknstn.des gehennom.des giants.des guild.des knox.des \
	kobold-1.des kobold-2.des lich.des mall-1.des mall-2.des medusa.des \
	mines.des mtemple.des newmall.des nightmar.des nymph.des oracle.des \
	rats.des sea.des spiders.des stor-1.des stor-2.des stor-3.des tomb.des \
	tower.des yendor.des sokoban.des
	../util/lev_comp $(srcdir)/beholder.des
	../util/lev_comp $(srcdir)/bigroom.des
	../util/lev_comp $(srcdir)/blkmar.des
	../util/lev_comp $(srcdir)/castle.des
	../util/lev_comp $(srcdir)/grund.des
	../util/lev_comp $(srcdir)/dragons.des
	../util/lev_comp $(srcdir)/endgame.des
	../util/lev_comp $(srcdir)/frnknstn.des
	../util/lev_comp $(srcdir)/gehennom.des
	../util/lev_comp $(srcdir)/giants.des
	../util/lev_comp $(srcdir)/guild.des
	../util/lev_comp $(srcdir)/knox.des
	../util/lev_comp $(srcdir)/kobold-1.des
	../util/lev_comp $(srcdir)/kobold-2.des
	../util/lev_comp $(srcdir)/lich.des
	../util/lev_comp $(srcdir)/mall-1.des
	../util/lev_comp $(srcdir)/mall-2.des
	../util/lev_comp $(srcdir)/medusa.des
	../util/lev_comp $(srcdir)/mines.des
	../util/lev_comp $(srcdir)/mtemple.des
	../util/lev_comp $(srcdir)/newmall.des
	../util/lev_comp $(srcdir)/nightmar.des
	../util/lev_comp $(srcdir)/nymph.des
	../util/lev_comp $(srcdir)/oracle.des
	../util/lev_comp $(srcdir)/rats.des
	../util/lev_comp $(srcdir)/sea.des
	../util/lev_comp $(srcdir)/sokoban.des
	../util/lev_comp $(srcdir)/spiders.des
	../util/lev_comp $(srcdir)/stor-1.des
	../util/lev_comp $(srcdir)/stor-2.des
	../util/lev_comp $(srcdir)/stor-3.des
	../util/lev_comp $(srcdir)/tomb.des
	../util/lev_comp $(srcdir)/tower.des
	../util/lev_comp $(srcdir)/yendor.des
	touch spec_levs

quest_levs: ../util/lev_comp \
	Arch.des Barb.des Caveman.des Flame.des Healer.des Ice.des Knight.des \
	Monk.des Necro.des Priest.des Ranger.des Rogue.des Samurai.des \
	Tourist.des Slayer.des Valkyrie.des Wizard.des Yeoman.des
	../util/lev_comp $(srcdir)/Arch.des
	../util/lev_comp $(srcdir)/Barb.des
	../util/lev_comp $(srcdir)/Caveman.des
	../util/lev_comp $(srcdir)/Flame.des
	../util/lev_comp $(srcdir)/Healer.des
	../util/lev_comp $(srcdir)/Ice.des
	../util/lev_comp $(srcdir)/Knight.des
	../util/lev_comp $(srcdir)/Monk.des
	../util/lev_comp $(srcdir)/Necro.des
	../util/lev_comp $(srcdir)/Priest.des
	../util/lev_comp $(srcdir)/Ranger.des
	../util/lev_comp $(srcdir)/Rogue.des
	../util/lev_comp $(srcdir)/Samurai.des
	@if egrep -s tourists options > /dev/null ; then \
	echo ../util/lev_comp $(srcdir)/Tourist.des ; ../util/lev_comp $(srcdir)/Tourist.des ; \
	else rm -f Tou-goal.lev Tou-fil?.lev Tou-loca.lev Tou-strt.lev ; fi
	../util/lev_comp $(srcdir)/Slayer.des
	../util/lev_comp $(srcdir)/Valkyrie.des
	../util/lev_comp $(srcdir)/Wizard.des
	@if egrep -s yeomen options > /dev/null ; then \
	echo ../util/lev_comp $(srcdir)/Yeoman.des ; ../util/lev_comp $(srcdir)/Yeoman.des ; \
	else rm -f Yeo-goal.lev Yeo-fil?.lev Yeo-loca.lev Yeo-strt.lev ; fi
	touch quest_levs

dungeon: $(srcdir)/dungeon.def ../util/makedefs ../util/dgn_comp
	../util/makedefs -e
	../util/dgn_comp dungeon.pdf

spotless:
	-rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf
	-rm -f nhshare nhushare x11tiles x11bigtiles x11big3dtiles beostiles
	-rm -f x11tiles.map x11bigtiles.map x11big3dtiles.map
	-rm -f gl*.png
	-rm -f pet_mark.xbm rip.xpm mapbg.xpm
	-rm -f rip.img GEM_RSC.RSC title.img nh16.img SlashEM.ad
	-rm -f ../win/share/monmag.txt ../win/share/mon32.txt
	-rm -f ../win/share/objmag.txt ../win/share/obj32.txt
	-rm -f ../win/share/othmag.txt ../win/share/oth32.txt
	-rm -f ../win/share/monbig.txt ../win/share/mon3d.txt
	-rm -f ../win/share/objbig.txt ../win/share/obj3d.txt
	-rm -f ../win/share/othbig.txt ../win/share/oth3d.txt
	-rm -f ../win/share/mon32-t.txt
	-rm -f ../win/share/obj32-t.txt
	-rm -f ../win/share/oth32-t.txt
