-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (27 loc) · 764 Bytes
/
Makefile
File metadata and controls
36 lines (27 loc) · 764 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
CXXFLAGS = -c -Wall -Wextra -std=c++17 -DFMT_HEADER_ONLY -I./include
# CXXFLAGS += -g -DENABLE_LOGGING
# CXXFLAGS += -O2 -march=native -mtune=native
LDFLAGS =
EXE_NAME = tema3pc
SRC_DIR = src
OUT_DIR = build/linux
OBJ_DIR = $(OUT_DIR)/obj
OUT_EXE = $(OUT_DIR)/$(EXE_NAME)
SRC_FILES = $(shell find $(SRC_DIR)/ -type f -name '*.cpp')
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRC_FILES))
.PHONY: build
build: $(OUT_EXE)
.PHONY: run
run: build
./$(OUT_EXE)
.PHONY: clean
clean:
rm -rf "$(OUT_DIR)" "$(OBJ_DIR)"
$(OUT_EXE): $(OBJ_FILES)
@mkdir -p "$(OUT_DIR)"
@echo Linking "$(OUT_EXE)" ...
@$(CXX) $(LDFLAGS) -o "$(OUT_EXE)" $^
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p "$(@D)"
@echo Compiling "$<" ...
@$(CXX) $(CXXFLAGS) -o $@ $<