aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDominik Kaiser2024-06-24 16:58:46 +0200
committerGitHub2024-06-24 16:58:46 +0200
commita28e57c6e0277a1d7346bec58cf557c52e337501 (patch)
tree8710c1c12dfd9e6c52821944b0676ec15e5e20ae /Makefile
parentf1349566aef0cb80ef8f4cdcf2795e38631ed820 (diff)
downloadminishell-a28e57c6e0277a1d7346bec58cf557c52e337501.tar.gz
minishell-a28e57c6e0277a1d7346bec58cf557c52e337501.zip
Add libft
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 882da16..e59318a 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,8 @@ NAME := minishell
CC = cc
CFLAGS = -Wall -Wextra -Werror
HEADERS = -Iinclude
+LIB_DIR = lib
+LIBS = -L$(LIB_DIR)/libft -lft
VPATH := src
SRC := main.c
@@ -18,12 +20,15 @@ OBJ := $(addprefix $(OBJ_DIR)/, $(SRC:%.c=%.o))
#################################### RULES #####################################
################################################################################
-all: $(NAME)
+all: libs $(NAME)
$(NAME): $(OBJ)
- @$(CC) $(CFLAGS) $(HEADERS) $^ -o $@
+ @$(CC) $(CFLAGS) $(HEADERS) $(LIBS) $^ -o $@
@echo "[$(NAME)] Created binary."
+libs:
+ @make -C $(LIB_DIR)/libft
+
$(OBJ_DIR)/%.o: %.c
@if [ ! -d "$(dir $@)" ]; then \
mkdir -p $(dir $@); \
@@ -36,6 +41,7 @@ clean:
rm -rf $(OBJ_DIR); \
echo "[$(NAME)] Removed object files."; \
fi
+ @make fclean -C $(LIB_DIR)/libft
fclean: clean
@if [ -f "$(NAME)" ]; then \
@@ -45,7 +51,7 @@ fclean: clean
re: fclean all
-.PHONY: all clean fclean re
+.PHONY: all clean fclean re libs
################################################################################
################################################################################