# production of figures from ps files to get inclusions right

LEX = flex

# psinc: psinc.fl
#	$(LEX) psinc.fl; mv lex.yy.c psinc.yy.c; $(CC) -c psinc.yy.c;\
#	$(CC) -o psinc psinc.yy.o -lfl

.SUFFIXES: .TEX .eps .EPS .ps .PS .inc .dvi .tex .lbl .hw .sol

.TEX.tex:
	rm -f $@; cat $(PREFILES) ../texinputs/$(FONTS) $< $(BYE) > $@

.EPS.eps:
	rm -f $@; psinc < $< > $@

.PS.ps:
	rm -f $@; psinc < $< > $@

.tex.lbl:
	rm -f $*.lbl; tex $<; dvips -o tmp.eps -E $*.dvi; cat tmp.eps | ../bin/pslabels > $*.lbl; rm -f tmp.eps

# ---------------------------------------------------------

PREFILES = ../texinputs/coursepages.tex ../texinputs/coursemacro.defs

FONTS = font.defs

DVIFILES = intro.dvi introps.dvi

BYE = bye.tex

# ---------------------------------------------------------

DVIFILES=intro.dvi simpleps.dvi introps.dvi gfx.dvi hwformat.dvi evolution.dvi arrays.dvi gfx.dvi hw2.dvi hw3.dvi lab.dvi scale.dvi loops.dvi shears.dvi  pgmnotes.dvi ctm.dvi curves.dvi centre.dvi

dvifiles: $(DVIFILES)

dviclean:
	rm -f $(DVIFILES)
	
psfiles: intro.ps simpleps.ps introps.ps gfx.ps hwformat.ps evolution.ps arrays.ps gfx.ps hw2.ps hw3.ps lab.ps scale.ps loops.ps shears.ps morepgmnotes.ps pgmnotes.ps ctm.ps curves.ps centre.ps

simpleps.dvi: pythagoras-exercise-1.eps triangle-exercise-2.eps

curves: oval.eps quartic.eps quartic8.eps curves.tex graph.eps bez.eps bez2.eps bez3.eps bez1.eps bez1a.eps bez1b.eps bez4.eps bez5.eps bez6.eps parabola.eps
	tex curves.tex; touch curves

gfx: gfx.tex rotation2d-1.eps rotation2d-2.eps rotation2d-3.eps rotation2d-4.eps cosinerule.eps pythagoras.inc pythagoras.eps pythagoras1.eps pythagoras2.eps pythagoras3.eps pythagoras4.eps pythagoras5.eps dissection.eps dissection1.eps 
	tex gfx.tex; touch gfx 

rigid: rigid.tex segment.eps frame.eps rigid2d.eps crossprod.eps projection.eps perp.eps rotationperp.eps rigid1d.eps 3drotation.eps euler.eps 3dprojection.a.eps 3dprojection.b.eps
	make rigid.dvi; touch rigid

visibility: visibility.tex vis.1.eps vis.2.eps vis.3.eps
	tex visibility.tex; touch visibility

sph: sph_tr.tex sph_tr.eps sector.eps sph_part.eps
	rm -f sph; make sph_tr.dvi; touch sph

rotation2d-1.eps: rotation2d-lr.lbl rotation2d-ltheta.lbl rotation2d-lxy.lbl 

rotation2d-2.eps: rotation2d-lr.lbl rotation2d-lrc.lbl rotation2d-lrs.lbl 

rotation2d-3.eps: rotation2d-lxcyc.lbl  

rotation2d-4.eps: rotation2d-lxcyc.lbl rotation2d-lxs.lbl rotation2d-lys.lbl 

cosinerule.eps: cosinerule-ltheta.lbl cosinerule-la.lbl cosinerule-lb.lbl cosinerule-lc.lbl cosinerule-ltheta1.lbl cosinerule-ltheta2.lbl cosinerule-lc1.lbl cosinerule-lc2.lbl 

frame.eps: p1.lbl p0.lbl p2.lbl

euler.eps: alpha.lbl beta.lbl p1.lbl p2.lbl theta1half.lbl theta2half.lbl

crossprod.eps: u.lbl v.lbl uxv.lbl

centre.eps: A.lbl B.lbl C.lbl

centre.dvi: centre.eps

projection.eps: alpha.lbl u0.lbl u.lbl

3.sol.dvi: lissajous.eps

symmetry: symmetry.tex rotation-symm.eps mixed-symm.eps reflection.eps labeling.eps reg3.eps reg4.eps rs.eps fd.eps reg1.eps reg2.eps short.eps alpha.eps cube.eps 3dchambers.eps cube.1.eps regpoly.eps star.eps poly-cone.eps
	rm -f symmetry; tex symmetry.tex; touch symmetry

rs.eps: C.lbl sC.lbl srC.lbl rC.lbl

alpha.eps: alpha1.lbl alpha2.lbl

cube.eps: varpi1.lbl varpi2.lbl varpi3.lbl 

cube.1.eps: alpha1.lbl alpha2.lbl alpha3.lbl



page-1.eps: evol-1.eps
page-2.eps: evol-2.eps
page-3.eps: evol-3.eps
page-4.eps: evol-4.eps
page-5.eps: evol-5.eps
page-6.eps: evol-6.eps
page-7.eps: evol-7.eps

evolution.dvi: page-1.eps page-2.eps page-3.eps page-4.eps page-5.eps page-6.eps page-7.eps

symm.dvi: symm1.eps

ctm.dvi: triple.eps triple-1.eps triple-2.eps

shears.dvi: shears-1.eps

4.sol: 4.sol.1.eps 4.sol.2.eps 4.sol.3.eps 4.sol.4.eps 4.sol.5.eps 4.sol.dvi 

# ---------------------------------------------------------

# hw1.dvi 1sol.dvi 2sol.dvi squarepgm.dvi simpleps.dvi hw2.dvi pythagoras.dvi pythagorasbis.dvi routines.dvi gs.dvi loops.dvi gfx.dvi bezier.dvi pgmnotes.dvi paths.dvi hw3.dvi matrix.dvi mtsol.dvi rotations.dvi exp.dvi hwformat.dvi bezsol.dvi morepgmnotes.dvi paths3d.dvi examnotes.dvi rotate2d.dvi

PSFILES = intro.ps introps.ps
# hw1.ps 1sol.ps 2sol.ps squarepgm.ps simpleps.ps hw2.ps pythagoras.ps pythagorasbis.ps routines.ps gs.ps loops.ps gfx.ps bezier.ps pgmnotes.ps paths.ps hw3.ps matrix.ps mtsol.ps rotations.ps exp.ps hwformat.ps bezsol.ps morepgmnotes.ps paths3d.ps examnotes.ps rotate2d.ps


# to produce ps files for www

.tex.dvi: 
	tex $<

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

dvifiles: $(DVIFILES)

psfiles: $(PSFILES)
	touch psfiles

psclean:
	rm -f *.ps

psversions: $(DVIFILES) psfiles
	mv *.ps ps-versions; cd ps-versions; gzip *.ps

EPSFILES = *.eps

epsfiles: $(EPSFILES)
	touch epsfiles

pythagoras.dvi: pythagoras.eps pythagoras.inc pythagoras1.eps shear.eps shear1.eps pythagoras2.eps pythagoras3.eps pythagoras4.eps pythagoras5.eps

pythagorasbis.dvi: dissection.eps dissection1.eps

exp.dvi: animation.eps

paths.dvi: oval.eps

2sol.dvi: sin.eps sin1.eps

exam-review.dvi: sphere.eps eight.eps

polyhedra.dvi: polyhedra.eps

clean_psfiles: 
	rm -f $(EPSFILES)

clean: 
	rm -f *.o psinc core *% *log *~ $(PSFILES) $(EPSFILES)

incdocs: matrix.dvi mkpath.dvi mkpath3d.dvi

incps: matrix.ps mkpath.ps mkpath3d.ps

