#	NetHack Makefile.
#	SCCS Id: @(#)Makefile.dat	3.2	92/09/18

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)

x11tiles: ../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt
	../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt

qt_tiles_1.ppm: ../util/txt2ppm ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt
	../util/txt2ppm -w 1 qt_tiles_1.ppm ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt

qt_tiles_0.ppm: qt_tiles_1.ppm
	pnmscale -xscale 0.75 -yscale 0.875 qt_tiles_1.ppm | \
        pnmdepth 255 | \
	ppmquant 90 > qt_tiles_0.ppm

qt_tiles_2.ppm: qt_tiles_1.ppm
	pnmscale -xscale 1 -yscale 1.625 qt_tiles_1.ppm | \
        pnmdepth 255 | \
	ppmquant 90 > qt_tiles_2.ppm

qt_tiles_3.ppm: qt_tiles_1.ppm
	pnmscale -xscale 1.25 -yscale 2 qt_tiles_1.ppm | \
        pnmdepth 255 | \
	ppmquant 90 > qt_tiles_3.ppm

pet_mark.xpm: ../win/Qt/pet_mark.ppm
	ppmtoxpm ../win/Qt/pet_mark.ppm | sed -e 's/#FFFFFF/none/' > pet_mark.xpm

pet_mark.xbm: ../win/X11/pet_mark.xbm
	cp ../win/X11/pet_mark.xbm pet_mark.xbm

attr_sml.ppm: ../win/Qt/attr.ppm ../win/Qt/colormap.ppm
	pnmscale 0.5 ../win/Qt/attr.ppm | ppmquant -fs -map ../win/Qt/colormap.ppm >attr_sml.ppm

attr_tny.ppm: ../win/Qt/attr.ppm ../win/Qt/colormap.ppm
	pnmscale 0.25 ../win/Qt/attr.ppm | ppmquant -fs -map ../win/Qt/colormap.ppm >attr_tny.ppm

str.xpm: attr_sml.ppm
	pnmcut 0 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/' >str.xpm

dex.xpm: attr_sml.ppm
	pnmcut 40 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >dex.xpm 

con.xpm: attr_sml.ppm
	pnmcut 80 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >con.xpm

int.xpm: attr_sml.ppm
	pnmcut 120 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >int.xpm

wis.xpm: attr_sml.ppm
	pnmcut 160 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >wis.xpm

cha.xpm: attr_sml.ppm
	pnmcut 200 0 40 40 attr_sml.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >cha.xpm

str_tny.xpm: attr_tny.ppm
	pnmcut 0 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/' >str_tny.xpm

dex_tny.xpm: attr_tny.ppm
	pnmcut 20 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >dex_tny.xpm 

con_tny.xpm: attr_tny.ppm
	pnmcut 40 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >con_tny.xpm

int_tny.xpm: attr_tny.ppm
	pnmcut 60 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >int_tny.xpm

wis_tny.xpm: attr_tny.ppm
	pnmcut 80 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >wis_tny.xpm

cha_tny.xpm: attr_tny.ppm
	pnmcut 100 0 20 20 attr_tny.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/'  >cha_tny.xpm

%_tny.xpm: %.ppm
	pnmscale 0.5 $*.ppm | ppmquant -fs -map ../win/Qt/colormap.ppm | ppmtoxpm >$*_tny.xpm

%.pbm: ../win/Qt/%.pbm
	cp ../win/Qt/$*.pbm $*.pbm

%.ppm: ../win/Qt/%.ppm
	cp ../win/Qt/$*.ppm $*.ppm

%.ppm: ../win/Qt/%_l.ppm ../win/Qt/colormap.ppm
	pnmscale 0.5 ../win/Qt/$*_l.ppm | \
	pnmdepth 255 | \
	ppmquant -fs -map ../win/Qt/colormap.ppm >$*.ppm

# %.xpm: ../win/Qt/%.xpm
#	cp ../win/Qt/$*.xpm $*.xpm

%.xpm: ../win/Qt/%_l.ppm ../win/Qt/colormap.ppm
	pnmscale 0.5 ../win/Qt/$*_l.ppm | \
	pnmdepth 255 | \
	ppmquant -fs -map ../win/Qt/colormap.ppm | ppmtoxpm | sed -e 's/#C0C0C0/none/' >$*.xpm

rip.xpm: ../win/X11/rip.xpm
	cp ../win/X11/rip.xpm rip.xpm


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 caves.des darkelf.des \
	dragons.des endgame.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 \
	mineend.des minefill.des mines.des mtemple.des newmall.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
	../util/lev_comp beholder.des
	../util/lev_comp bigroom.des
	../util/lev_comp blkmar.des
	../util/lev_comp castle.des
	../util/lev_comp caves.des
	../util/lev_comp darkelf.des
	../util/lev_comp dragons.des
	../util/lev_comp endgame.des
	../util/lev_comp gehennom.des
	../util/lev_comp giants.des
	../util/lev_comp guild.des
	../util/lev_comp knox.des
	../util/lev_comp kobold-1.des
	../util/lev_comp kobold-2.des
	../util/lev_comp lich.des
	../util/lev_comp mall-1.des
	../util/lev_comp mall-2.des
	../util/lev_comp medusa.des
	../util/lev_comp mineend.des
	../util/lev_comp minefill.des
	../util/lev_comp mines.des
	../util/lev_comp mtemple.des
	../util/lev_comp newmall.des
	../util/lev_comp nymph.des
	../util/lev_comp oracle.des
	../util/lev_comp rats.des
	../util/lev_comp sea.des
	../util/lev_comp spiders.des
	../util/lev_comp stor-1.des
	../util/lev_comp stor-2.des
	../util/lev_comp stor-3.des
	../util/lev_comp tomb.des
	../util/lev_comp tower.des
	../util/lev_comp yendor.des
	touch spec_levs

quest_levs: ../util/lev_comp \
	Arch.des Barb.des Caveman.des Dopp.des Elf.des Flame.des Gnome.des Healer.des \
	Ice.des Knight.des Lycn.des Monk.des Necro.des \
	Priest.des Rogue.des Samurai.des Tourist.des Slayer.des Valkyrie.des Wizard.des
	../util/lev_comp Arch.des
	../util/lev_comp Barb.des
	../util/lev_comp Caveman.des
	../util/lev_comp Dopp.des
	../util/lev_comp Elf.des
	../util/lev_comp Flame.des
	../util/lev_comp Gnome.des
	../util/lev_comp Healer.des
	../util/lev_comp Ice.des
	../util/lev_comp Knight.des
	../util/lev_comp Lycn.des
	../util/lev_comp Monk.des
	../util/lev_comp Necro.des
	../util/lev_comp Priest.des
	../util/lev_comp Rogue.des
	../util/lev_comp Samurai.des
	../util/lev_comp Tourist.des
	../util/lev_comp Slayer.des
	../util/lev_comp Valkyrie.des
	../util/lev_comp Wizard.des
	touch quest_levs

dungeon: 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 nhdat x11tiles pet_mark.xbm rip.xpm
