-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 789 Bytes
/
Copy pathMakefile
File metadata and controls
43 lines (30 loc) · 789 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
# Compiler and flags
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98 -pedantic -O3
RM = rm -rf
NAME = PmergeMe
# Directories
BUILD_DIR = build
SRC_DIR = src
# Source and Header Files
SRC = $(wildcard $(SRC_DIR)/*.cpp)
HEADERS = $(wildcard $(SRC_DIR)/*.hpp) $(wildcard $(SRC_DIR)/*.tpp)
# Object Files
OBJ = $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRC))
DEP = $(OBJ:.o=.d)
# Rules
all: $(NAME)
$(NAME): $(BUILD_DIR) $(OBJ)
$(CXX) $(CXXFLAGS) $(OBJ) -o $@
$(BUILD_DIR):
mkdir -p $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@ -I$(SRC_DIR)
clean:
$(RM) $(BUILD_DIR)
fclean: clean
$(RM) $(NAME)
re: fclean all
-include $(DEP)
.PHONY: all clean fclean re
.SILENT: