.SUFFIXES:	.fig .dvi .tex .eps .ps

.fig.ps:
		fig2dev -L ps -p foo -c -P $*.fig >$*.ps

.fig.eps:
		fig2dev -L ps -p foo $*.fig >$*.eps

all:		
		@echo "Try  make dvi  or  make ps  or  make ascii"

dvi:		atmapi.dvi
ps:		atmapi.ps
ascii:		atmapi.txt

atmapi.tex:	.checked

atmapi.dvi:	atmapi.tex examples.c atm.h atmsap.h pvc.eps connect.eps \
		  listen.eps svcaddr.eps
		./texinc.pl <atmapi.tex >tmp.tex
		./rlatex tmp
		mv -f tmp.dvi atmapi.dvi

atmapi.ps:	atmapi.dvi
		dvips atmapi

atmapi.txt:	atmapi.tex
		./texinc.pl <atmapi.tex | ./t2a.pl >atmapi.txt

foreign:
		touch .checked

.checked:	examples.c
		rm -f .checked
		gcc -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align \
		  -Wwrite-strings -Wconversion -Werror -c -o /dev/null \
		  examples.c 
		touch .checked

atm.h:		/usr/include/linux/atm.h
		if [ -r /usr/include/linux/atm.h ]; then \
		  cp /usr/include/linux/atm.h .; fi
		[ -r atm.h ]

atmsap.h:	/usr/include/linux/atmsap.h
		if [ -r /usr/include/linux/atmsap.h ]; then \
		  cp /usr/include/linux/atmsap.h .; fi
		[ -r atmsap.h ]

update:
		cp $$HOME/k/curr/include/linux/atm.h .
		cp $$HOME/k/curr/include/linux/atmsap.h .

/usr/include/linux/atm.h:
		@echo "WARNING: atm.h is not automatically updated"

/usr/include/linux/atmsap.h:
		@echo "WARNING: atmsap.h is not automatically updated"

clean:
		rm -f *.aux *.log *.toc .checked

spotless:	clean
		rm -f *.dvi *.ps *.txt
