summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDominik Kaiser2024-04-29 17:24:14 +0200
committerDominik Kaiser2024-04-29 17:24:14 +0200
commit87f506fc6edf8140cc6ec1aede38bb316a2e4933 (patch)
tree884e8497a7c14a1fd1ab4b40b6b65e5f9dd13cf7 /Makefile
parent043f5a1e4538d508ed8899559f6dfb8ee1993e4b (diff)
downloadpipex-87f506fc6edf8140cc6ec1aede38bb316a2e4933.tar.gz
pipex-87f506fc6edf8140cc6ec1aede38bb316a2e4933.zip
Add libft and prettify the make-process
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 14 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 2cc3168..a7c15a4 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ NAME := pipex
CC = cc
CFLAGS = -Wall -Wextra -Werror
HEADERS = -Iinclude
-LIBS =
+LIBS = -Llibft -lft
VPATH := src
SRC = main.c
@@ -14,27 +14,34 @@ OBJ := $(addprefix $(OBJ_DIR)/, $(SRC:%.c=%.o))
all: $(NAME)
-$(NAME): $(OBJ)
- $(CC) $(CFLAGS) $(HEADERS) $^ -o $@ $(LIBS)
+$(NAME): $(OBJ) | libft
+ @$(CC) $(CFLAGS) $(HEADERS) $^ -o $@ $(LIBS)
+ @echo "[$(NAME)] Created binary."
$(OBJ_DIR)/%.o: %.c
@if [ ! -d "$(OBJ_DIR)" ]; then \
mkdir $(OBJ_DIR); \
fi
- $(CC) $(CFLAGS) $(HEADERS) -c $< -o $@
+ @$(CC) $(CFLAGS) $(HEADERS) -c $< -o $@
+ @echo "[$(NAME)] Compiled $<."
+
+libft:
+ @make -C libft
clean:
+ @make -C libft clean
@if [ -d "$(OBJ_DIR)" ]; then \
rm -rf $(OBJ_DIR); \
- echo "Removed object files."; \
+ echo "[$(NAME)] Removed object files."; \
fi
fclean: clean
+ @make -C libft fclean
@if [ -f "$(NAME)" ]; then \
rm -f $(NAME); \
- echo "Removed binary."; \
+ echo "[$(NAME)] Removed binary."; \
fi
re: fclean all
-.PHONY: all clean fclean re
+.PHONY: all libft clean fclean re