--- stack/Makefile 2002/03/10 08:48:56 1.9 +++ stack/Makefile 2003/08/04 11:22:02 1.15 @@ -25,22 +25,46 @@ .SUFFIXES: .SUFFIXES: .c .o + +srcdir = . ## -CFLAGS=-Wall -g -O0 +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 symbols + $(CC) -I$(srcdir) $(LDFLAGS) $(CFLAGS) symbols.o stack.c -o stack + +symbols: symbols.c stack.h + $(CC) -I$(srcdir) $(CFLAGS) -c symbols.c -o symbols.o + +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="`$(srcdir)/fac.st`"; set -x; [ "$$a" = 3628800 ]' + @$(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 symbols.o TAGS mtrace: stack MALLOC_TRACE=mtrace.log ./stack mtrace stack mtrace.log -check: stack - [ $(shell ./fib.st) = 610 ] +gcov: stack.c.gcov -TAGS: $(shell find . -iname "*.[ch]" -print) - etags $^ +stack.c.gcov: stack.da + gcov $(srcdir)/stack.c + +stack.da: check