-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (54 loc) · 1.78 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
define building
@echo -n "$(shell tput setaf 6)Building $1 $(shell tput sgr0)"
@make -sC $1 > /dev/null 2> /dev/null
@echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
endef
define compiling
@echo -n "$(shell tput bold)$(shell tput setaf 3)Compiling $1 $(shell tput sgr0)"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c $1 -o $2
@echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
endef
define finishing
@echo -n "$(shell tput bold)$(shell tput setaf 2)Finishing $1 $(shell tput sgr0)"
@$(CC) $(CFLAGS) $(CPPFLAGS) $(OBJS) -o $(NAME) $(LIBS) > /dev/null
@echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
endef
define cleaning
@echo -n "$(shell tput bold)$(shell tput setaf 8)Cleaning $1 $(shell tput sgr0)"
@make $2 -sC $1 > /dev/null
@echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
endef
define removing
@echo -n "$(shell tput bold)$(shell tput setaf 8)Removing $1 $(shell tput sgr0)"
@$(RM) $1 > /dev/null
@echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
endef
DONE = @echo "$(shell tput bold)$(shell tput setaf 2)√$(shell tput sgr0)"
SRCS = $(addprefix srcs/, \
algorithm.c \
colors.c \
hooks.c \
main.c \
display.c \
)
OBJS = $(SRCS:.c=.o)
NAME = fract-ol
RM = rm -f
CC = cc
CFLAGS = -Wall -Wextra -Werror -g -O3
CPPFLAGS = -I/usr/includes -I minilibx -I includes
LIBS = ./libft/libft.a minilibx/libmlx_Linux.a -lXext -lX11 -lm
%.o : %.c
$(call compiling,$<,$(<:.c=.o),0)
${NAME}: $(OBJS)
$(call building,libft)
$(call building,minilibx)
$(call finishing,$(NAME))
all: $(NAME)
clean:
$(call removing,$(OBJS))
fclean: clean
$(call cleaning,libft,fclean)
$(call cleaning,minilibx,clean)
$(call removing,fract-ol)
re: fclean all