
CC = LANG=C gcc
LD = ld

CFLAGS = -pthread -g -O0 -Wall -I../src
LDFLAGS = -pthread -g

ifeq ($(DEBUG),1)
	CFLAGS += -fprofile-arcs -ftest-coverage
	LDFLAGS += -fprofile-arcs -ftest-coverage
endif


CTARGET = testclient
COBJ = client.o cget.o chead.o cpost.o chttp.o test.o

STARGET = testserver
SOBJ = server.o Session.o sget.o shead.o spost.o shttp.o test.o

LIB = ../libhtlib.a

all: $(CTARGET) $(STARGET)

$(CTARGET): $(COBJ) $(LIB)
	$(CC) $(LDFLAGS) -o $@ $(COBJ) $(LIB)

$(STARGET): $(SOBJ) $(LIB)
	$(CC) $(LDFLAGS) -o $@ $(SOBJ) $(LIB)

clean:
	rm -f $(CTARGET) $(COBJ) $(STARGET) $(SOBJ) *~ *.gcov *.gcda *.gcno *~

test: all
	./test.sh 1 cat
