-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (33 loc) · 1013 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
50
NAME = cub3D
SRC = cube.c matrix.c check_map.c movement.c utils.c raycasting.c raycasting2.c texture.c fence.c
SRC_DIR = ./Src/
OBJ_DIR = ./Src/.obj/
LINK = ./minilibx-linux/libmlx_Linux.a -lX11 -lXext -lm
SRCP = $(addprefix $(SRC_DIR),$(SRC))
OBJP = $(addprefix $(OBJ_DIR),$(notdir $(SRCP:.c=.o)))
CFLAGS = -Wall -Wextra -Werror -fPIE -g
LIB = ./Src/MyLib/mylib.a
all: lib $(NAME)
lib:
@echo "\033[32mCompiling $(NAME) 🚀"
make -s -C Src/MyLib
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
@mkdir -p $(OBJ_DIR)
@$(CC) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJP)
@make -sC minilibx-linux
@gcc $(CFLAGS) $(OBJP) $(LIB) $(LINK) -o $(NAME)
@echo "\033[32mCompiled ✅\033[0;37m"
clean:
@echo "\033[0;31mCleaning objects 🧹"
@rm -rf $(OBJ_DIR)
@rm -rf minilibx-linux/*.o
@make clean -s -C Src/MyLib
fclean: clean
@echo "\033[0;31mRemoving $(NAME) 🗑\033[0;37m"
@rm -rf $(NAME)
@rm -rf minilibx-linux/*.a
@make fclean -s -C Src/MyLib
re: fclean all
.SILENT: $(OBJ) lib
.PHONY: all lib clean fclean re