# ----------------------------------------------------------------------------
# - Makefile                                                                 -
# - aleph doc - vol 2 - library reference                                    -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - 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. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2000 amaury darsch                                    -
# ----------------------------------------------------------------------------

TOPDIR		= ../..
CNFDIR		= $(TOPDIR)/cnf
SITEFILE	= $(CNFDIR)/site.mak
RULEFILE	= $(CNFDIR)/rule.mak
include		  $(SITEFILE)

SOURCES		= vol-2.tex      \
		  title.tex      \
		  preface.tex    \
		  chapter-1.tex  \
		  chapter-2.tex  \
		  chapter-3.tex  \
		  chapter-4.tex  \
		  chapter-6.tex

MANUAL		= vol-2.ps
DVIMAN		= $(MANUAL:.ps=.dvi)
TEXMAN		= $(MANUAL:.ps=.tex)
IDXMAN		= $(MANUAL:.ps=.idx)

# ----------------------------------------------------------------------------
# - project rules                                                            -
# ----------------------------------------------------------------------------

# rule: all
# this rule is the default rule which call the build rule

all: build

# include: rule.mak
# this rule includes the platform dependant rules

include $(RULEFILE)

# rule: build
# build the postscript manual

build: $(MANUAL)

# rule: dviman
# build the dvi manual

$(DVIMAN): $(SOURCES) aleph.sty
	@latex     $(TEXMAN)
	@makeindex $(IDXMAN)
	@latex     $(TEXMAN)
	@rm -f *.log *.aux *.toc *.idx *.ilg *.ind

# rule: manual
# build vol-3.ps manual

$(MANUAL) : $(DVIMAN)
	@dvips -o $@ $<

# rule: distri
# create the distribution file

distri: $(MANUAL)
	@$(CP) $(MANUAL) $(DIRDOC)

# rule: aleph.sty
# link locally the latex package file

aleph.sty: ../etc/aleph.sty
	@ln -s $<

# rule: preface.tex
# link locally the common preface

preface.tex: ../etc/preface.tex
	@ln -s $<

# rule: quick
# build quickly the manual and invokes ghostview

quick:
	@latex $(TEXMAN) 
	@dvips -o $(MANUAL) $(DVIMAN)
	@gv $(MANUAL) &

# rule: clean
# clean the numerous files generated by latex

clean::
	@$(RM) *.ps *.eps *.dvi *.toc *.aux *.log *.sty gpl.tex
	@$(RM) *.idx *.ilg *.ind *.bib *.bbl *.blg *.gz 
	@$(RM) preface.tex
