/* Imakefile for Xconq documentation. */

#include "../Local.config"

MAKEINFO = makeinfo

MAKEINFOFLAGS =

TEX = tex

TEXINDEX = texindex

# Where to find texinfo; dist should include a recent one.

TEXIDIR = .

SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS

DOCFILES_PLAY = \
	xconq.texi \
	play.texi \
	commands.texi \
	x11-sect.texi \
	curses-sect.texi \
	mac-sect.texi \
	glossary.texi \
	gpl.texi

DOCFILES_DESIGN = \
	xcdesign.texi \
	design.texi \
	refman.texi \
	hacking.texi \
	glossary.texi \
	syms.texi \
	syntax.texi \
	gpl.texi

info: xconq.info xcdesign.info

xconq.info:	$(DOCFILES_PLAY)
	$(MAKEINFO) -I . -o ./xconq.info $(MAKEINFOFLAGS) xconq.texi

xcdesign.info:	$(DOCFILES_DESIGN)
	$(MAKEINFO) -I . -o ./xcdesign.info $(MAKEINFOFLAGS) xcdesign.texi

dvi: playref.dvi gdlref.dvi xconq.dvi player.dvi

playref.dvi: playref.texi commands.texi
	$(SET_TEXINPUTS) $(TEX) playref.texi

gdlref.dvi: gdlref.texi syntax.texi syms.texi
	$(SET_TEXINPUTS) $(TEX) gdlref.texi

syms.texi: syms.raw kwic
	./kwic -dots -pad -breakup <syms.raw >syms.texi.new
	../move-if-change syms.texi.new syms.texi

syms.raw: getsyms.sh refman.texi
	./getsyms.sh refman.texi >syms.raw.new
	../move-if-change syms.raw.new syms.raw

# The main Xconq manual includes everything by default.

xconq.dvi:	$(DOCFILES)
	$(SET_TEXINPUTS) $(TEX) xconq.texi
	$(TEXINDEX) xconq.??
	$(SET_TEXINPUTS) $(TEX) xconq.texi

# Unix-only player's manual.

unixplay.dvi:	$(DOCFILES)
	sed -e 's/@set MACINTOSH/@clear MACINTOSH/' \
            xconq.texi >unixplay.texi
	$(SET_TEXINPUTS) $(TEX) unixplay.texi
	$(TEXINDEX) unixplay.??
	$(SET_TEXINPUTS) $(TEX) unixplay.texi

# Mac-only player's manual.

macplay.dvi:	$(DOCFILES)
	sed -e 's/@set UNIX/@clear UNIX/' \
            xconq.texi >macplay.texi
	$(SET_TEXINPUTS) $(TEX) macplay.texi
	$(TEXINDEX) macplay.??
	$(SET_TEXINPUTS) $(TEX) macplay.texi

# Game designer's manual.

xcdesign.dvi:	$(DOCFILES_DESIGN)
	$(SET_TEXINPUTS) $(TEX) xcdesign.texi
	$(TEXINDEX) xcdesign.??
	$(SET_TEXINPUTS) $(TEX) xcdesign.texi

ps: playref.ps gdlref.ps xconq.ps player.ps

playref.ps:	playref.dvi
	dvips playref.dvi -o playref.ps

gdlref.ps:	gdlref.dvi
	dvips gdlref.dvi -o gdlref.ps

xconq.ps:	xconq.dvi
	dvips xconq.dvi -o xconq.ps

player.ps:	player.dvi
	dvips player.dvi -o player.ps

html:	$(DOCFILES)
	perl texi2html -split_section -glossary -menu -verbose xconq.texi

clean-info:
	rm -f playref.info* gdlref.info*
	rm -f xconq.info* player.info* unixplay.info* macplay.info*

clean-dvi:
	rm -f playref.dvi gdlref.dvi
	rm -f xconq.dvi player.dvi unixplay.dvi macplay.dvi

clean-ps:
	rm -f *.ps

clean::
	rm -f playref.?? playref.??? gdlref.?? gdlref.???
	rm -f xconq.?? xconq.???
	rm -f player.texi player.?? player.???
	rm -f unixplay.texi unixplay.?? unixplay.???
	rm -f macplay.texi macplay.?? macplay.???
	rm -f syms.raw

install::
	cp *.info *.info-* $(INFODIR)

NormalProgramTarget(kwic, kwic.o, , , )

AllTarget(info)

