HW12/Makefile
2020-12-05 01:30:30 +00:00

34 lines
1013 B
Makefile

CC = gcc
CFLAGS = -lm -Wall -O2
ServerBin = server p-server
ClientBin = client p-client
Bin = $(ServerBin) $(ClientBin)
all:
make $(Bin)
socket_wrapper.o: socket_wrapper.c socket_wrapper.h
$(CC) -c socket_wrapper.c -o socket_wrapper.o $(CFLAGS)
client: socket_wrapper.o client.c
$(CC) -o client client.c socket_wrapper.o $(CFLAGS)
server: socket_wrapper.o server.c
$(CC) -o server server.c socket_wrapper.o $(CFLAGS) -pthread
p-server: socket_wrapper.o p-server.c
$(CC) -o p-server p-server.c socket_wrapper.o $(CFLAGS)
p-client: socket_wrapper.o p-client.c
$(CC) -o p-client p-client.c socket_wrapper.o $(CFLAGS)
p-slowclient: socket_wrapper.o p-client.c
$(CC) -o p-slowclient p-client.c socket_wrapper.o $(CFLAGS) -D SLOW_CLIENT=10
.PHONY: clean moveall
clean:
rm *.o $(Bin)
rm $(addprefix client_test/,$(ClientBin))
rm $(addprefix server_test/,$(ServerBin))
moveall:
mv client client_test/client
mv p-client client_test/p-client
mv server server_test/server
mv p-server server_test/p-server