-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (25 loc) · 849 Bytes
/
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
.PHONY: all clean
INCLUDE = include
EXAMPLES = examples
BENCH = benchmarks
BUILD = build
# Will not compile.
NEED_EXTERNAL_DEPENDENCY = $(BENCH)/pong_asio.cpp
# NEED_EXTERNAL_DEPENDENCY is not included.
ALL_EXAMPLES_TARGETS = $(notdir $(basename $(wildcard $(EXAMPLES)/*.cpp)))
ALL_BENCH_TARGETS = $(notdir $(basename $(filter-out $(NEED_EXTERNAL_DEPENDENCY), $(wildcard $(BENCH)/*.cpp))))
CXX_FLAGS = -std=c++20 -Wall -Wextra -g -I$(INCLUDE) $^ -luring -pthread
CXX_FLAGS_DEBUG =
all: examples benchmarks
examples: $(ALL_EXAMPLES_TARGETS)
benchmarks: $(ALL_BENCH_TARGETS)
benchmark_script:
python $(BENCH)/pingpong.py
clean:
@rm -rf $(BUILD)
%: $(EXAMPLES)/%.cpp
@mkdir -p $(BUILD)
$(CXX) $(CXX_FLAGS) $(CXX_FLAGS_DEBUG) -o $(BUILD)/$@
%: $(BENCH)/%.cpp
@mkdir -p $(BUILD)
$(CXX) $(CXX_FLAGS) $(CXX_FLAGS_DEBUG) -O3 -o $(BUILD)/$@