87 lines
2.1 KiB
Makefile
87 lines
2.1 KiB
Makefile
# **************************************************************************** #
|
|
# #
|
|
# ::: :::::::: #
|
|
# Makefile :+: :+: :+: #
|
|
# +:+ +:+ +:+ #
|
|
# By: gbrochar <marvin@42.fr> +#+ +:+ +#+ #
|
|
# +#+#+#+#+#+ +#+ #
|
|
# Created: 2019/02/06 12:13:51 by gbrochar #+# #+# #
|
|
# Updated: 2019/02/22 09:14:49 by gbrochar ### ########.fr #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
NAME = rtv1
|
|
|
|
SRC_FILE = main.c \
|
|
parse.c \
|
|
mlx.c \
|
|
mlx_events.c \
|
|
color.c \
|
|
vec.c \
|
|
vec_arithmetics.c \
|
|
env_list.c \
|
|
set_camera.c \
|
|
scene_params.c \
|
|
add_spot.c \
|
|
add_plane.c \
|
|
add_sphere.c \
|
|
add_cylinder.c \
|
|
add_cone.c \
|
|
raytrace.c \
|
|
ray.c \
|
|
phong.c \
|
|
maths.c \
|
|
maths_plane.c \
|
|
maths_sphere.c \
|
|
maths_cylinder.c \
|
|
maths_cone.c \
|
|
|
|
OBJ_FILE = $(SRC_FILE:.c=.o)
|
|
|
|
SRC_DIR = src/
|
|
OBJ_DIR = obj/
|
|
|
|
SRC = $(addprefix $(SRC_DIR), $(SRC_FILE))
|
|
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE))
|
|
|
|
LIB = libft/libft.a -lm -lmlx -framework Appkit -framework OpenGL
|
|
|
|
CC = gcc
|
|
|
|
CFLAGS = -Wall -Werror -Wextra
|
|
|
|
RED = \033[31m
|
|
GREEN = \033[32m
|
|
YELLOW = \033[33m
|
|
BLUE = \033[34m
|
|
CYAN = \033[36m
|
|
WHITE = \033[0m
|
|
|
|
all: $(NAME)
|
|
|
|
$(NAME): $(OBJ) $(SRC_DIR)rtv1.h
|
|
@make -C libft
|
|
@$(CC) $(CFLAGS) -c $(SRC)
|
|
@mv $(OBJ_FILE) $(OBJ_DIR)
|
|
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB)
|
|
@echo "$(GREEN)[OK]$(WHITE) RTv1"
|
|
|
|
$(OBJ_DIR)%.o: $(SRC_DIR)%.c libft/ $(SRC_DIR)rtv1.h
|
|
@if [ ! -d ./obj ]; then \
|
|
mkdir -p ./obj; \
|
|
fi;
|
|
@$(CC) $(CFLAGS) -I libft/ -o $@ -c $<
|
|
@echo "$(CYAN)[CC]$(WHITE) $<"
|
|
|
|
clean:
|
|
@make -C libft clean
|
|
@rm -rf $(OBJ_DIR)
|
|
|
|
fclean: clean
|
|
@make -C libft fclean
|
|
@rm -f $(NAME)
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: all clean fclean re
|