-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
107 lines (85 loc) · 3.57 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
COMPILER = g++
LOG_CFLAGS = -Wall -I. -std=c++14 -pthread -g -DENABLE_LOG -fsanitize=undefined
DEBUG_CFLAGS = -Wall -I. -std=c++14 -pthread -g -DENABLE_DEBUG -fsanitize=undefined,thread
CFLAGS = -Wall -I. -O3 -std=c++14 -pthread
CC = $(COMPILER) $(CFLAGS)
BIN = da_proc
BUILD = build
SRC = da
OBJS =
.PHONY: bin init clean format run all
all: init bin
format:
find da/ -type f -name "*.cc" | xargs -I{} bash -c 'clang-format -i {}' 2>/dev/null || echo >&2 "clang-format not found. Skipping."
find da/ -type f -name "*.h" | xargs -I{} bash -c 'clang-format -i {}' 2>/dev/null || echo >&2 "clang-format not found. Skipping."
clean:
rm -rf build
find . -type f -name "*.o" | xargs -I{} bash -c 'rm -f {}'
find . -type f -name "*.out" | xargs -I{} bash -c 'rm -f {}'
rm -f $(BIN)
init: format clean
mkdir build
bin: da_proc
$(CC) -o $(BIN) $(OBJS)
run: all
./da_proc ${PROCESS} membership ${MESSAGES}
da_proc: % : $(SRC)/%.cc util/status process/process init/parser socket/udp_socket executor/executor executor/scheduler link/perfect_link receiver/receiver broadcast/uniform_reliable broadcast/fifo broadcast/localized_causal
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
init/parser: % : $(SRC)/%.cc util/status process/process
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
receiver/receiver: % : $(SRC)/%.cc util/status executor/executor socket/udp_socket broadcast/fifo broadcast/localized_causal link/perfect_link util/util
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
broadcast/uniform_reliable: % : $(SRC)/%.cc process/process link/perfect_link
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
broadcast/localized_causal: % : $(SRC)/%.cc process/process link/perfect_link broadcast/uniform_reliable
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
broadcast/fifo: % : $(SRC)/%.cc process/process link/perfect_link broadcast/uniform_reliable
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
link/perfect_link: % : $(SRC)/%.cc util/status process/process socket/udp_socket executor/scheduler util/util
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
executor/executor: % : $(SRC)/%.cc
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
executor/scheduler: % : $(SRC)/%.cc
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
process/process: % : $(SRC)/%.cc util/status
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
socket/udp_socket: % : $(SRC)/%.cc util/status socket/socket socket/communicating_socket
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
socket/communicating_socket: % : $(SRC)/%.cc util/status socket/socket
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
socket/socket: % : $(SRC)/%.cc util/status
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
util/status: % : $(SRC)/%.cc
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)
util/util: % : $(SRC)/%.cc
mkdir -p $(shell dirname $(BUILD)/$@.o)
$(CC) -c -o $(BUILD)/$@.o $<
$(eval OBJS += $(BUILD)/$@.o)