folders and makefile

This commit is contained in:
gazhonsepaskwa
2025-02-13 08:54:24 +01:00
parent e747b10ed5
commit b57118d0ae
14 changed files with 25 additions and 20 deletions

View File

@@ -9,20 +9,23 @@ LIBFT_DIR = lib/libft
NAME = minishell NAME = minishell
LIBFT = $(LIBFT_DIR)/libft.a LIBFT = $(LIBFT_DIR)/libft.a
LIBFT_SRCS := $(shell find $(LIBFT_DIR) -name "*.c")
SRCS = $(shell find $(SRCDIR) -name "*.c") SRCS = $(shell find $(SRCDIR) -name "*.c")
OBJS = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRCS)) OBJS = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRCS))
DEPS = $(OBJS:.o=.d) DEPS = $(OBJS:.o=.d)
CYAN = \033[36m CYAN = \033[36m
YELLOW = \033[33m
RESET = \033[0m RESET = \033[0m
.PHONY: all clean fclean re .PHONY: all clean fclean re libft
all: $(NAME) all: $(NAME)
$(LIBFT): $(LIBFT): $(LIBFT_SRCS)
@make -C $(LIBFT_DIR) all @make -C $(LIBFT_DIR) all > /dev/null
@echo "$(YELLOW)[LIBFT] Created$(RESET)"
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(OBJDIR)/%.o: $(SRCDIR)/%.c
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@@ -33,13 +36,15 @@ $(NAME): $(LIBFT) $(OBJS)
@echo "$(CYAN)Build completed: $(NAME)$(RESET)" @echo "$(CYAN)Build completed: $(NAME)$(RESET)"
clean: clean:
@rm -rf $(OBJDIR) $(TEST_OBJDIR) @make -C $(LIBFT_DIR) clean > /dev/null
@make -C $(LIBFT_DIR) clean @echo "$(YELLOW)[LIBFT] Object files removed$(RESET)"
@rm -rf $(OBJDIR)
@echo "$(CYAN)Project cleaned$(RESET)" @echo "$(CYAN)Project cleaned$(RESET)"
fclean: clean fclean: clean
@make -C $(LIBFT_DIR) fclean @make -C $(LIBFT_DIR) fclean > /dev/null
@rm $(NAME) @echo "$(YELLOW)[LIBFT] Removed$(RESET)"
@rm -rf $(NAME)
@echo "$(CYAN)Executable removed$(RESET)" @echo "$(CYAN)Executable removed$(RESET)"
re: fclean all re: fclean all

View File

@@ -1 +1 @@
make && valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all --trace-children=yes --track-fds=all --suppressions=valgrind.supp -s ./minishell make && valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all --trace-children=yes --suppressions=valgrind.supp -s ./minishell

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
void create_and_or(t_ast_n *self, t_node *lst, t_node *token, t_msh *msh) void create_and_or(t_ast_n *self, t_node *lst, t_node *token, t_msh *msh)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
char **lltotab(t_node *lst, t_node *limiter) char **lltotab(t_node *lst, t_node *limiter)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
void create_pline(t_ast_n *self, t_node *lst, t_node *token, t_msh *msh) void create_pline(t_ast_n *self, t_node *lst, t_node *token, t_msh *msh)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
t_node *remove_parentheses(t_node *lst) t_node *remove_parentheses(t_node *lst)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
static void add_nodell(t_nodell **nodell, t_node *node) static void add_nodell(t_nodell **nodell, t_node *node)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
static void free_redirs(t_ast_n *node) static void free_redirs(t_ast_n *node)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
t_redir get_redir(t_node *node) t_redir get_redir(t_node *node)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../../includes/minishell.h" #include "../../../../includes/minishell.h"
#include <string.h> #include <string.h>
static int last_tok_subsh(t_node *lst) static int last_tok_subsh(t_node *lst)

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/minishell.h" #include "../../../includes/minishell.h"
static void remove_quote(char **str, char c) static void remove_quote(char **str, char c)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/minishell.h" #include "../../../includes/minishell.h"
void exit_heredoc(char *limiter, t_msh *msh, t_node *lst) void exit_heredoc(char *limiter, t_msh *msh, t_node *lst)
{ {

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/minishell.h" #include "../../../includes/minishell.h"
#include <string.h> #include <string.h>
int syntax_err_mess(char *token_base, int selected) int syntax_err_mess(char *token_base, int selected)

View File

@@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/minishell.h" #include "../../../includes/minishell.h"
int is_aop_operator(t_node *node) int is_aop_operator(t_node *node)
{ {