# Makefile for socket demo collection
# March 2010, by Michael J. Fischer and Alice E. Fischer

CFLAGS = -std=c99 -g -O1 -Wall -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
OBJECTS = server.o client.o tools.o

all: server client

# targets 
# clients --------------------------------------------------------
# All clients work with all servers; they send different messages. 
client: client.o tools.o
	$(CC) $(CFLAGS) -o client client.o tools.o

# servers --------------------------------------------------------
# socket example: single client, variable port
server: server.o  tools.o
	$(CC) $(CFLAGS) -o server server.o tools.o

# dependencies ---------------------------------------------------
client.o: client.c  tools.h
server.o: server.c  tools.h
tools.o:   tools.c tools.h

# cleanup
clean:
	rm -f server client $(OBJECTS)