## Process this file with automake to produce Makefile.in
## $Id: Makefile.am,v 1.43 2006/07/24 05:01:59 vanbaal Exp $

## Copyright (C) 2000-2001 Stichting LogReport Foundation LogReport@LogReport.org
## 
##     This program is free software; you can redistribute it and/or modify
##     it under the terms of the GNU General Public License as published by
##     the Free Software Foundation; either version 2 of the License, or
##     (at your option) any later version.
## 
##     This program is distributed in the hope that it will be useful,
##     but WITHOUT ANY WARRANTY; without even the implied warranty of
##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##     GNU General Public License for more details.
## 
##     You should have received a copy of the GNU General Public License
##     along with this program (see COPYING); if not, check with
##     http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
##     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.

include $(top_srcdir)/include/rules.mk

# html subdirs are handled in this Makefile, examples/ has its own Makefile.am
SUBDIRS = examples

# HTML documentation uses *-local hooks
#   target goes into all-local
#   install goes into install-data-local
#   uninstall goes into uninstinstal-local
#   maintainer-clean-local must erase the HTML directories
#   dist-hook must copy the documentation to the source tree
html_doc = user-manual/index.html \
	   dev-manual/index.html 

html_doc_dirs = user-manual dev-manual

docdir = $(datadir)/doc/$(PACKAGE)

manuals = user-manual.pdf user-manual.txt \
	dev-manual.pdf dev-manual.txt

changelogs = ChangeLog.2000.gz ChangeLog.2001.gz ChangeLog.2002.gz \
	ChangeLog.2003.gz ChangeLog.2004.gz ChangeLog.2005.gz

doc_DATA = $(manuals) $(changelogs) BUGS

xml_source = user-manual.dbx dev-manual.dbx

XML_FILES = $(xml_source)

image_source =  flow-analysis.dia \
		flow-generation.dia \
		flow-normalisation.dia \
		flow-overview.dia \
		flow-report.dia \
		flow-xslt.dia \
		lire-dlf-converters.dia 

dev_manual_eps_imgs = \
                flow-analysis.eps \
		flow-generation.eps \
		flow-normalisation.eps \
		flow-overview.eps \
		flow-report.eps \
		flow-xslt.eps \
		lire-dlf-converters.eps

dev_manual_png_imgs = \
                dev-manual/flow-analysis.png \
                dev-manual/flow-generation.png \
                dev-manual/flow-normalisation.png \
                dev-manual/flow-overview.png \
                dev-manual/flow-report.png \
                dev-manual/flow-xslt.png \
                dev-manual/lire-dlf-converters.png

dtd_infos = \
	$(top_srcdir)/all/lib/xml/dtd/ldsml.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lire-desc.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lire-types.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lrcml.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lrcsml.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lrml.dbx \
	$(top_srcdir)/all/lib/xml/dtd/lrsml.dbx

EXTRA_DIST = \
	TODO \
	refactoring.txt \
	$(doc_DATA)  \
	$(xml_source) $(image_source) $(dev_manual_png_imgs) \
        $(dev_manual_eps_imgs) catalog lire.ent

MAINTAINERCLEANFILES = $(manuals)

$(dtd_infos)/%:
	cd doc && $(MAKE) $*

$(html_doc_dirs):
	mkdir -p $@

dev-manual/index.html: dev-manual.dbx $(dtd_infos) $(dev_manual_png_imgs)
	$(XML2HTML_RULE)

dev-manual.pdf: dev-manual.dbx $(dtd_infos) $(dev_manual_eps_imgs)
	$(XML2PDF_RULE)

dev-manual.txt: dev-manual.dbx $(dtd_infos)
	$(HTML2TXT_RULE)

dev-manual/flow-analysis.png: flow-analysis.dia
	$(DIA2PNG_RULE)

dev-manual/flow-generation.png: flow-generation.dia
	$(DIA2PNG_RULE)

dev-manual/flow-normalisation.png: flow-normalisation.dia
	$(DIA2PNG_RULE)

dev-manual/flow-overview.png: flow-overview.dia
	$(DIA2PNG_RULE)

dev-manual/flow-report.png: flow-report.dia
	$(DIA2PNG_RULE)

dev-manual/flow-xslt.png: flow-xslt.dia
	$(DIA2PNG_RULE)

dev-manual/lire-dlf-converters.png: lire-dlf-converters.dia
	$(DIA2PNG_RULE)

user-manual/index.html: user-manual.dbx
	$(XML2HTML_RULE)

user-manual.pdf: user-manual.dbx
	$(XML2PDF_RULE)

user-manual.txt: user-manual.dbx
	$(HTML2TXT_RULE)

# AutoMake extensions do handle HTML documentation in chunks
all-local: $(html_doc_dirs) $(html_doc)

install-data-local : $(html_doc)
	for i in $(html_doc); do \
	    dir=`dirname $$i`; \
	    $(mkinstalldirs) $(DESTDIR)$(docdir)/$$dir; \
	    cp $(srcdir)/$$dir/* $(DESTDIR)$(docdir)/$$dir; \
	done

uninstall-local:
	-for i in $(html_doc); do \
	    dir=`dirname $$i`; \
	    for f in $(srcdir)/$$dir/*; do \
		file=`basename $$f`; \
		rm -f $(DESTDIR)$(docdir)/$$dir/$$file; \
	    done; \
	    rmdir $(DESTDIR)$(docdir)/$$dir; \
	done

maintainer-clean-local :
	-for i in $(html_doc); do \
	    dir=`dirname $$i`; \
	    rm -f $(srcdir)/$$dir/*; \
	    rmdir $(srcdir)/$$dir; \
	done

dist-hook : $(html_doc)
	for i in $(html_doc); do \
	    dir=`dirname $$i`; \
	    $(mkinstalldirs) $(distdir)/$$dir; \
	    cp $(srcdir)/$$dir/*.html $(distdir)/$$dir; \
	done



syntax highlighted by Code2HTML, v. 0.9.1