CC=cc
SANITIZERS=
#-fsanitize=address -fno-omit-frame-pointer
CFLAGS=-Wall -Wextra -Werror -ggdb $(SANITIZERS) -I mlx
SOURCEFILES=src/main.c \
	    src/map/map_checker.c \
		src/map/checkers.c \
		src/map/setters.c \
		src/utils/frees.c
OBJECTS=$(patsubst src/%.c,objects/%.o,$(SOURCEFILES))
OBJDIR=objects
NAME=cub3d

all: $(OBJECTS) $(NAME)

$(NAME): $(OBJECTS)
	$(MAKE) -C mlx/
	$(MAKE) -C libft/
	cp libft/libft.a .
	$(CC) $(CFLAGS) $(OBJECTS) -o $(NAME) -L. -lft -Lmlx -lmlx -lz -lXext -lX11

$(OBJDIR)/%.o: src/%.c
	$(CC) $(CFLAGS) -Imlx -c $< -o $@

clean:
	rm -f $(OBJECTS) 

fclean: clean
	rm -f $(NAME)

re: fclean all

.PHONY: all clean fclean re
