mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
59 lines
1.3 KiB
Makefile
59 lines
1.3 KiB
Makefile
CC = cc
|
|
# -fno-omit-frame-pointer is to prevent malloc stacktraces from being truncated,
|
|
# see "My malloc stacktraces are too short" here:
|
|
# https://github.com/google/sanitizers/wiki/AddressSanitizer
|
|
SANITIZERS = -fsanitize=address,undefined -fno-omit-frame-pointer
|
|
ifeq ($(CFLAGS),)
|
|
CFLAGS = -Wall -Wextra -Werror -g
|
|
endif
|
|
IFLAGS = -I./mlx -I./libft
|
|
|
|
SOURCEFILES = \
|
|
src/draw/draw_map.c \
|
|
src/draw/drawutils.c \
|
|
src/main.c \
|
|
src/map/checkers.c \
|
|
src/map/forbidden_characters.c \
|
|
src/map/populate_map.c \
|
|
src/map/setters.c \
|
|
src/utils/frees.c \
|
|
src/utils/hooks.c \
|
|
src/map/map_checker.c \
|
|
|
|
OBJECTS = $(SOURCEFILES:.c=.o)
|
|
NAME = cub3d
|
|
DEPS = $(OBJECTS:.o=.d)
|
|
|
|
.PHONY: all clean fclean bonus re sane
|
|
|
|
all: $(OBJECTS) $(NAME)
|
|
|
|
-include $(DEPS)
|
|
|
|
$(NAME): $(OBJECTS)
|
|
if [[ "$$(echo $$LD_LIBRARY_PATH | grep -c minilibx)" == "0" ]]; then $(MAKE) CC=cc -C mlx/; fi
|
|
+$(MAKE) -C libft/
|
|
$(CC) $(CFLAGS) $(IFLAGS) $(OBJECTS) -o $(NAME) -Llibft -Lmlx -lft -lmlx -lz -lXext -lX11
|
|
|
|
%.o: %.c
|
|
$(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c
|
|
$(CC) -MM $(CFLAGS) $(IFLAGS) -MT $*.o $*.c > $*.d
|
|
|
|
clean:
|
|
+make -C libft clean
|
|
find . -name '*.o' -print -delete
|
|
find . -name '*.d' -print -delete
|
|
|
|
fclean: clean
|
|
+make -C libft fclean
|
|
rm -f $(NAME)
|
|
|
|
bonus: CFLAGS += -D BONUS=1
|
|
bonus: all
|
|
|
|
sane: CFLAGS += $(SANITIZERS)
|
|
sane: all
|
|
|
|
re:
|
|
+make fclean
|
|
+make all
|