-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (34 loc) · 890 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
CC = gcc
FLAGS = -Wall -Wextra -Werror
FILE_NAME = fractol
MLX = -L /usr/local/lib/ -lmlx -lX11 -lXext -lm
SRC_DIR = src
OBJ_DIR = obj
SRCS = $(shell find . -name "*.c")
OBJS = $(subst $(SRC_DIR),$(OBJ_DIR), $(SRCS:.c=.o))
INCLUDE = -I ./include/
RM = rm -rf
# Colors
RESET = \033[0m
RED = \033[31m
GREEN = \033[32m
YELLOW = \033[33m
all: $(FILE_NAME)
bonus: all
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(OBJ_DIR)
@echo "$(YELLOW)Compiling $<...$(RESET)"
@$(CC) $(FLAGS) $(INCLUDE) -c $< -o $@
$(FILE_NAME): $(OBJS)
@echo "$(YELLOW)Linking $(FILE_NAME)...$(RESET)"
@$(CC) $(FLAGS) $(INCLUDE) $^ $(MLX) -o $(FILE_NAME)
@echo "$(GREEN)Done!$(RESET)"
clean:
@echo "$(RED)Cleaning...$(RESET)"
@$(RM) $(OBJS)
@echo "$(GREEN)Done!$(RESET)"
fclean: clean
@echo "$(RED)Removing out file...$(RESET)"
@$(RM) $(FILE_NAME)
@echo "$(GREEN)Done!$(RESET)"
re: fclean all