default: cat

shapes.ps: template
	./template | groff -p > shapes.ps

template: template.cc
	g++ -s $(CFLAGS) template.cc -lm	# CC hat keine templates
	mv a.out template

%.ps: %.tr
	groff -t -p -mde -mfb20 $< > $@

%.p: %.ps
	ghostview $< &

cat: cat.C
	CC +w $(CFLAGS) cat.C && mv a.out cat	# CC hat besseres man ios(3)

time: fstream istream

fstream: cat
	time ./cat > /dev/null /vmunix
istream: cat
	time ./cat > /dev/null - < /vmunix
test: cat
	./cat - miv.C < cat.C			# see if it works

prof: mon.out
	prof > prof
	less prof	
	rm *.out

mon.out: cat.C
	g++ -s -p cat.C
	./a.out > /dev/null /vmunix

miv: miv.C
	CC $(CFLAGS) +i -g miv.C		# CC wegen C-Zwischencode
	mv a.out miv
	mv miv..c miv.c
	gdb miv
	rm miv miv.o

clean:
	rm *.ps *.out *.o prof cat template miv
