diff options
| author | Dominik Kaiser | 2024-04-29 17:24:14 +0200 |
|---|---|---|
| committer | Dominik Kaiser | 2024-04-29 17:24:14 +0200 |
| commit | 87f506fc6edf8140cc6ec1aede38bb316a2e4933 (patch) | |
| tree | 884e8497a7c14a1fd1ab4b40b6b65e5f9dd13cf7 | |
| parent | 043f5a1e4538d508ed8899559f6dfb8ee1993e4b (diff) | |
| download | pipex-87f506fc6edf8140cc6ec1aede38bb316a2e4933.tar.gz pipex-87f506fc6edf8140cc6ec1aede38bb316a2e4933.zip | |
Add libft and prettify the make-process
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | Makefile | 21 | ||||
| -rw-r--r-- | include/pipex.h | 5 | ||||
| m--------- | libft | 0 |
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 @@ -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 |
