--- makefile.orig	Sun Oct 29 17:03:34 2006
+++ makefile	Sun Oct 29 17:11:52 2006
@@ -1,29 +1,38 @@
 YFLAGS = -d
-CFLAGS = -g
+#CFLAGS = -g
 
 SRC = hoc.y hoc.h code.c init.c math.c symbol.c
 OBJS = hoc.o code.o init.o math.o symbol.o
 
 hoc:	$(OBJS)
-	$(CC) $(CFLAGS) $(OBJS) -lstdio -lm -o hoc
+	$(CC) $(CFLAGS) $(OBJS) -lm -o hoc
 
 hoc.o code.o init.o symbol.o:	hoc.h
 
 code.o init.o symbol.o:	x.tab.h
 
+.if ${MACHINE_ARCH} == "i386"
+code.o: code.c
+	$(CC) $(CFLAGS) -O0 -c code.c 
+.endif
+
 x.tab.h:	y.tab.h
 	-cmp -s x.tab.h y.tab.h || cp y.tab.h x.tab.h
 
-pr:	$(SRC)
-	@prcan $?
-	@touch pr
-
 install:	hoc
 	cp hoc /usr/bin
 	strip /usr/bin/hoc
 
+y.tab.h y.tab.c: hoc.y
+	yacc ${YFLAGS} hoc.y
+
 clean:
 	rm -f $(OBJS) [xy].tab.[ch]  hoc
 
 bundle:
 	@bundle $(SRC) makefile README
+
+# a few basic tests
+regress:
+	echo 2/3 | hoc | grep '^0.66666666*7$$' >/dev/null
+	echo 'x=22/7\nprint x' | hoc | grep '^3.142857' >/dev/null
