# Makefile for stm projects
#
# COURSE V22.0202: Operating Systems, Fall 2006
# Prof.Yap 
# 
############################################################

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

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

STM=stm
STM=multistm

p=stm
p=multistm

#debug-level
d=0
#quantum
q=6

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

######################################### multiprocessing
t0: ${STM}${EXE}
	${STM}${EXE} -q ${q} -d ${d} \
		primes.stm primes.stm sort.stm fraction.stm primes.stm

######################################### 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 (separated by white spaces or newlines)."
	@echo "    newlines).  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 Fraction
t3 test3 fraction: ${STM}${EXE} fraction.stm
	@echo "Type four number: N D B L "
	@echo "    (separated by white spaces or newlines)." 
	@echo "    The sort program will print L digits of the fraction N/D"
	@echo "    in base B.  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}:
	gcc -o ${STM}${EXE} ${STM}.c

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