--- stack/Makefile 2002/03/10 07:55:13 1.7 +++ stack/Makefile 2002/03/20 05:20:19 1.13 @@ -25,22 +25,42 @@ .SUFFIXES: .SUFFIXES: .c .o + +srcdir = . ## -CFLAGS=-Wall -g +CFLAGS=-Wall -g -O0 -pg -fprofile-arcs -ftest-coverage +#CFLAGS=-Wall -g -O0 +## Linux LDFLAGS=-ldl -lmcheck -Xlinker --export-dynamic +## Other junk +#LDFLAGS=-Xlinker --export-dynamic all: stack TAGS -stack: stack.c stack.h - $(CC) -I$(srcdir) $(CFLAGS) $(LDFLAGS) -pg stack.c -o $@ +stack stack.bb stack.bbg: stack.c stack.h + $(CC) -I$(srcdir) $(LDFLAGS) $(CFLAGS) stack.c -o stack + +check: stack + @echo Checking... + @$(SHELL) -c 'a="`$(srcdir)/fib.st`"; set -x; [ "$$a" = 6765 ]' + @$(SHELL) -c 'a="`$(srcdir)/fib2.st`"; set -x; [ "$$a" = 6765 ]' + @$(SHELL) -c 'a="`echo '\''[ 1 2 ] a def; a rcl; a rcl; setcar; print;'\'' | ./stack | dd count=1 2>/dev/null`"; set -x; [ "$$a" = "[ #0# 2 ]" ]' + @$(SHELL) -c 'a="`echo '\''[ 1 2 ] a def; a rcl; a rcl; setcdr; print;'\'' | ./stack | dd count=1 2>/dev/null`"; set -x; [ "$$a" = "[ 1 . #0# ]" ]' + +TAGS: $(shell find $(srcdir) -path $(srcdir)/CVS -prune -o -name "*.[ch]" -print) + etags $^ + +clean: + rm -f gmon.out mtrace.log stack.bb stack.bbg stack.da stack.c.gcov stack TAGS mtrace: stack MALLOC_TRACE=mtrace.log ./stack mtrace stack mtrace.log -check: stack - [ $(shell ./fib.st) = 832040 ] +gcov: stack.c.gcov -TAGS: $(shell find . -iname "*.[ch]" -print) - etags $^ +stack.c.gcov: stack.da + gcov $(srcdir)/stack.c + +stack.da: check