#
# Makefile for CFEngine's documentation
#
# This file is intended as a guide. You may need to modify it a little on your
# system.  Note that you need the GNU texinfo package to run tex on this
# documentation!! Postscript and html versions are included since some people have had
# problems here.
#

version = @cfversion@

VPATH = @srcdir@

DOCS = @CFDOCS@

prefix = @prefix@
infodir = @infodir@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

MKINSTALLDIR = @top_srcdir@/bin/mkinstalldirs

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

CP = ln
RM = rm -f
RM1 = rm -f
RM2 = echo rm -f
RM3 = echo rm -f

# Needs to agree with VPATH
MAKEINFOFLAGS = -I@srcdir@

.SUFFIXES: .ps .info .html .dvi .texinfo

all: ${DOCS}

install: cfengine.info
	${MKINSTALLDIR} ${infodir}
	for x in cfengine.info* ; \
	do \
	${INSTALL_DATA} $$x ${infodir}; \
	done

dist: clean

${version}.ps: cfengine.ps
	-${CP} cfengine.ps $@

${version}.html: cfengine.html
	-${CP} cfengine.html $@
	-${CP} cfengine_toc.html ${version}_toc.html
	-${CP} cfengine_foot.html ${version}_foot.html

${version}.info: cfengine.info
	-for x in cfengine.info* ; \
	do \
	${CP} $$x `echo $$x | sed "s/cfengine/${version}/"`; \
	done

cfengine.dvi: version.texi

cfengine.html: version.texi

cfengine.info: version.texi

clean:
	${RM} cfengine.aux cfengine.log cfengine.cp
	${RM} cfengine.pg cfengine.tp cfengine.vr cfengine.fn
	${RM} cfengine.ky cfengine.toc cfengine.cps cfengine.vrs
	${RM} cfengine.fns cfengine.mb cfengine.mbs  
	${RM} missfont.log cfengine.f cfengine.fs *~

distclean: clean
	${RM1} cfengine.info*
	${RM2} cfengine.ps
	${RM3} cfengine.html cfengine_toc.html cfengine_foot.html
	${RM} cfengine.dvi Makefile

.texinfo.html:
	-${TEXI2HTML} $<

.dvi.ps:
	${DVIPS} -f $< > $@

.texinfo.info:
	-${MAKEINFO} ${MAKEINFOFLAGS} $<

.texinfo.dvi:
	-${TEX} $<
	-${TEXINDEX} $*.vr $*.mb $*.cp
	echo rescanning || ${TEX} $<
