summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--Makefile21
-rw-r--r--include/pipex.h5
m---------libft0
4 files changed, 21 insertions, 8 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..87a27f6
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "libft"]
+ path = libft
+ url = https://github.com/dpu-kaiser/libft
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
diff --git a/include/pipex.h b/include/pipex.h
index a742093..1a79cf1 100644
--- a/include/pipex.h
+++ b/include/pipex.h
@@ -6,11 +6,14 @@
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/29 14:04:28 by dkaiser #+# #+# */
-/* Updated: 2024/04/29 14:05:02 by dkaiser ### ########.fr */
+/* Updated: 2024/04/29 16:38:38 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PIPEX_H
# define PIPEX_H
+# include "../libft/libft.h"
+# include <unistd.h>
+
#endif // PIPEX_H
diff --git a/libft b/libft
new file mode 160000
+Subproject f4c8da1124e7377632f88bdd56e7b1b91a4986e