# Makefile for stm projects
#
# COURSE V22.0202.003: Comp.Sys.Organization II, Spring 2005
# 
############################################################

############################################################
# VARIABLES
############################################################

# EXE should be .exe for windows and cygwin, and blank for unix.
EXE=
EXE=.exe

p=stm

############################################################
# TARGETS
############################################################

######################################### Testing Primes
t1 test1 primes: stm${EXE} primes.stm
	@echo "Type any positive number n, and this program will compute"
	@echo "    all primes less than n.  E.g. n=7 will print 2, 3, 5.
	stm${EXE} primes.stm
	@echo "End of testing primes"

######################################### Testing Sort
t2 test2 sort: stm${EXE} sort.stm
	@echo "Type any list of numbers (one per line).  End with -1." 
	@echo "    The list will be printed in sorted order."
	@echo "    E.g., typing 5 2 1 9 -1 will result in 1 2 5 9."
	stm${EXE} sort.stm
	@echo "End of testing sort"

######################################### Testing Sort
t3 test3 fraction: stm${EXE} fraction.stm
	@echo "Type four number: N D B D (one per line)." 
	@echo "    This program print D digits of the fraction N/D in base B."
	@echo "    E.g., typing 1 3 10 4 will result in 3 3 3 3."
	@echo "    (Since 1/3 in base 10 is 0.3333...).  Try 1 2 10 4."
	@echo "    Make sure that N<D."
	stm${EXE} fraction.stm
	@echo "End of testing fraction"

######################################### 
p:
	gcc -o ${p}${EXE} ${p}.c

######################################### 
stm${EXE}: stm.h sos.c
	gcc -c sos.c -o stm${EXE} stm.c

############################################################
# END
############################################################
