 # Sample makefile for profiling executables from CLU sources

CLU     = ${CLUHOME}/exe/pclu                    # the compiler
CFLAGS  = -I${CLUHOME}/include -w -G 4 -c	 # flags to the C compiler
LDFLAGS = -L${CLUHOME}/code -lpclu_opt -lgc -lm   # flags to the C linker

OBJS = factorial.o 

factorial: ${OBJS}
	${CC} -o $@ ${OBJS} ${LDFLAGS}
	@echo "run the program 'factorial' (terminate normally)"
	@echo "raw profiling information will be in mon.out"
	@echo "use 'prof factorial mon.out' to process the raw output"
	@echo "the information from this example is not very interesting"
	@echo "usually it shows most of the time being spent doing i/o"
	@echo ""
	@echo "alternatively (on mips workstations) use pixie"
	@echo "pixie factorial -o factorial.pixie"
	@echo "run 'factorial.pixie' (terminate normally)"
	@echo "use 'prof -pixie -proc -heavy -quit 50 factorial factorial.Addrs factorial.Counts > factorial.prof"
	@echo "the profiling information will be in factorial.prof"

factorial.o: factorial.clu
	rm -f factorial.c
	${CLU} -ext false -spec factorial -opt -co factorial

clean:
	rm -f ${OBJS} factorial factorial.c mon.out factorial.pixie \
		factorial.Addrs factorial.Counts
