UTILS_SRC = utils/ft_is_in_quote.c utils/ft_strncpy.c utils/ft_strreplace.c utils/ft_strnchr.c utils/ft_split_quoted.c utils/ft_strshift.c utils/ft_quote_remover.c utils/ft_str_is_empty.c utils/ft_atoi_check.c ./utils/ft_get_executable.c ./utils/fd.c

BUILTINS_SRC = builtins/pwd.c \
			   builtins/export.c \
			   builtins/env.c \
			   builtins/cd.c \
			   builtins/exit.c \
			   builtins/unset.c \
			   builtins/echo.c 

SRCS = ${BUILTINS_SRC} \
	   ${UTILS_SRC} \
	   main.c \
	   ./cmd/cmd.c \
	   ./env/env1.c \
	   ./env/env2.c \
	   ./env/env3.c \
	   ./env/env_fill.c \
	   ./data/data.c \
	   ./execution/execution.c \
	   ./syntax/syntax.c \
	   ./format/format.c \
	   ./redirection/heredoc.c \
	   ./redirection/file.c \
	   ./redirection/redirection.c \
	   ./parse/parse.c

OBJS = ${SRCS:.c=.o}

NAME = minishell

CC = clang

CFLAGS = -Werror -Wextra -Wall -g

LIBS = libftx/libftx.a

%.o: %.c
	${CC} ${CFLAGS} -c -o $@ $<

all: ${NAME}

${NAME}: ${OBJS}
	make -C libftx all
	${CC} ${OBJS} -o ${NAME} ${LIBS} -lreadline

clean:
	make -C libftx clean
	rm -f ${OBJS}

fclean: clean
	make -C libftx fclean
	rm -f ${NAME}

re: fclean
	make all

.PHONY: all clean fclean re

