
FORMATS=${addprefix xml.,ps html info txt}

DVIPS= @DVIPS@
MAKEINFO= @MAKEINFO@
TEXI2HTML= @TEXI2HTML@
TEX= @TEX@

all: ${FORMATS} clean

%.dvi: %.texi
ifneq (${TEX},)
	echo x | ${TEX} $<
	texindex ${<:%.texi=%.cp}
	echo x | ${TEX} $<
else
	@echo "---------------------------------------------------"
	@echo "tex not found, cannot build DVI or PS documentation"
	@echo "---------------------------------------------------"
endif

%.ps: %.dvi
ifneq (${DVIPS},)
	dvips -o $@ $<
else
	@echo "------------------------------------------------------"
	@echo "dvips not found, cannot build POSTSCRIPT documentation"
	@echo "------------------------------------------------------"
endif

%.html: %.texi
ifneq (${TEXI2HTML},)
	${TEXI2HTML} -menu -split_chapter -number $<
else
	@echo "----------------------------------------------------"
	@echo "texi2html not found, cannot build HTML documentation"
	@echo "----------------------------------------------------"
endif

%.info: %.texi
ifneq (${MAKEINFO},)
	${MAKEINFO} $<
else
	@echo "---------------------------------------------------"
	@echo "makeinfo not found, cannot build INFO documentation"
	@echo "---------------------------------------------------"
endif

%.txt: %.texi
ifneq (${MAKEINFO},)
	${MAKEINFO} -o $@ --number-sections $<
else
	@echo "---------------------------------------------------"
	@echo "makeinfo not found, cannot build TEXT documentation"
	@echo "---------------------------------------------------"
endif

clean: force
	@${RM} *.cp
	@${RM} *.aux
	@${RM} *.cps
	@${RM} *.fn
	@${RM} *.ky
	@${RM} *.log
	@${RM} *.pg
	@${RM} *.toc
	@${RM} *.tp
	@${RM} *.vr

clean_all: clean
	@${RM} ${FORMATS} *.html

force:
