bin = /usr/users/wwwifa/docs/subatom/nucltheo/bin
JS = $(bin)/js
GS = /usr/bin/gs
GRAPH = $(bin)/graph

all: proj.ps proj.png

proj.ps: proj.tex fig.ps
	latex proj
	latex proj
	dvips proj

fig.ps: fig.dat
	$(GRAPH) \
		--width 0.7 --height 0.7 \
		--x-label "x" --y-label "y" \
		--display-type ps \
		fig.dat > fig.ps

fig.dat: main.js
	$(JS) main.js > fig.dat

%.png : %.ps
	$(GS) -sDEVICE=pnggray -r110x110 -sOutputFile=$*%d.png \
	-sPAPERSIZE=a4 -dBATCH -dNOPAUSE $*.ps
	mv $*1.png $*.png


clean:
	rm -f *.aux *.dvi *.log proj.ps fig.ps fig.dat proj.png
