all: pdf html info partial_clean

pdf:  asis_ug.pdf  asis_rm.pdf gnatcheck_rm.pdf
html: asis_ug.html asis_rm.html gnatcheck_rm.html
info: asis_ug.info asis_rm.info gnatcheck_rm.info

partial_clean:
	rm -f *.aux *.cp *.cps *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr

clean: partial_clean
	rm -rf *.ps *.info* *.html asis_rm.txt asis_ug.txt

%.pdf: %.texi
	echo x | texi2pdf ${@:%.pdf=%.texi}

%.html: %.texi
	texi2html -split chapter -number -subdir=. ${@:%.html=%.texi}

%.info: %.texi
	makeinfo --force --no-split -o $@ ${@:%.info=%.texi}
	makeinfo --force --no-headers --no-split -o ${@:%.info=%.txt} \
		${@:%.info=%.texi}

asis_ug.texi: edition.texi texinfo.tex texiplus.tex gfdl.texi
asis_rm.texi: edition.texi texinfo.tex texiplus.tex gfdl.texi
gnatcheck_rm.texi: edition.texi texinfo.tex texiplus.tex gfdl.texi
	cp ../tools/gnatcheck/gnatcheck_rm.texi .

gfdl.texi:
	cp ../gnat/gfdl.texi .

edition.texi:
	cp ../gnat/edition.texi .

texinfo.tex:
	cp ../gnat/texinfo.tex .

texiplus.tex:
	cp ../gnat/texiplus.tex .

gnatcheck_rules.texi : ../tools/gnatcheck/gnatcheck-docgen
	(cd ../tools/gnatcheck; ./gnatcheck-docgen$(exe_ext))
	cp ../tools/gnatcheck/docs/gnatcheck_rules.texi .

../tools/gnatcheck/gnatcheck-docgen :
	(cd ../tools/gnatcheck; gnatmake -Pgnatcheck gnatcheck-docgen)

