CFLAGS = -g
CFILES = x.c bitrot.c twiddle.h grab.c bounce.c

x:	x.o bitrot.o grab.o bounce.o
	cc $(CFLAGS)  x.o bitrot.o grab.o bounce.o -lX -lm
	cp a.out x

x.o:
	cc $(CLFAGS) -c x.c

bounce.o: 
	cc $(CFLAGS) -c bounce.c

bitrot.o: 
	cc $(CFLAGS) -c bitrot.c

grab.o: 
	cc $(CFLAGS) -c grab.c

# 'make depend' code
depend: 
	-rm -f eddep makedep
	${CC} -M ${COPTS} ${CFILES} | \
	sed -e 's; ./; ;' \
	    -e ':loop' \
	    -e 's/\.\.\/[^ /]*\/\.\./../' \
	    -e 't loop' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	-rm -f Makefile.bak
	cp Makefile Makefile.bak
	ed - Makefile < eddep
	rm -f eddep makedep

#
# the last line in the makefile should be...
# DO NOT DELETE THIS LINE

x.o: x.c /usr/include/stdio.h /usr/include/X/Xlib.h
x.o: /usr/include/X/mit-copyright.h /usr/include/X/X.h
x.o: /usr/include/X/mit-copyright.h
bitrot.o: bitrot.c /usr/include/stdio.h /usr/include/signal.h
bitrot.o: /usr/include/X/Xlib.h /usr/include/X/mit-copyright.h
bitrot.o: /usr/include/X/X.h /usr/include/X/mit-copyright.h twiddle.h
bitrot.o: /usr/include/sys/types.h /usr/include/strings.h
twiddle.o: twiddle.h /usr/include/sys/types.h
grab.o: grab.c /usr/include/signal.h /usr/include/stdio.h
grab.o: /usr/include/sys/types.h /usr/include/X/Xlib.h
grab.o: /usr/include/X/mit-copyright.h /usr/include/X/X.h
grab.o: /usr/include/X/mit-copyright.h
bounce.o: bounce.c /usr/include/stdio.h /usr/include/X/Xlib.h
bounce.o: /usr/include/X/mit-copyright.h /usr/include/X/X.h
bounce.o: /usr/include/X/mit-copyright.h /usr/include/signal.h
bounce.o: /usr/include/math.h
