-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
42 lines (30 loc) · 831 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
37
38
39
40
41
42
CXX = g++
CXXFLAGS = -pedantic-errors -Wall -Wextra -Werror -O3
BUILD = build
OBJ_DIR = $(BUILD)/objects
EXEC_DIR = $(BUILD)/exec
INCLUDE = -I src/
SRC = $(wildcard src/*.cpp)
TARGET = benchmark
OBJECTS = $(SRC:%.cpp=$(OBJ_DIR)/%.o)
DEPENDENCIES = $(OBJECTS:.o=.d)
all: build $(EXEC_DIR)/$(TARGET)
build:
@mkdir -p $(OBJ_DIR)
@mkdir -p $(EXEC_DIR)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -MMD -o $@
$(EXEC_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $(EXEC_DIR)/$(TARGET) $^
-include $(DEPENDENCIES)
.PHONY: all build clean info
clean:
@echo "[*] Removing build directory: ${BUILD}"
rm -rf $(BUILD)
info:
@echo "[*] Executable directory: ${EXEC_DIR}"
@echo "[*] Object directory: ${OBJ_DIR}"
@echo "[*] Sources: ${SRC}"
@echo "[*] Objects: ${OBJECTS}"