init
This commit is contained in:
63
Makefile
Normal file
63
Makefile
Normal file
@@ -0,0 +1,63 @@
|
||||
NAME = minishell
|
||||
|
||||
CC = clang
|
||||
|
||||
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -g
|
||||
|
||||
VPATH = $(DIR_SRCS)
|
||||
DIR_SRCS = src
|
||||
|
||||
INCLUDES = -I$(HEADERS_D) -I$(LIBFT_D)
|
||||
|
||||
HEADERS_D = ./header
|
||||
HEADERS = minishell.h
|
||||
|
||||
LIBS = -L $(LIBFT_D) -lft \
|
||||
-lreadline
|
||||
|
||||
LIBFT_D = ./libft
|
||||
LIBFT = $(LIBFT_D)/libft.a
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
DIR_OBJS = builds
|
||||
OBJS = $(SRCS:%.c=$(DIR_OBJS)/%.o)
|
||||
|
||||
# --------------------
|
||||
# ------ RULES -------
|
||||
# --------------------
|
||||
|
||||
all: subsystem $(NAME)
|
||||
|
||||
subsystem:
|
||||
@cd $(LIBFT_D) && $(MAKE)
|
||||
|
||||
$(LIBFT): # dispensable. utile seulement pour un appel direct à $(NAME), si $(LIBFT) n'existe pas
|
||||
cd $(LIBFT_D) && $(MAKE)
|
||||
|
||||
$(DIR_OBJS)/%.o: %.c | $(DIR_OBJS)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(DIR_OBJS):
|
||||
mkdir $@
|
||||
|
||||
$(OBJS): $(HEADERS:%=$(HEADERS_D)/%)
|
||||
|
||||
$(NAME): $(OBJS) $(LIBFT)
|
||||
$(CC) $(OBJS) -o $(NAME) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
valgrind: $(NAME)
|
||||
valgrind --leak-check=full --leak-resolution=low --show-reachable=yes ./$(NAME)
|
||||
|
||||
run: $(NAME)
|
||||
./$(NAME)
|
||||
|
||||
.PHONY : all clean fclean re bonus subsystem run valgrind
|
||||
Reference in New Issue
Block a user