-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (73 loc) · 2.41 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: paperrin <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/11/03 12:00:36 by paperrin #+# #+# #
# Updated: 2017/08/05 23:49:11 by paperrin ### ########.fr #
# #
# **************************************************************************** #
NAME = fdf
CC = gcc
CFLAGS = -g -Wall -Wextra -Werror
RM = rm -rf
SRC_DIR = ./src/
OBJ_DIR = ./obj/
INC_DIRS = ./include/ \
./mlx/include/ \
LIB_DIRS = ./libft/ \
./mlx/
LIBS = -lft \
-lmlx
INC_PARAMS = $(INC_DIRS:%=-I%)
LIB_PARAMS = $(LIB_DIRS:%=-L%)
CFILES = fdf.c \
draw_line.c \
color.c \
map.c \
map_color.c \
render.c \
set_pixel.c \
clear_image.c \
put_info.c \
update_matrices.c \
event_handler.c \
event_handler2.c \
parse_args.c
HFILES = ./include/fdf.h
SRC = $(CFILES:%=$(SRC_DIR)%)
OBJ = $(CFILES:%.c=$(OBJ_DIR)%.o)
# # # # #
all : $(NAME)
$(NAME) : $(OBJ) $(HFILES)
make -C ./mlx/
make -C ./libft/
$(CC) $(OBJ) -o $@ $(LIB_PARAMS) $(LIBS) \
-framework OpenGL -framework Appkit
$(OBJ_DIR)%.o : $(SRC_DIR)%.c
mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) $(INC_PARAMS) -c $< -o $@
clean :
$(RM) $(OBJ_DIR)
make -C ./mlx/ clean
make -C ./libft/ clean
fclean : clean
$(RM) $(NAME)
make -C ./libft/ fclean
re : fclean all
norm :
@echo "\x1b[35m\n.==================[ \x1b[0m\c"
@echo "\x1b[35;1mNormi-Check\x1b[0m\c"
@echo " \x1b[35m]==================.\x1b[31;1m"
@norminette include/ src/ \
| tr "\n" "@" \
| sed -e "s/Norme: /$$/g" \
| tr "$$" "\n" \
| grep -e Error -e Warning \
| tr "@" "\n" \
| sed "N;$$!P;$$!D;$$d"
@echo "\x1b[0m\x1b[35m\c"
@echo ".___________________________________________________.\n\x1b[0m"
.PHONY : all, clean, fclean, re, norm