########################################################################
#                                                                      #
# GLE - Graphics Layout Engine <http://www.gle-graphics.org/>          #
#                                                                      #
# Modified BSD License                                                 #
#                                                                      #
# Copyright (C) 2009 GLE.                                              #
#                                                                      #
# Redistribution and use in source and binary forms, with or without   #
# modification, are permitted provided that the following conditions   #
# are met:                                                             #
#                                                                      #
#    1. Redistributions of source code must retain the above copyright #
# notice, this list of conditions and the following disclaimer.        #
#                                                                      #
#    2. Redistributions in binary form must reproduce the above        #
# copyright notice, this list of conditions and the following          #
# disclaimer in the documentation and/or other materials provided with #
# the distribution.                                                    #
#                                                                      #
#    3. The name of the author may not be used to endorse or promote   #
# products derived from this software without specific prior written   #
# permission.                                                          #
#                                                                      #
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR   #
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED       #
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   #
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY       #
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   #
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE    #
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS        #
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER #
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR      #
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN  #
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                        #
#                                                                      #
########################################################################

all: fig fonts pdf defs.tex

fig:
	$(MAKE) -C title -f Makefile.gcc
	$(MAKE) -C tutorial/fig -f Makefile.gcc
	$(MAKE) -C primitives/fig -f Makefile.gcc
	$(MAKE) -C graph/fig -f Makefile.gcc
	$(MAKE) -C key/fig -f Makefile.gcc
	$(MAKE) -C advanced/fig -f Makefile.gcc
	$(MAKE) -C utilities/fig -f Makefile.gcc
	$(MAKE) -C appendix/fig -f Makefile.gcc
	$(MAKE) -C prog/fig -f Makefile.gcc

pdf: defs.tex
	pdflatex gle-manual.tex

dvi:
	latex gle-manual.tex

index:
	makeindex gle-manual

fonts:
	$(MAKE) -C fonttest -f Makefile.gcc

cfonts:
	$(MAKE) -C fonttest -f Makefile.gcc clean

clean:
	rm -rf *.pdf *.idx *.aux *.dvi *.log *.out *.ilg *.ind *.toc defs.tex
	$(MAKE) -C title -f Makefile.gcc clean
	$(MAKE) -C tutorial/fig -f Makefile.gcc clean
	$(MAKE) -C primitives/fig -f Makefile.gcc clean
	$(MAKE) -C graph/fig -f Makefile.gcc clean
	$(MAKE) -C key/fig -f Makefile.gcc	clean
	$(MAKE) -C advanced/fig -f Makefile.gcc clean
	$(MAKE) -C utilities/fig -f Makefile.gcc clean
	$(MAKE) -C appendix/fig -f Makefile.gcc clean
	$(MAKE) -C prog/fig -f Makefile.gcc clean	

# PDFS = $(addsuffix .pdf, $(basename $(EPSS)))

# %.pdf: %.eps
# 	epstopdf $<

defs.tex:
	../build/bin/glebtool -latexdef defs.tex hascairo $(HAVE_CAIRO)
	../build/bin/glebtool -latexversion defs.tex
