FLAGS = -std=c11 -Wall
SERVER_LINKER = -lpthread -lldap -llber
CLIENT_LINKER = -lpthread

all: server client
	
run_all: all
	./server
	./client 127.0.0.1

server: ServerMain.c Server.c Server.h Stream.c Stream.h SocketUtils.c SocketUtils.h String.c String.h Banns.c Banns.h LDAP.h LDAP.c
	gcc $(FLAGS) -o $@ ServerMain.c Server.c Stream.c SocketUtils.c String.c Banns.c LDAP.c $(SERVER_LINKER)

run_server: server
	./server


client: ClientMain.c Client.c Client.h Stream.c Stream.h SocketUtils.c SocketUtils.h String.c String.h
	gcc $(FLAGS) -o $@ ClientMain.c Client.c Stream.c SocketUtils.c String.c $(CLIENT_LINKER)

run_client: client
	./client 127.0.0.1
		
	
clean:
	rm -f client server