Skip to content

Commit c345d01

Browse files
author
Sejin Park
committed
change project folder structure
1 parent 3b37265 commit c345d01

File tree

179 files changed

+527
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+527
-365
lines changed

src/Makefile renamed to Makefile

+29-20
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,45 @@
66
# By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2020/11/10 17:57:28 by sejpark #+# #+# #
9-
# Updated: 2021/05/07 15:59:51 by sejpark ### ########.fr #
9+
# Updated: 2021/05/23 19:57:10 by sejpark ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

13-
SRC = main.c renderer1.c renderer2.c renderer3.c bmp_creator.c \
14-
vec1.c vec2.c vec3.c ray.c random.c camera.c \
15-
hittable.c hittable_list1.c hittable_list2.c \
16-
scene_reader1.c scene_reader2.c parser_util1.c parser_util2.c \
17-
parser_util3.c parser_list.c error_handler.c \
18-
parser_ambient.c parser_resolution.c parser_camera.c \
19-
parser_light.c parser_sphere.c parser_plane.c parser_square.c \
20-
parser_cylinder.c parser_triangle.c get_next_line.c \
21-
sphere.c plane.c square.c cylinder1.c cylinder2.c triangle.c \
22-
light.c
23-
OBJS = ${SRC:.c=.o}
13+
#SRC = main.c renderer1.c renderer2.c renderer3.c bmp_creator.c \
14+
# vec1.c vec2.c vec3.c ray.c random.c camera.c \
15+
# hittable.c hittable_list1.c hittable_list2.c \
16+
# scene_reader1.c scene_reader2.c parser_util1.c parser_util2.c \
17+
# parser_util3.c parser_list.c error_handler.c \
18+
# parser_ambient.c parser_resolution.c parser_camera.c \
19+
# parser_light.c parser_sphere.c parser_plane.c parser_square.c \
20+
# parser_cylinder.c parser_triangle.c get_next_line.c \
21+
# sphere.c plane.c square.c cylinder1.c cylinder2.c triangle.c \
22+
# light.c
23+
#OBJS = ${SRC:.c=.o}
24+
25+
INC_DIR = includes
26+
27+
SRC_DIR = srcs
28+
SRCS = ${wildcard ${SRC_DIR}/*.c}
29+
30+
OBJ_DIR = objs
31+
OBJS = ${SRCS:${SRC_DIR}/%.c=${OBJ_DIR}/%.o}
32+
2433
NAME = miniRT
2534
LIBFT = libft.a
26-
LIBFTPATH = libft
35+
LIBFTPATH = ./library/libft
2736
MLX = libmlx.dylib
28-
MLXPATH = ./
37+
MLXPATH = ./library/mlx
2938
CC = gcc
30-
RM = rm -f
39+
RM = rm -rf
3140
CFLAGS = -Wall -Wextra -Werror
3241
FRAMEWORK = -framework OpenGL -framework Appkit
3342

3443
all : ${NAME}
3544

3645
${NAME} : ${LIBFT} ${OBJS}
3746
@echo "\n\033[0;32mminiRT Building..."
38-
${CC} ${CFLAGS} -L${LIBFTPATH} -lft -L${MLXPATH} -lmlx \
39-
${FRAMEWORK} -o ${NAME} ${OBJS}
47+
${CC} ${CFLAGS} -L./ -lft -L./ -lmlx ${FRAMEWORK} -o ${NAME} ${OBJS}
4048
@echo "\033[0m"
4149

4250
${LIBFT} :
@@ -46,15 +54,16 @@ ${LIBFT} :
4654
cp ${LIBFTPATH}/${LIBFT} ./
4755
@echo "\033[0m"
4856

49-
.c.o :
57+
${OBJ_DIR}/%.o: ${SRC_DIR}/%.c
5058
@echo "\n\033[0;32mminiRT Compiling..."
51-
${CC} ${CFLAGS} -c $< -o ${<:.c=.o}
59+
mkdir -p ${OBJ_DIR}
60+
${CC} ${CFLAGS} -c $< -o ${<:${SRC_DIR}/%.c=${OBJ_DIR}/%.o}
5261
@echo "\033[0m"
5362

5463
clean :
5564
@echo "\033[0;31mCleaning..."
5665
cd ${LIBFTPATH}; make clean
57-
${RM} ${OBJS}
66+
${RM} ${OBJS} ${OBJ_DIR}
5867
@echo "\033[0m"
5968

6069
fclean : clean
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/error_handler.h renamed to includes/error_handler.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
/* ::: :::::::: */
44
/* error_handler.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2021/03/09 21:42:00 by sejpark #+# #+# */
9-
/* Updated: 2021/03/11 11:09:19 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 19:53:48 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#ifndef ERROR_HANDLER_H
1414
# define ERROR_HANDLER_H
1515
# include "struct_set.h"
1616
# include "parser_util.h"
17-
# include "libft/libft.h"
17+
# include "../library/libft/includes/libft.h"
1818

1919
void error_handler(char *str, t_engine *engine);
2020

src/get_next_line.h renamed to includes/get_next_line.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/* ::: :::::::: */
44
/* get_next_line.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/23 12:05:45 by sejpark #+# #+# */
9-
/* Updated: 2021/03/08 12:45:25 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 19:54:00 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -15,7 +15,7 @@
1515
# include <stdlib.h>
1616
# include <unistd.h>
1717
# include <limits.h>
18-
# include "libft/libft.h"
18+
# include "../library/libft/includes/libft.h"
1919

2020
int get_next_line(int fd, char **line);
2121

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/parser_util.h renamed to includes/parser_util.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/* ::: :::::::: */
44
/* parser_util.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2021/03/09 16:26:12 by sejpark #+# #+# */
9-
/* Updated: 2021/03/13 14:52:26 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 19:54:21 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -15,7 +15,7 @@
1515
# include "struct_set.h"
1616
# include "vec.h"
1717
# include "hittable_list.h"
18-
# include "libft/libft.h"
18+
# include "../library/libft/includes/libft.h"
1919
# include "error_handler.h"
2020

2121
void ft_free_all(t_engine *engine);
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/renderer.h renamed to includes/renderer.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/* ::: :::::::: */
44
/* renderer.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2021/03/02 17:06:06 by sejpark #+# #+# */
9-
/* Updated: 2021/03/12 10:36:48 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 19:55:40 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -18,7 +18,7 @@
1818
# define KEYPRESS 2
1919
# define KEYRELEASE 3
2020
# include "mlx.h"
21-
# include "libft/libft.h"
21+
# include "../library/libft/includes/libft.h"
2222
# include "scene_reader.h"
2323
# include <stdio.h>
2424
# include <stdlib.h>

src/scene_reader.h renamed to includes/scene_reader.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
/* ::: :::::::: */
44
/* scene_reader.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2021/03/02 17:21:49 by sejpark #+# #+# */
9-
/* Updated: 2021/03/11 14:32:41 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 19:55:40 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#ifndef SCENE_READER_H
1414
# define SCENE_READER_H
1515
# include "mlx.h"
1616
# include "get_next_line.h"
17-
# include "libft/libft.h"
17+
# include "../library/libft/includes/libft.h"
1818
# include "vec.h"
1919
# include "ray.h"
2020
# include "hittable_list.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/libft/.Makefile.swp

12 KB
Binary file not shown.

library/libft/Makefile

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# **************************************************************************** #
2+
# #
3+
# ::: :::::::: #
4+
# Makefile :+: :+: :+: #
5+
# +:+ +:+ +:+ #
6+
# By: sejpark <marvin@42.fr> +#+ +:+ +#+ #
7+
# +#+#+#+#+#+ +#+ #
8+
# Created: 2020/07/01 11:32:37 by sejpark #+# #+# #
9+
# Updated: 2021/05/23 18:51:00 by sejpark ### ########.fr #
10+
# #
11+
# **************************************************************************** #
12+
13+
#LIB_SRC = ft_memset.c ft_bzero.c ft_memcpy.c ft_memccpy.c ft_memmove.c \
14+
# ft_memchr.c ft_memcmp.c ft_strlen.c ft_strlcpy.c ft_strlcat.c \
15+
# ft_strchr.c ft_strrchr.c ft_strnstr.c ft_strncmp.c ft_isalpha.c \
16+
# ft_isdigit.c ft_isalnum.c ft_isascii.c ft_isprint.c ft_tolower.c \
17+
# ft_toupper.c ft_atoi.c ft_calloc.c ft_strdup.c ft_substr.c \
18+
# ft_strjoin.c ft_strtrim.c ft_split.c ft_itoa.c ft_strmapi.c \
19+
# ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c ft_putnbr_fd.c
20+
#
21+
#BONUS_SRC = \
22+
# ft_lstnew.c ft_lstadd_front.c ft_lstsize.c ft_lstlast.c \
23+
# ft_lstadd_back.c ft_lstdelone.c ft_lstclear.c ft_lstiter.c \
24+
# ft_lstmap.c
25+
#
26+
#LIB_OBJS = ${LIB_SRC:.c=.o}
27+
#BONUS_OBJS = ${BONUS_SRC:.c=.o}
28+
29+
INC_DIR = includes
30+
31+
LIB_SRC_DIR = srcs/lib
32+
BONUS_SRC_DIR = srcs/bonus
33+
34+
OBJ_DIR = objs
35+
LIB_OBJ_DIR = objs/lib
36+
BONUS_OBJ_DIR = objs/bonus
37+
38+
LIB_SRCS = ${wildcard ${LIB_SRC_DIR}/*.c}
39+
BONUS_SRCS = ${wildcard ${BONUS_SRC_DIR}/*.c}
40+
41+
LIB_OBJS = ${LIB_SRCS:${LIB_SRC_DIR}/%.c=${LIB_OBJ_DIR}/%.o}
42+
BONUS_OBJS = ${BONUS_SRCS:${BONUS_SRC_DIR}/%.c=${BONUS_OBJ_DIR}/%.o}
43+
44+
AR = ar
45+
NAME = libft.a
46+
CC = gcc
47+
RM = rm -rf
48+
CFLAGS = -Wall -Wextra -Werror
49+
INCPATH = ./
50+
51+
all : ${NAME}
52+
53+
lib_obj :
54+
mkdir -p ${LIB_OBJ_DIR}
55+
56+
bonus_obj :
57+
mkdir -p ${BONUS_OBJ_DIR}
58+
59+
$(NAME) : ${LIB_OBJS}
60+
${AR} rc ${NAME} ${LIB_OBJS}
61+
62+
bonus : ${LIB_OBJS} ${BONUS_OBJS}
63+
${AR} rc ${NAME} ${LIB_OBJS} ${BONUS_OBJS}
64+
65+
${LIB_OBJ_DIR}/%.o: ${LIB_SRC_DIR}/%.c
66+
mkdir -p ${LIB_OBJ_DIR};
67+
${CC} ${CFLAGS} -c $< -o ${<:${LIB_SRC_DIR}/%.c=${LIB_OBJ_DIR}/%.o}
68+
69+
${BONUS_OBJ_DIR}/%.o: ${BONUS_SRC_DIR}/%.c
70+
mkdir -p ${BONUS_OBJ_DIR};
71+
${CC} ${CFLAGS} -c $< -o ${<:${BONUS_SRC_DIR}/%.c=${BONUS_OBJ_DIR}/%.o}
72+
73+
clean :
74+
${RM} ${LIB_OBJS} ${BONUS_OBJS} ${OBJ_DIR}
75+
76+
fclean : clean
77+
${RM} ${NAME}
78+
79+
re : fclean all
80+
81+
82+
.PHONY : all clean fclean re bonus
File renamed without changes.

src/libft/ft_lstadd_back.c renamed to library/libft/srcs/bonus/ft_lstadd_back.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstadd_back.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/09 17:56:17 by sejpark #+# #+# */
9-
/* Updated: 2020/07/22 12:08:14 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
void ft_lstadd_back(t_list **lst, t_list *new)
1616
{

src/libft/ft_lstadd_front.c renamed to library/libft/srcs/bonus/ft_lstadd_front.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstadd_front.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/09 15:41:35 by sejpark #+# #+# */
9-
/* Updated: 2020/07/13 15:18:27 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
void ft_lstadd_front(t_list **lst, t_list *new)
1616
{

src/libft/ft_lstclear.c renamed to library/libft/srcs/bonus/ft_lstclear.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstclear.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/10 14:44:23 by sejpark #+# #+# */
9-
/* Updated: 2020/07/21 17:18:05 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
void ft_lstclear(t_list **lst, void (*del)(void*))
1616
{

src/libft/ft_lstdelone.c renamed to library/libft/srcs/bonus/ft_lstdelone.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstdelone.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/10 14:24:25 by sejpark #+# #+# */
9-
/* Updated: 2020/07/10 21:42:45 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
void ft_lstdelone(t_list *lst, void (*del)(void*))
1616
{

src/libft/ft_lstiter.c renamed to library/libft/srcs/bonus/ft_lstiter.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstiter.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/11 19:51:37 by sejpark #+# #+# */
9-
/* Updated: 2020/07/11 20:01:22 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
void ft_lstiter(t_list *lst, void (*f)(void*))
1616
{

src/libft/ft_lstlast.c renamed to library/libft/srcs/bonus/ft_lstlast.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/* ::: :::::::: */
44
/* ft_lstlast.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: sejpark <sejpark@student.42seoul.kr> +#+ +:+ +#+ */
6+
/* By: sejpark <sejpark@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2020/07/09 17:31:28 by sejpark #+# #+# */
9-
/* Updated: 2020/07/22 11:54:02 by sejpark ### ########.fr */
9+
/* Updated: 2021/05/23 18:31:01 by sejpark ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

13-
#include "libft.h"
13+
#include "../../includes/libft.h"
1414

1515
t_list *ft_lstlast(t_list *lst)
1616
{

0 commit comments

Comments
 (0)