CC = gcc
CFLAGS = -O2 -Wall -I .
FILES = tiny.c Makefile home.html csapp2ecover-small.jpg README.txt \
	csapp.c csapp.h \
	cgi-bin/adder.c cgi-bin/Makefile

# This flag includes the Pthreads library on a Linux box.
# Others systems will probably require something different.
LIB = -lpthread

all: tiny cgi tiny.tar

tiny: tiny.c csapp.o
	$(CC) $(CFLAGS) -o tiny tiny.c csapp.o $(LIB)

cgi:
	(cd cgi-bin; make)

csapp.o:
	$(CC) $(CFLAGS) -c csapp.c

tiny.tar: $(FILES)
	tar cvf tiny.tar $(FILES)

clean:
	rm -f *.o tiny *~ *.exe
	(cd cgi-bin; make clean)

