#
# Makefile
#

my_book = jnestor-guide

# options of the different programs
xsltproc_options = --nonet --xinclude
fop = fop

.PHONY: book
book: html html_single

.PHONY: html_single
html_single:
	# make html_single directory if it don't exist
	if [ -d html_single ] ; then true; else mkdir html_single; fi; 
	# copy the content of the gfx and images directory
	#cp -R gfx html_single 
	#cp -R images html_single
	cp docbook.css html_single
	xsltproc $(xsltproc_options) --output "html_single/$(my_book).html" xsl/html_single.xsl "$(my_book).xml"
 
.PHONY: html
html:
	# make html directory if it don't exist
	if [ -d html ] ; then true; else mkdir html; fi; 
	# copy the content of the gfx and images directory
	#cp -R gfx html 
	#cp -R images html
	cp docbook.css html
	xsltproc $(xsltproc_options) --output "html/$(my_book).html" xsl/html.xsl "$(my_book).xml"
 
.PHONY: pdf
pdf:
	# make pdf directory if it don't exist
	if [ -d pdf ] ; then true; else mkdir pdf; fi; 
	xsltproc $(xsltproc_options) --output "pdf/$(my_book).fo" xsl/fo.xsl "$(my_book).xml"
	$(fop) "pdf/$(my_book).fo" -pdf "pdf/$(my_book).pdf"
 
clean:
	# to ignore errors, start the command with a hyphen
	-rm -f html/*
	-rm -f html_single/*
	-rm -f pdf/*

