cub3d/Makefile
2023-10-25 13:56:45 +02:00

73 lines
2.3 KiB
Makefile

# **************************************************************************** #
# #
# .--. _ #
# Makefile :+: :+: #
# |:_/ || |_ _ ___ __ #
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
# (| | )|_| |_| |> < #
# Created: 2022/11/24 10:12:10 by djonker /'\_ _/`\__|\__,_/_/\_\ #
# Updated: 2023/10/25 13:53:30 by djonker ######## odam.nl #
# #
# **************************************************************************** #
NAME =fract-ol
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)
ifeq ($(UNAME_S),Linux)
OS =Freedom Respecting Linux! :)
LIB =libft/libft.a mlx/build/libmlx42.a -ldl -lglfw -pthread -lm
else
OS =Proprietary Malware :(
LIB =libft/libft.a mlx/build/libmlx42.a -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit
endif
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
@$(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:
@cd mlx
@cmake -S mlx -B mlx/build
@$(MAKE) -C mlx/build -j4
@cd ..
.PHONY: libft