-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (60 loc) · 1.94 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: logan <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/03/13 10:03:24 by logan #+# #+# #
# Updated: 2018/06/20 22:45:48 by lkaser ### ########.fr #
# #
# **************************************************************************** #
NAME = nibbler
LIST = main \
Game \
Time
SRC_DIR = src
OBJ_DIR = obj
OBJ = $(addsuffix .o, $(addprefix $(OBJ_DIR)/, $(LIST)))
DEP = $(OBJ:%.o=%.d)
CC = clang++
SUB = ncurses sfml opengl
CPPFLAGS = -std=c++14 -Wall -Wextra -Werror \
-O3 -g -march=native \
$(shell pkg-config --cflags glm) \
# -fsanitize=address -fsanitize=undefined
LDFLAGS = \
$(shell pkg-config --libs glm) \
#-fsanitize=address -fsanitize=undefined
all: $(OBJ_DIR) $(NAME)
$(NAME): $(OBJ)
@for s in $(SUB);\
do\
make -sC $$s;\
done
@printf "\e[32;1mLinking.. \e[0m\n"
@$(CC) $(LDFLAGS) -o $@ $^
@printf "\e[32;1mCreated:\e[0m %s\n" $(NAME)
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
-include $(DEP)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@printf "\e[34;1mCompiling: \e[0m%s\n" $<
@$(CC) $(CPPFLAGS) -MMD -c $< -o $@
clean:
@for s in $(SUB);\
do\
make -sC $$s clean;\
done
@printf "\e[31;1mCleaning..\e[0m\n"
@rm -f $(OBJ) $(DEP)
fclean:
@for s in $(SUB);\
do\
make -sC $$s fclean;\
done
@printf "\e[31;1mFull Cleaning..\e[0m\n"
@rm -rf $(OBJ_DIR)
@rm -f $(NAME)
re: fclean all
.PHONY: clean fclean all re