HW12/Makefile
2020-12-14 11:09:12 +00:00

40 lines
1.2 KiB
Makefile

CC = gcc
CFLAGS = -lm -Wall -O2 -pthread
ServerBin = server p-server
ClientBin = client p-client
Bin = $(ServerBin) $(ClientBin)
ClientObject = display_bar.o socket_wrapper.o
ServerObject = display_bar.o socket_wrapper.o
all:
make $(Bin)
socket_wrapper.o: socket_wrapper.c socket_wrapper.h
$(CC) -c socket_wrapper.c -o socket_wrapper.o $(CFLAGS)
display_bar.o: display_bar.c display_bar.h
$(CC) -c display_bar.c -o display_bar.o $(CFLAGS)
#client
client: client.c $(ClientObject)
$(CC) -o client client.c $(ClientObject) $(CFLAGS)
p-client: p-client.c $(ClientObject)
$(CC) -o p-client p-client.c $(ClientObject) $(CFLAGS)
p-mulclient: p-client.c $(ClientObject)
$(CC) -o p-slowclient p-client.c $(ClientObject) $(CFLAGS) -D MUL_CLIENT=10
slowclient: client.c $(ClientObject)
$(CC) -o slowclient client.c $(ClientObject) $(CFLAGS) -D SLOW_CLIENT=1000
#server
server: server.c $(ServerObject)
$(CC) -o server server.c $(ServerObject) $(CFLAGS)
p-server: p-server.c $(ServerObject)
$(CC) -o p-server p-server.c $(ServerObject) $(CFLAGS)
slowserver: server.c $(ServerObject)
$(CC) -o slowserver server.c $(ServerObject) $(CFLAGS) -D SLOW_SERVER=100000
.PHONY: clean test
clean:
rm *.o $(Bin)
test:
make all
make slowclient
./test.sh