all: dvi info html inst

dvi: gpc.dvi
info: gpc.info
rtf: gpc.rtf
html: gpc.html
inst: INSTALL install.html

# Toplevel Makefile may override this
INFODIR = /usr/info

TEXIFILES = gpc.texi \
	copying.texi funding.texi lookfeel.texi gnu.texi \
	contributors.texi purpose.texi \
	install.texi invoke.texi \
	borland2ep.texi bpqstart.texi extend.texi \
	keywords.texi builtin.texi \
	bugs.texi how_to_contrib.texi \
	fpk_vs_gnu.texi \
	notes.texi pvs.texi sets.texi gpi.texi automake.texi \
        md.texi tm.texi rtl.texi

DISTFILES = $(TEXIFILES) c-stuff.texi Makefile texinfo.tex*

gpc.info: $(TEXIFILES)
	makeinfo gpc.texi

gpc.rtf: $(TEXIFILES)
	makertf gpc.texi -o gpc.rtf -J gpc.hpj

gpc.dvi: $(TEXIFILES)
	texi2dvi gpc.texi

gpc.html: $(TEXIFILES)
	texi2html gpc.texi

install.html: install.texi
	texi2html install.texi

INSTALL: install.texi
	makeinfo -DINSTALLONLY --no-header --no-split install.texi -o INSTALL

clean:
	rm -f *~ *.dvi *.ps *.info* *.html INSTALL core
	rm -f *.aux *.cp *.cps *.fn *.ky *.kys *.log *.pg *.toc *.tp *.vr

dist:
	tar czf gpc-doc.tar.gz $(DISTFILES)

install: info
	-rm -f $(INFODIR)/gpc.info*
	-cp gpc.info* $(INFODIR)
#
# JJ: first compress, then move
#	gzip -9 $(INFODIR)/gpc.info*
#	echo "Remember to edit /usr/info/dir.info."

# For MS-DOS (djgpp), *.info-* have to be renamed to *.i*
#
prepare-msdos: info
	for file in *.info-*; do \
		mv $$file `echo $$file | sed s'/.info-/.i/'` ; \
	done
