-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (71 loc) · 2.18 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: bhivert <bhivert@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/01/01 16:50:57 by bhivert #+# #+# #
# Updated: 2017/08/20 16:16:13 by bhivert ### ########.fr #
# #
# **************************************************************************** #
.PHONY: all, clean, fclean, re, _make, _make_clean, _make_fclean
.SUFFIXES:
NAME = fdf
DEBUG = 0
ifeq ($(DEBUG), 0)
CC = gcc
CFLAGS = -Wall -Wextra -Werror $(INCS_FLAGS) -O3
else
CC = cc
CFLAGS = -Wall -Wextra $(INCS_FLAGS) -g3
endif
DEPENDS = libui/libui.a \
lib3d/lib3d.a \
libft/libft.a \
LIBS_DIR = -Llibui \
-Llib3d \
-Llibft \
LIBS = -lui \
-l3d \
-lft \
-lm \
-lmlx \
-lXext \
-lX11 \
-lpthread \
# -framework OpenGL \
# -framework AppKit \
INCS_FLAGS = -Iincludes \
SUB_MAKE = libui \
lib3d \
libft \
SRCS_DIR = srcs
SRCS_SRCS =$(SRCS_DIR)/fdf_bresenham.c \
$(SRCS_DIR)/fdf_color.c \
$(SRCS_DIR)/fdf_create_ui.c \
$(SRCS_DIR)/fdf_draw.c \
$(SRCS_DIR)/fdf_get_file.c \
$(SRCS_DIR)/main.c \
SRCS = $(SRCS_SRCS) \
OBJS = $(SRCS:.c=.o)
all : _make $(NAME)
$(NAME) : $(OBJS)
$(CC) $(CFLAGS) $^ $(LIBS_DIR) $(LIBS) -o $@
%.o : %.c $(DEPENDS)
$(CC) $(CFLAGS) -c $< -o $@
clean : _make_clean
rm -rf $(OBJS)
fclean : _make_fclean clean
rm -rf $(NAME)
re : fclean all
_make :
ifeq ($(DEBUG), 2)
$(foreach MAKE, $(SUB_MAKE),make -C $(MAKE) DEBUG=$(DEBUG);)
else
$(foreach MAKE, $(SUB_MAKE),make -C $(MAKE);)
endif
_make_clean :
$(foreach MAKE, $(SUB_MAKE),make -C $(MAKE) clean;)
_make_fclean :
$(foreach MAKE, $(SUB_MAKE),make -C $(MAKE) fclean;)