diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 52977f8..f9432dd --- a/Makefile +++ b/Makefile @@ -3,38 +3,38 @@ # ::: :::::::: # # Makefile :+: :+: :+: # # +:+ +:+ +:+ # -# By: marde-vr +#+ +:+ +#+ # +# By: tomoron +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/07/28 00:35:01 by tomoron #+# #+# # -# Updated: 2024/02/16 21:31:30 by marde-vr ### ########.fr # +# Updated: 2024/02/16 21:56:22 by tomoron ### ########.fr # # # # **************************************************************************** # CC = cc +SRCS_RAW = main.c\ + lst_cmd.c\ + cd.c\ + lst_env.c\ + exec.c\ + exit.c\ + echo.c\ + pwd.c\ + parsing.c\ + debug.c\ + env_to_char_tab.c\ + parsing_var.c\ + minishellrc.c -SRCS = main.c\ - lst_cmd.c\ - lst_env.c\ - exec.c\ - exit.c\ - echo.c\ - pwd.c\ - cd.c\ - parsing.c\ - debug.c\ - env_to_char_tab.c\ - parsing_var.c\ - minishellrc.c - -OBJS = $(SRCS:.c=.o) +OBJS_DIR = objs/ +SRCS_DIR = srcs/ +SRCS = $(addprefix $(SRCS_DIR), $(SRCS_RAW)) +OBJS = $(addprefix $(OBJS_DIR), $(SRCS_RAW:.c=.o)) FLAGS = -Wall -Wextra -Werror -g - LIBFT = libft/libft.a - NAME = minishell -all: $(NAME) +all: $(NAME) $(NAME) : $(LIBFT) $(OBJS) $(CC) $(FLAGS) $(OBJS) $(LIBFT) -lreadline -o $(NAME) @@ -42,15 +42,19 @@ $(NAME) : $(LIBFT) $(OBJS) $(LIBFT): make --no-print-directory -j -C ./libft -.c.o: +$(OBJS_DIR): + mkdir -p $(OBJS_DIR) + +$(OBJS_DIR)%.o : $(SRCS_DIR)%.c | $(OBJS_DIR) $(CC) $(FLAGS) -c $< -o $@ clean: - rm -f $(OBJS) - make --no-print-directory -C ./libft fclean + rm -rf $(OBJS_DIR) + make --no-print-directory -C ./libft clean fclean: clean rm -f $(NAME) + make --no-print-directory -C ./libft fclean re: fclean all diff --git a/debug.c b/srcs/debug.c similarity index 100% rename from debug.c rename to srcs/debug.c diff --git a/echo.c b/srcs/echo.c similarity index 100% rename from echo.c rename to srcs/echo.c diff --git a/env_to_char_tab.c b/srcs/env_to_char_tab.c similarity index 100% rename from env_to_char_tab.c rename to srcs/env_to_char_tab.c diff --git a/exec.c b/srcs/exec.c similarity index 97% rename from exec.c rename to srcs/exec.c index 09b73c0..56a248b 100755 --- a/exec.c +++ b/srcs/exec.c @@ -6,13 +6,11 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */ -/* Updated: 2024/02/16 21:20:57 by marde-vr ### ########.fr */ +/* Updated: 2024/02/16 21:56:40 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ -#include "libft/libft.h" #include "minishell.h" -#include int exec_builtin(t_cmd *parsed_cmd, t_env *env) { diff --git a/exit.c b/srcs/exit.c similarity index 100% rename from exit.c rename to srcs/exit.c diff --git a/lst_cmd.c b/srcs/lst_cmd.c similarity index 100% rename from lst_cmd.c rename to srcs/lst_cmd.c diff --git a/lst_env.c b/srcs/lst_env.c similarity index 100% rename from lst_env.c rename to srcs/lst_env.c diff --git a/main.c b/srcs/main.c similarity index 97% rename from main.c rename to srcs/main.c index a423a23..4f08020 100755 --- a/main.c +++ b/srcs/main.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */ -/* Updated: 2024/02/16 21:30:50 by marde-vr ### ########.fr */ +/* Updated: 2024/02/16 21:57:11 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/minishell.h b/srcs/minishell.h similarity index 95% rename from minishell.h rename to srcs/minishell.h index 49c8b15..a08460f 100755 --- a/minishell.h +++ b/srcs/minishell.h @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */ -/* Updated: 2024/02/16 21:25:14 by tomoron ### ########.fr */ +/* Updated: 2024/02/16 21:51:37 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ # include # include //debug # include -# include "libft/libft.h" +# include "../libft/libft.h" # include "fcntl.h" typedef enum e_token_type diff --git a/minishellrc.c b/srcs/minishellrc.c similarity index 100% rename from minishellrc.c rename to srcs/minishellrc.c diff --git a/parsing.c b/srcs/parsing.c similarity index 100% rename from parsing.c rename to srcs/parsing.c diff --git a/parsing_var.c b/srcs/parsing_var.c similarity index 100% rename from parsing_var.c rename to srcs/parsing_var.c diff --git a/pwd.c b/srcs/pwd.c similarity index 100% rename from pwd.c rename to srcs/pwd.c