-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (61 loc) · 1.45 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
74
75
76
SRC = main.c \
update_fractal.c \
color.c \
ft_atof.c \
ft_atosign.c \
julia.c \
key_hook.c \
mandelbrot.c \
mouse_hook.c \
parsing.c \
vela.c \
threads.c \
mouse_set.c \
hsv.c \
bmp.c \
TARGET = fractol
OBJDIR = objs
SRCDIR = src
INCLUDE_DIR = include
INC := -I $(INCLUDE_DIR)
OBJ = $(addprefix objs/, $(SRC:.c=.o))
MLX = ./MLX42/
MLX_LIB = $(addprefix $(MLX), libmlx42.a)
MLX_INC = -I ./MLX42/include
CFLAGS = -Wall -Werror -Wextra -pthread -Ofast $(INC)
# -fsanitize=address -g
# -fsanitize=thread -g
all: $(TARGET)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
MLXFLAGS = -ldl -lglfw
CFLAGS += -Wunused-result
else ifeq ($(UNAME_S), Darwin)
MLXFLAGS = -lglfw -L /Users/$(USER)/.brew/opt/glfw/lib/
endif
$(TARGET): $(OBJ)
@make -C MLX42
@echo "Compiling main executable"
@$(CC) $(OBJ) $(CFLAGS) $(INC) $(MLX_INC) $(MLX_LIB) $(MLXFLAGS) -lm -o $(TARGET)
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INCLUDE_DIR)/* Makefile
@mkdir -p $(dir $@)
@echo "Compiling: $<"
@$(CC) $(CFLAGS) $(INC) $(MLX_INC) -c -o $@ $<
mandelbrot: all
./$(TARGET) mandelbrot
vela: all
./$(TARGET) vela
clean:
@echo Cleaning Object Files
@make -C MLX42 clean
@rm -f $(OBJ)
pclean: clean
@echo Cleaning bmp files
@rm -f fractol*.bmp
fclean: clean
@echo Cleaning All Remaining Files
@make -C MLX42 fclean
@rm -f $(TARGET)
@rm -rf $(OBJDIR)
re: fclean all
.PHONY: all clean fclean re bonus