## ----------------------------------------------------------------------------
##                                                                           --
##                      GNADE  : GNu Ada Database Environment                --
##                                                                           --
##  Filename        : $Source: /cvsroot/gnade/gnade/doc/build/Makefile,v $
##  Description     : Top level makefile for the documentation
##  Author          : Juergen Pfeifer <juergen.pfeifer@gmx.net> 
##  Created On      : 17-Jan-2001
##  Last Modified By: $Author: stephen_leake $
##  Last Modified On: $Date: 2003/09/28 14:21:48 $
##  Status          : $State: Exp $
##
##  Copyright (C) 2000-2002
##
##  GNADE is copyrighted by the persons and institutions enumerated in the   --
##  AUTHORS file. This file is located in the root directory of the          --
##  GNADE distribution.                                                      --
##                                                                           --
##  GNADE is free software;  you can redistribute it  and/or modify it under --
##  terms of the  GNU General Public License as published  by the Free Soft- --
##  ware  Foundation;  either version 2,  or (at your option) any later ver- --
##  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
##  OUT 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  distributed with GNAT;  see file COPYING.  If not, write --
##  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
##  MA 02111-1307, USA.                                                      --
##                                                                           --
##  As a special exception,  if other files  instantiate  generics from      --
##  GNADE Ada units, or you link GNADE Ada units or libraries with other     --
##  files  to produce an executable, these  units or libraries do not by     --
##  itself cause the resulting  executable  to  be covered  by the  GNU      --
##  General  Public  License.  This exception does not however invalidate    --
##  any other reasons why  the executable file  might be covered by the      --
##  GNU Public License.                                                      --
##                                                                           --
##  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
##                                                                           --
## ----------------------------------------------------------------------------
##
##  Functional Description
##  ======================
##  This makefile builds the various documentation formats. The input 
##  is SGML docbook.
##
##  If the aspell utility is installed on the system, a gobal spell check
##  is done which summarizes all misspellings. If the number of 
##  errors is large consider the execution of a real spellcheck run.
##
##  Restrictions
##  ============
##  - Spellcheck is based upon the aspell utility.
##
##  References
##  ==========
##  None
##
##
sinclude ../../make.conf

##
## 
##
LOG=docbuild.log
DOCBASE=gnade

PARTS=$(DOCBASE).sgml esql.sgml odbc.sgml bindings.sgml \
		gpl.sgml gfdl.sgml faq.sgml porting.sgml gnudb.sgml \
		ado.sgml tools.sgml

TARGETS= $(docdir)/html/$(DOCBASE).html   \
		$(docdir)/$(DOCBASE).ps   \
		$(docdir)/$(DOCBASE).pdf 

##
## for all we do nothing
##
all ::  

##
## Build the documentation and check if possible spelling errors.
##
documentation :: $(TARGETS)  gps_index.xml
	cp gps_index.xml $(docdir) 

doc :: 
	$(MAKE) USED_SPELLCHECKER="" documentation
##
## Generate PDF documents
##
$(docdir)/$(DOCBASE).pdf :: $(docdir)/$(DOCBASE).ps
	ps2pdf $(docdir)/$(DOCBASE).ps $(docdir)/$(DOCBASE).pdf

$(docdir)/$(DOCBASE).ps :: $(DOCBASE).tex
	$(DOCBUILDER) --ps --log=$(LOG) --target=$@ $(DOCBASE) 

$(docdir)/html/$(DOCBASE).html ::  $(DOCBASE).tex
	$(DOCBUILDER) --html --log=$(LOG) --target=$@ $(DOCBASE) 
	rm -rf $(docdir)/html
	-mkdir -p $(docdir)/html
	-mv *.html *.htm $(docdir)/html

$(DOCBASE).tex :: $(PARTS)
	$(DOCBUILDER) --tex --log=$(LOG) $(DOCBASE).sgml 

clean ::
	rm -f *.aux *.log *.tex *.dvi *.out *.pdf *.htm *.html *~ *.bak

distclean :: clean
	rm -f *.dvi *.ps *.pdf *.rtf
	rm -rf $(docdir)/html 
	rm -rf $(docdir)/*.pdf

