-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (33 loc) · 935 Bytes
/
Makefile
File metadata and controls
46 lines (33 loc) · 935 Bytes
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
# Makefile
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Iinclude
SRC_DIR = src
TEST_DIR = tests
BUILD_DIR = build
# Binaries
BINARIES = example channel_test select_test
# Source files
example_SRC = $(SRC_DIR)/main.cpp
channel_test_SRC = $(TEST_DIR)/channel_tests.cpp
select_test_SRC = $(TEST_DIR)/select_tests.cpp
# Object files
example_OBJ = $(BUILD_DIR)/main.o
channel_test_OBJ = $(BUILD_DIR)/channel_tests.o
select_test_OBJ = $(BUILD_DIR)/select_tests.o
all: $(BUILD_DIR) $(BINARIES)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
# Targets
example: $(example_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $(BUILD_DIR)/$@
channel_test: $(channel_test_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $(BUILD_DIR)/$@
select_test: $(select_test_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $(BUILD_DIR)/$@
# Compile rule
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(TEST_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -rf $(BUILD_DIR)