cub3d/Makefile
2023-10-25 14:07:29 +02:00

65 lines
2.1 KiB
Makefile

# **************************************************************************** #
# #
# .--. _ #
# Makefile :+: :+: #
# |:_/ || |_ _ ___ __ #
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
# (| | )|_| |_| |> < #
# Created: 2022/11/24 10:12:10 by djonker /'\_ _/`\__|\__,_/_/\_\ #
# Updated: 2023/10/25 14:06:02 by djonker ######## odam.nl #
# #
# **************************************************************************** #
NAME =cub3d
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
SRC =src/main.c\
src/colors.c\
src/zoommove.c\
src/keyhooks.c\
src/mousehooks.c\
src/print.c\
src/error.c\
src/fractal.c\
src/fractals1.c\
src/fractals2.c
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
@$(RM) $(NAME) mlx/build > /dev/null
@$(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