# file: docs/guide/Makefile
#
#  2003 OpenCA Group

CONTENT = \
	admin/ac.xml			\
	admin/configure.xml		\
	admin/csr.xml			\
	admin/dbm.xml			\
	admin/dataexchange.xml		\
	admin/guide.xml			\
	admin/install.xml		\
	admin/ldap.xml			\
	admin/openssl.xml		\
	admin/post-install.xml		\
	admin/postgresql.xml		\
	admin/pre-install.xml		\
	admin/scep.xml			\
	admin/subject.xml		\
	admin/subject_alt_name.xml	\
	admin/token.xml			\
	appendix/authors.xml		\
	appendix/faq.xml		\
	appendix/faq_access_control.xml	\
	appendix/faq_config.xml		\
	appendix/faq_dataexchange.xml	\
	appendix/faq_general.xml	\
	appendix/faq_i18n.xml		\
	appendix/faq_install.xml	\
	appendix/faq_ldap.xml		\
	appendix/faq_pki.xml		\
	appendix/bibliography.xml	\
	appendix/glossary.xml		\
	appendix/history.xml		\
	design/checklist.xml		\
	design/guide.xml		\
	tech/ac.xml			\
	tech/crypto.xml			\
	tech/guide.xml			\
	tech/hierarchy.xml		\
	tech/ldap.xml			\
	tech/legacy.xml			\
	tech/log.xml			\
	tech/web.xml			\
	tech/xml.xml			\
	user/cert.xml			\
	user/csr.xml			\
	user/guide.xml			\
	user/init_ca.xml		\
	user/ldapInterface.xml		\
	user/publicInterface.xml	\
	user/ra-nodeInterface.xml	\
	user/raInterface.xml		\
	user/scep.xml

## docbook
## DOCBOOK=/usr/share/sgml/docbook/docbook-xsl-stylesheets-1.42
## DOCBOOK=/usr/share/sgml/docbook/docbook-xsl-1.59.2
## DOCBOOK=/usr/share/sgml/docbook/docbook-xsl-1.60.1
## DOCBOOK=/usr/share/sgml/docbook/docbook-xsl-1.61.2
DOCBOOK=/usr/share/sgml/docbook/docbook-xsl-1.61.3

APACHE_FOP_DIR=/usr/lib/fop-0.20.5rc3
FOP_SH=export JAVA_HOME=/usr/lib/jdk1.3.1; $(APACHE_FOP_DIR)/fop.sh

.SUFFIXES :.html .pdf .xml .xml_all .fo .ps .rtf

## don't include this dirctory to normal make structure
default: openca-guide

openca-guide: openca-guide.html openca-guide.chunk openca-guide.pdf openca-guide.ps

openca-guide.xml_all: openca-guide.xml $(CONTENT)
	xmllint --xinclude $< > $@

openca-guide.html: openca-guide.xml_all
	xsltproc --stringparam section.autolabel "1" --stringparam  html.stylesheet "default.css" -o $@ $(DOCBOOK)/html/docbook.xsl $<

openca-guide.chunk: openca-guide.xml_all
	cp openca-guide.xml_all html_chunked/
	cp default.css html_chunked/
	cd html_chunked; xsltproc --stringparam section.autolabel "1" --stringparam  html.stylesheet "default.css" -o $@ $(DOCBOOK)/html/chunk.xsl $<

## a4 is only typical for europe
## --stringparam paper.type "a4"
## --stringparam paper.type "a5"
## --stringparam section.autolabel "1"
## --stringparam nominal.image.width "595"
## --stringparam preferred.mediaobject.role "ps"
## --stringparam preferred.mediaobject.role "pdf"

.xml_all.pdf:
	xsltproc --stringparam preferred.mediaobject.role "pdf" --stringparam section.autolabel "1" --stringparam nominal.image.width "595" -o tmp.fo $(DOCBOOK)/fo/docbook.xsl $<
	/opt/XEP/xep.sh -fo tmp.fo -pdf $@
	rm tmp.fo

.xml_all.ps:
	xsltproc --stringparam preferred.mediaobject.role "ps" --stringparam section.autolabel "1" --stringparam nominal.image.width "595" -o tmp.fo $(DOCBOOK)/fo/docbook.xsl $<
	/opt/XEP/xep.sh -fo tmp.fo -ps $@
	rm tmp.fo

clean:
	rm openca-guide_all.xml openca-guide_all.xml~ openca-guide.aux openca-guide.log openca-guide.fo openca-guide.out openca-guide.xml_all html_chunked/openca-guide.xml_all
