-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (42 loc) · 1.73 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: atorma <atorma@student.hive.fi> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/06/11 21:03:29 by atorma #+# #+# #
# Updated: 2024/06/17 19:06:05 by atorma ### ########.fr #
# #
# **************************************************************************** #
NAME = fdf
CC = cc
CFLAGS := -Wall -Wextra -Werror
LDFLAGS = -ldl -lglfw -pthread -lm
LIBDIR = ./libft
MLXDIR = ./MLX42
LIBS = $(LIBDIR)/libft.a $(MLXDIR)/build/libmlx42.a
INCLUDE_DIR = ./include
SOURCE_DIR = source
SOURCES = main.c fdf.c matrix.c map.c draw.c bresenham.c point.c color.c
OBJECTS = $(addprefix $(SOURCE_DIR)/,$(SOURCES:.c=.o))
target debug: CFLAGS += -fsanitize=address -static-libasan -g
target debug: CDEBUG = -DDEBUG=1
all: $(NAME)
export CFLAGS
$(NAME): $(OBJECTS)
cmake $(MLXDIR) -B $(MLXDIR)/build $(CDEBUG)
cmake --build $(MLXDIR)/build -j4
$(MAKE) -C $(LIBDIR)
$(CC) -o $@ $(CFLAGS) $^ $(LIBS) $(LDFLAGS)
$(SOURCE_DIR)/%.o: %.c
$(CC) -I$(INCLUDE_DIR) -c $(CFLAGS) $(LIBS) $< -o $@
clean:
$(MAKE) -C $(LIBDIR) $@
rm -rf $(MLXDIR)/build
rm -f $(OBJECTS)
fclean: clean
rm -f $(NAME)
re: fclean all
debug: re
.PHONY: debug all clean fclean re