#
# Not yet a conforming Makefile...
#
SHELL = @SHELL@

SOURCES = aclocal.m4 aclocal_cache.m4 aclocal_cc.m4 aclocal_cross.m4 \
	  aclocal_f77.m4 aclocal_f90.m4 aclocal_make.m4 \
	  aclocal_mpi.m4 aclocal_perl.m4 \
	  aclocal_shl.m4 aclocal_cxx.m4 aclocal_bugfix.m4 \
	  aclocal_am.m4 aclocal_web.m4 aclocal_java.m4
config_SOURCES = acconfig.h.in acconfig_cc.h acconfig_f77.h
DOCTEXT = ../src/doctext/doctext
DOCTEXT_ARGS = -nolocation -heading Sowing -quotefmt -skipprefix dnl

all: htmldoc texdoc

.SUFFIXES: .tex .html .m4

htmldoc: ${SOURCES}
	${DOCTEXT} ${DOCTEXT_ARGS} -html -mpath www ${SOURCES}
	rm -f www/index.htm
	@echo '<HTML><TITLE>PAC Documentation</TITLE>' >www/index.htm 
	@echo '<BODY BGCOLOR="FFFFFF">' >>www/index.htm
	@echo '<MENU>' >>www/index.htm
	@(cd www && ls -1 *.html | sed 's%^\(.*\)\.html%<LI> <A HREF="\1.html">\1</A>%g' >>\
		index.htm )
	@echo '</MENU></BODY></HTML>' >>www/index.htm
texdoc: ${SOURCES}
	${DOCTEXT} ${DOCTEXT_ARGS} -latex -mpath tex ${SOURCES}
	rm -f tex/ref.tex
	@(cd tex && ls -1 *.tex | sed 's%^\(.*\)\.tex%\\input \1.tex%g' > ../ref.tex)
	@mv ref.tex tex/ref.tex
	@(cd tex && @LATEX@ ../pac && dvips pac && dvipdfm pac)
	@mv tex/pac.pdf .
	@mv tex/pac.ps .

acconfig.h: ${config_SOURCES}
	@-rm -f acconfig.h
	cat ${config_SOURCES} | sed '/#include/d' > acconfig.h

clean:
	-rm -f *~ tex/*.log tex/*.aux tex/*.dvi

dist-clean: clean
	rm -f config.cache config.log config.status Makefile

maintainer-clean: dist-clean
