CC = gcc

CSAPP_INC = .
CSAPP_SRC = .

OPT = -O2 -DOPTS_ON=1
#DEBUGOPTS = -fno-stack-protector -O0 -DOPTS_ON=0
LINK = -static
CFLAGS =  -g -m32 -Wall $(OPT) -I $(CSAPP_INC) -I . 
LDLIBS = -lpthread

PROGS =	tt sm

all: $(PROGS) 

tt:	tt.o mythreads.o mythreads.h
	gcc -m32 -Wall $(OPT) -g $(DEBUGOPTS) $(LINK) -o tt tt.o mythreads.o

mythreads.o:	mythreads.c mythreads.h

sm:	switchm.c mythreads.o mythreads.h
	gcc $(CFLAGS) -static -g -o $@ $< mythreads.o

clean:
	rm -f $(PROGS) *.o *~
