forked from heikkiseppanen/42-wordle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (34 loc) · 793 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
43
44
45
46
47
48
49
50
51
# Meta
NAME := wordle
SRCDIR := ./src
OBJDIR := ./obj
INCDIR := ./includes
SRC :=\
main.cpp \
word.cpp \
game.cpp\
Guess_class.cpp
OBJ := $(addprefix $(OBJDIR)/,$(SRC:.cpp=.o))
DEP := $(OBJ:%.o=%.d)
ARCH := $(shell uname)
# Compilation and linking
CPP := c++
CPPFLAGS := -Wall -Werror -Wextra -std=c++17 -I$(INCDIR)
# Rules
all: $(NAME)
debug: CPPFLAGS+= -g -fsanitize=address,undefined
debug: LDFLAGS+= -g -fsanitize=address,undefined
debug: $(NAME)
$(NAME): $(OBJ)
$(CPP) -o $(NAME) $(OBJ) $(LDFLAGS)
# Include dependency info
-include $(DEP)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@$(shell [ ! -d $(@D) ] && mkdir -p $(@D))
$(CPP) $(CPPFLAGS) -MMD -c $< -o $@
clean:
/bin/rm -rf $(OBJDIR)
fclean: clean
/bin/rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re debug