-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (43 loc) · 940 Bytes
/
Makefile
File metadata and controls
64 lines (43 loc) · 940 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
### VARS ###
UNAME_S := $(shell uname -s)
### PROGRAM ###
NAME = out
### COMPILER ###
CXX = c++
CXXFLAGS = -std=c++98 -Wall -Wextra -Werror -MD
### SOURCES ###
SRC = main.cpp \
Weapon.cpp \
HumanA.cpp \
HumanB.cpp \
OBJ = $(SRC:%.cpp=%.o)
DEP = $(SRC:%.cpp=%.d)
### RULES ###
PHONY := all
all: $(NAME)
$(NAME): $(OBJ)
$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ)
PHONY += sanitize
ifeq ($(UNAME_S),Linux)
sanitize: CXXFLAGS += -pedantic -g3 -fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=bounds -fsanitize=null
endif
ifeq ($(UNAME_S),Darwin)
sanitize: CXXFLAGS += -pedantic -g3 -fsanitize=address
endif
sanitize: $(NAME)
PHONY += thread
thread: CXXFLAGS += -g3 -fsanitize=thread
thread: $(NAME)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
PHONY += clean
clean:
rm -rf $(OBJ)
rm -rf $(DEP)
PHONY += fclean
fclean: clean
rm -rf $(NAME)
PHONY += re
re: fclean all
-include $(DEP)
.PHONY: $(PHONY)