# Makefile for G2 computer algebra code from a noweb source.
# $Id: Makefile,v 1.3 2000/01/05 14:09:44 swann Exp $

code = g2-gen g2nmin-direct g2direct-sample

all: g2.ps g2.pdf $(code)
.PHONY: all 

.PHONY: maple-code
maple-code: $(code)

$(code): g2.nw
	notangle -R$@ $< > $@

g2.ps: g2.dvi
	dvips $< -o $@

g2.dvi: %.dvi: %.tex
	rm -f $*.aux $*.toc
	latex $<
	latex $<
	latex $<

g2.pdf: %.pdf: %.tex
	rm -f $*.aux $*.toc
	pdflatex $<
	pdflatex $<
	pdflatex $<

g2.tex: g2.nw mapleoutput-g2direct-sample
	noweave -delay -index $< > $@

.PHONY: clean veryclean
clean:
	rm -f g2.aux g2.bbl g2.blg g2.brf g2.log g2.out g2.toc 

veryclean: clean
	rm -f $(code)
	rm -f g2.tex g2.ps g2.dvi g2.pdf
