-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile0
82 lines (60 loc) · 1.67 KB
/
Makefile0
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
### FILES AND DIRECTORIES ###
NAME = fractol
GC = gcc
CFLAGS = -std=c89# -g -Wall -Werror -Wextra -Imlx # -fsanitize=address
DIR_FRACTOL = src
DIR_OBJ = obj
FILES_FRACTOL = \
fractol init quatmath events2d events2d2 events3d manage2d create2d \
create3d cloud
FILES_SRC += $(addprefix $(DIR_FRACTOL)/, $(FILES_FRACTOL))
FILES_OBJ = $(addprefix $(DIR_OBJ)/, $(addsuffix .o, $(FILES_FRACTOL)))
MLX_NAME_LINUX = libmlx_Linux
MLX_NAME_MAC = libmlx_Mac
RM = rm -rf
OS := $(shell uname -s)
ifeq (${OS},Linux)
CFLAGS += -D LINUX
MLX = lib/minilibx-linux/
MLX_NAME = ${MLX_NAME_LINUX}.a
LIBS = -lm -lmlx_Linux -lXext -lX11#-lz
endif
ifeq (${OS},Darwin)
CFLAGS += -w -D OSX
MLX = lib/minilibx-mac/
MLX_NAME = ${MLX_NAME_MAC}.a
LIBS = -lmlx -framework OpenGL -framework AppKit
endif
MLX_LNK = -L ${MLX}
INCLUDES = -I ./${MLX} -I ./inc
#####################
### PROGRAM RULES ###
#####################
all: $(NAME)
${DIR_OBJ}/%.o: ${DIR_FRACTOL}/%.c
@${GC} ${CFLAGS} ${INCLUDES} -c $< -o $@ ${LIBS}
@echo "COMPILED OBJECT $@"
$(NAME): ${MLX_NAME} ${DIR_OBJ} ${FILES_OBJ}
${GC} ${CFLAGS} ${FILES_OBJ} -o ${NAME} ${MLX_LNK} ${LIBS}
@echo "SUCCESSFULLY COMPILED $(NAME)"
${MLX_NAME} :
make -C ${MLX}
cp ${MLX}${MLX_NAME} .
$(DIR_OBJ):
mkdir -p $(DIR_OBJ) 2> /dev/null
bonus: all
###################
### CLEAN RULES ###
###################
clean:
@make clean -C ${MLX}
# @${RM} *.a ${DIR_OBJ}/*.o *.dSYM
@${RM} *.a ${DIR_OBJ} *.dSYM
@echo "-FRACTOL- OBJECTS DELETED. CLEAN SUCCESSFUL!"
fclean: clean
@${RM} ${MLX_NAME}
@${RM} ${NAME}
@echo "GRAPHICS LIBRARY DELETED. CLEAN SUCCESSFUL!"
@echo "-FRACTOL- LIBRARY DELETED. CLEAN SUCCESSFUL!"
re: fclean all
.PHONY: clean re fclean all