# Makefile
#   
# Operating Systems
# Fall, 2007.  Prof.Yap
#
# This sample make file will document the actions that one 
# take in this directory, and how to do it!
#
# E.g., to compile a particular program,
# you can just type "make" to accept the default
# or you can type "make p=fork" to compile fork.c.

###################################################
# VARIABLES
p=parser
p=tsh
p=mytsh

# possible platforms
ifndef PLATFORM
	PLATFORM=unix
	PLATFORM=cyg
endif

ifeq (${PLATFORM},cyg)
	exec=a.exe
	exe=.exe
else 
ifeq (${PLATFORM},unix)
	exec=a.out
	exe=
endif
endif

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

mytsh: parser.o
	gcc parser.o mytsh.c -o mytsh$(exe)

tsh: parser.o
	gcc parser.o tsh.c -o tsh$(exe)

gcc:
	gcc ${p}.c

parse parser.o:
	gcc parser.c -c

test:
	${exec}

h1:	h1.c
	gcc -o h1 h1.c
	./h1

###################################################
# HOUSEKEEPING
###################################################
tar:
	tar cvf homework1.tar Makefile \
		test.c fork.c h1.ps myFirstShellScript

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