2023-10-25 13:56:45 +02:00
|
|
|
# **************************************************************************** #
|
|
|
|
# #
|
|
|
|
# .--. _ #
|
|
|
|
# Makefile :+: :+: #
|
|
|
|
# |:_/ || |_ _ ___ __ #
|
|
|
|
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
|
|
|
|
# (| | )|_| |_| |> < #
|
|
|
|
# Created: 2022/11/24 10:12:10 by djonker /'\_ _/`\__|\__,_/_/\_\ #
|
2023-10-26 10:45:19 +02:00
|
|
|
# Updated: 2023/10/26 10:43:49 by houtworm ######## odam.nl #
|
2023-10-25 13:56:45 +02:00
|
|
|
# #
|
|
|
|
# **************************************************************************** #
|
|
|
|
|
2023-10-25 14:07:29 +02:00
|
|
|
NAME =cub3d
|
2023-10-25 13:56:45 +02:00
|
|
|
CC =gcc
|
|
|
|
FC =-Wall -Werror -Wextra -Wunreachable-code -Ofast #-fsanitize=address
|
|
|
|
HEAD =-I ./include -I $(MLX)/include
|
|
|
|
RM =rm -rf
|
|
|
|
UNAME_S :=$(shell uname -s)
|
|
|
|
LIB =libft/libft.a mlx/build/libmlx42.a -ldl -lglfw -pthread -lm
|
2023-10-26 10:45:19 +02:00
|
|
|
SRC =src/main.c
|
2023-10-25 13:56:45 +02:00
|
|
|
OBJ =$(SRC:src/%.c=obj/%.o)
|
|
|
|
|
|
|
|
all: libft libmlx $(NAME)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@$(RM) -r obj
|
|
|
|
@$(MAKE) -C libft clean > /dev/null
|
|
|
|
@$(MAKE) -C mlx/build clean > /dev/null
|
|
|
|
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
|
|
|
|
|
|
|
fclean: clean
|
2023-10-25 14:07:29 +02:00
|
|
|
@$(RM) $(NAME) mlx/build > /dev/null
|
2023-10-25 13:56:45 +02:00
|
|
|
@$(MAKE) -C libft fclean > /dev/null
|
|
|
|
@printf "\e[1;31mCleaned Executables\n\e[0;00m"
|
|
|
|
|
|
|
|
re: fclean all
|
|
|
|
|
|
|
|
$(OBJ): $(SRC)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
|
|
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
|
|
|
|
|
|
|
$(NAME): $(OBJ)
|
|
|
|
@printf "\e[1;36mCompiling $@\e[0;00m\n"
|
|
|
|
@$(CC) $(FC) -o $(NAME) $(SRC) $(LIB) $(HEAD)
|
|
|
|
@printf "\e[1;32mDone\e[0;00m\n"
|
|
|
|
|
|
|
|
libft:
|
|
|
|
@$(MAKE) -C libft all
|
|
|
|
|
|
|
|
libmlx:
|
|
|
|
@cmake -S mlx -B mlx/build
|
|
|
|
@$(MAKE) -C mlx/build -j4
|
|
|
|
|
|
|
|
.PHONY: libft
|