-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·71 lines (45 loc) · 1.44 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
include makefile.srcs
NAME = miniRT
SRCS_DIR = srcs
OBJS_DIR = objs
OBJS = $(addprefix $(OBJS_DIR)/, $(SRCS:.c=.o))
D_FILES = $(addprefix $(OBJS_DIR)/, $(SRCS:.c=.d))
INCLUDES = -Iincludes -I./libs/libft -I./libs/minilibx_macos
H_FILES = includes/minirt.h \
includes/parsing.h \
includes/error.h \
includes/structure_prototypes.h \
libs/minilibx_macos/mlx.h
XLIB = mlx
XLIBDIR = libs/minilibx_macos
LIB_MLX = $(XLIBDIR)/libmlx.a
CC = gcc
CFLAGS = -Wall -Wextra -Werror
XFLAGS = -framework OpenGL -framework AppKit
OPTFLAGS = -MMD -MP -g -O2
RM = rm -rf
all : $(dir $(LIB_MLX)) $(NAME)
$(NAME) : $(OBJS) $(LIB_MLX)
$(CC) $(OBJS) -L$(XLIBDIR) -l$(XLIB) $(XFLAGS) -o $(NAME)
bonus : all
.SECONDEXPANSION:
${OBJS} : $$(patsubst %.o, %.c, $$(subst ${OBJS_DIR}/, ${SRCS_DIR}/, $${@}))
@mkdir -p ${@D}
${CC} ${CFLAGS} ${OPTFLAGS} ${INCLUDES} -c $< -o $@
-include ${OBJS:.o=.d}
norm :
@norminette srcs/* includes/*
$(dir $(LIB_MLX)) :
@make -C $@ $(MAKECMDGOALS)
clean : $(dir $(LIB_FT))
@$(RM) $(OBJS) $(D_FILES)
@echo "\033[1;38;5;221m* MLX objects removed\033[0m"
@echo "\033[1;38;5;221m* miniRT objects removed\033[0m"
fclean : clean
@$(RM) $(NAME)
@$(MAKE) clean -C $(XLIBDIR)
@#rm -rf objs
@rm -rf *.dSYM
@echo "\033[1;38;5;221m* miniRT program removed\033[0m"
re : fclean all
.PHONY: all bonus clean fclean $(dir $(LIB_MLX)) re norm