-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
46 lines (36 loc) · 1.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
CC = gcc
CFLAGS = -c -Wall -pthread -lm -lrt
LDFLAGS = -pthread -lm -lrt
TARGETS = client incast-client simple-client server
CLIENT_OBJS = common.o cdf.o conn.o client.o
INCAST_CLIENT_OBJS = common.o cdf.o conn.o incast-client.o
SIMPLE_CLIENT_OBJS = common.o simple-client.o
SERVER_OBJS = common.o server.o
BIN_DIR = bin
RESULT_DIR = result
CLIENT_DIR = src/client
COMMON_DIR = src/common
SERVER_DIR = src/server
SCRIPT_DIR = src/script
all: $(TARGETS) move
move:
mkdir -p $(RESULT_DIR)
mkdir -p $(BIN_DIR)
mv *.o $(TARGETS) $(BIN_DIR)
cp $(SCRIPT_DIR)/* $(BIN_DIR)
client: $(CLIENT_OBJS)
$(CC) $(CLIENT_OBJS) -o client $(LDFLAGS)
incast-client: $(INCAST_CLIENT_OBJS)
$(CC) $(INCAST_CLIENT_OBJS) -o incast-client $(LDFLAGS)
simple-client: $(SIMPLE_CLIENT_OBJS)
$(CC) $(SIMPLE_CLIENT_OBJS) -o simple-client $(LDFLAGS)
server: $(SERVER_OBJS)
$(CC) $(SERVER_OBJS) -o server $(LDFLAGS)
%.o: $(CLIENT_DIR)/%.c
$(CC) $(CFLAGS) $^ -o $@
%.o: $(SERVER_DIR)/%.c
$(CC) $(CFLAGS) $^ -o $@
%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $^ -o $@
clean:
rm -rf $(BIN_DIR)/*