aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-15 10:04:09 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-15 10:04:09 +0100
commit1e9b077e0d9f3c50d7d518bf6ea7f08e7f5ec590 (patch)
tree21d906cd9f96c58af572ce3bb6784d1d8fca18d2
parent49ad59b0e773e92e93fb69ede889c781ca53e680 (diff)
downloadlibft-1e9b077e0d9f3c50d7d518bf6ea7f08e7f5ec590.tar.gz
libft-1e9b077e0d9f3c50d7d518bf6ea7f08e7f5ec590.tar.bz2
libft-1e9b077e0d9f3c50d7d518bf6ea7f08e7f5ec590.zip
splited src in category, more generic makefile
-rw-r--r--Makefile135
-rw-r--r--include/libft.h6
-rw-r--r--src/ctype/ft_isalnum.c (renamed from src/ft_isalnum.c)0
-rw-r--r--src/ctype/ft_isalpha.c (renamed from src/ft_isalpha.c)0
-rw-r--r--src/ctype/ft_isascii.c (renamed from src/ft_isascii.c)0
-rw-r--r--src/ctype/ft_isdigit.c (renamed from src/ft_isdigit.c)0
-rw-r--r--src/ctype/ft_isprint.c (renamed from src/ft_isprint.c)0
-rw-r--r--src/ctype/ft_tolower.c (renamed from src/ft_tolower.c)0
-rw-r--r--src/ctype/ft_toupper.c (renamed from src/ft_toupper.c)0
-rw-r--r--src/io/ft_asprintf.c (renamed from src/ft_asprintf.c)0
-rw-r--r--src/io/ft_dprintf.c (renamed from src/ft_dprintf.c)0
-rw-r--r--src/io/ft_printf.c (renamed from src/ft_printf.c)0
-rw-r--r--src/io/ft_printf/convert.c (renamed from src/ft_printf/convert.c)0
-rw-r--r--src/io/ft_printf/convert_char.c (renamed from src/ft_printf/convert_char.c)0
-rw-r--r--src/io/ft_printf/convert_hex.c (renamed from src/ft_printf/convert_hex.c)0
-rw-r--r--src/io/ft_printf/convert_int.c (renamed from src/ft_printf/convert_int.c)0
-rw-r--r--src/io/ft_printf/convert_none.c (renamed from src/ft_printf/convert_none.c)0
-rw-r--r--src/io/ft_printf/convert_percent.c (renamed from src/ft_printf/convert_percent.c)0
-rw-r--r--src/io/ft_printf/convert_ptr.c (renamed from src/ft_printf/convert_ptr.c)0
-rw-r--r--src/io/ft_printf/convert_str.c (renamed from src/ft_printf/convert_str.c)0
-rw-r--r--src/io/ft_printf/convert_uint.c (renamed from src/ft_printf/convert_uint.c)0
-rw-r--r--src/io/ft_printf/convert_written.c (renamed from src/ft_printf/convert_written.c)0
-rw-r--r--src/io/ft_printf/extract.c (renamed from src/ft_printf/extract.c)0
-rw-r--r--src/io/ft_printf/ft_printf.c (renamed from src/ft_printf/ft_printf.c)0
-rw-r--r--src/io/ft_printf/ft_vasprintf.h (renamed from src/ft_printf/ft_vasprintf.h)0
-rw-r--r--src/io/ft_printf/length_modifier.c (renamed from src/ft_printf/length_modifier.c)0
-rw-r--r--src/io/ft_printf/list.c (renamed from src/ft_printf/list.c)0
-rw-r--r--src/io/ft_printf/parse.c (renamed from src/ft_printf/parse.c)0
-rw-r--r--src/io/ft_printf/utils.c (renamed from src/ft_printf/utils.c)0
-rw-r--r--src/io/ft_putchar.c (renamed from src/ft_putchar.c)0
-rw-r--r--src/io/ft_putchar_fd.c (renamed from src/ft_putchar_fd.c)0
-rw-r--r--src/io/ft_putendl.c (renamed from src/ft_putendl.c)0
-rw-r--r--src/io/ft_putendl_fd.c (renamed from src/ft_putendl_fd.c)0
-rw-r--r--src/io/ft_putnbr.c (renamed from src/ft_putnbr.c)0
-rw-r--r--src/io/ft_putnbr_fd.c (renamed from src/ft_putnbr_fd.c)0
-rw-r--r--src/io/ft_putstr.c (renamed from src/ft_putstr.c)0
-rw-r--r--src/io/ft_putstr_fd.c (renamed from src/ft_putstr_fd.c)0
-rw-r--r--src/io/ft_snprintf.c (renamed from src/ft_snprintf.c)0
-rw-r--r--src/io/ft_sprintf.c (renamed from src/ft_sprintf.c)0
-rw-r--r--src/io/ft_vasprintf.c (renamed from src/ft_vasprintf.c)0
-rw-r--r--src/io/ft_vdprintf.c (renamed from src/ft_vdprintf.c)0
-rw-r--r--src/io/ft_vprintf.c (renamed from src/ft_vprintf.c)0
-rw-r--r--src/io/ft_vsnprintf.c (renamed from src/ft_vsnprintf.c)0
-rw-r--r--src/io/ft_vsprintf.c (renamed from src/ft_vsprintf.c)0
-rw-r--r--src/io/get_next_line/get_next_line.c (renamed from src/get_next_line/get_next_line.c)0
-rw-r--r--src/lst/ft_lstadd_back.c (renamed from src/ft_lstadd_back_bonus.c)0
-rw-r--r--src/lst/ft_lstadd_front.c (renamed from src/ft_lstadd_front_bonus.c)0
-rw-r--r--src/lst/ft_lstclear.c (renamed from src/ft_lstclear_bonus.c)0
-rw-r--r--src/lst/ft_lstdelone.c (renamed from src/ft_lstdelone_bonus.c)0
-rw-r--r--src/lst/ft_lstiter.c (renamed from src/ft_lstiter_bonus.c)0
-rw-r--r--src/lst/ft_lstlast.c (renamed from src/ft_lstlast_bonus.c)0
-rw-r--r--src/lst/ft_lstmap.c (renamed from src/ft_lstmap_bonus.c)0
-rw-r--r--src/lst/ft_lstnew.c (renamed from src/ft_lstnew_bonus.c)0
-rw-r--r--src/lst/ft_lstpop_front.c (renamed from src/ft_lstpop_front_bonus.c)0
-rw-r--r--src/lst/ft_lstsize.c (renamed from src/ft_lstsize_bonus.c)0
-rw-r--r--src/mem/ft_bzero.c (renamed from src/ft_bzero.c)0
-rw-r--r--src/mem/ft_calloc.c (renamed from src/ft_calloc.c)0
-rw-r--r--src/mem/ft_memalloc.c (renamed from src/ft_memalloc.c)0
-rw-r--r--src/mem/ft_memccpy.c (renamed from src/ft_memccpy.c)0
-rw-r--r--src/mem/ft_memchr.c (renamed from src/ft_memchr.c)0
-rw-r--r--src/mem/ft_memcmp.c (renamed from src/ft_memcmp.c)0
-rw-r--r--src/mem/ft_memcpy.c (renamed from src/ft_memcpy.c)0
-rw-r--r--src/mem/ft_memdel.c (renamed from src/ft_memdel.c)0
-rw-r--r--src/mem/ft_memmove.c (renamed from src/ft_memmove.c)0
-rw-r--r--src/mem/ft_memset.c (renamed from src/ft_memset.c)0
-rw-r--r--src/str/ft_atoi.c (renamed from src/ft_atoi.c)2
-rw-r--r--src/str/ft_itoa.c (renamed from src/ft_itoa.c)0
-rw-r--r--src/str/ft_split.c (renamed from src/ft_split.c)0
-rw-r--r--src/str/ft_strcat.c (renamed from src/ft_strcat.c)0
-rw-r--r--src/str/ft_strchr.c (renamed from src/ft_strchr.c)0
-rw-r--r--src/str/ft_strclr.c (renamed from src/ft_strclr.c)0
-rw-r--r--src/str/ft_strcmp.c (renamed from src/ft_strcmp.c)0
-rw-r--r--src/str/ft_strcount.c (renamed from src/ft_strcount.c)0
-rw-r--r--src/str/ft_strcpy.c (renamed from src/ft_strcpy.c)0
-rw-r--r--src/str/ft_strdel.c (renamed from src/ft_strdel.c)0
-rw-r--r--src/str/ft_strdup.c (renamed from src/ft_strdup.c)0
-rw-r--r--src/str/ft_strequ.c (renamed from src/ft_strequ.c)0
-rw-r--r--src/str/ft_striter.c (renamed from src/ft_striter.c)0
-rw-r--r--src/str/ft_striteri.c (renamed from src/ft_striteri.c)0
-rw-r--r--src/str/ft_strjoin.c (renamed from src/ft_strjoin.c)0
-rw-r--r--src/str/ft_strjoin_free.c (renamed from src/ft_strjoin_free.c)0
-rw-r--r--src/str/ft_strjoin_free_snd.c (renamed from src/ft_strjoin_free_snd.c)0
-rw-r--r--src/str/ft_strlcat.c (renamed from src/ft_strlcat.c)0
-rw-r--r--src/str/ft_strlcpy.c (renamed from src/ft_strlcpy.c)0
-rw-r--r--src/str/ft_strlen.c (renamed from src/ft_strlen.c)0
-rw-r--r--src/str/ft_strmap.c (renamed from src/ft_strmap.c)0
-rw-r--r--src/str/ft_strmapi.c (renamed from src/ft_strmapi.c)0
-rw-r--r--src/str/ft_strncat.c (renamed from src/ft_strncat.c)0
-rw-r--r--src/str/ft_strncmp.c (renamed from src/ft_strncmp.c)0
-rw-r--r--src/str/ft_strncpy.c (renamed from src/ft_strncpy.c)0
-rw-r--r--src/str/ft_strndup.c (renamed from src/ft_strndup.c)0
-rw-r--r--src/str/ft_strnequ.c (renamed from src/ft_strnequ.c)0
-rw-r--r--src/str/ft_strnew.c (renamed from src/ft_strnew.c)0
-rw-r--r--src/str/ft_strnstr.c (renamed from src/ft_strnstr.c)0
-rw-r--r--src/str/ft_strrchr.c (renamed from src/ft_strrchr.c)0
-rw-r--r--src/str/ft_strstr.c (renamed from src/ft_strstr.c)0
-rw-r--r--src/str/ft_strtrim.c (renamed from src/ft_strtrim.c)0
-rw-r--r--src/str/ft_substr.c (renamed from src/ft_substr.c)0
98 files changed, 111 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index cd957eb..429d029 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# By: cacharle <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/10/08 15:45:53 by cacharle #+# #+# #
-# Updated: 2020/01/15 08:48:42 by cacharle ### ########.fr #
+# Updated: 2020/01/15 09:54:56 by cacharle ### ########.fr #
# #
# **************************************************************************** #
@@ -22,46 +22,119 @@ CC = gcc
CCFLAGS = -I$(INCLUDE_DIR) -Wall -Wextra -Werror
NAME = libft.a
-SRC_FILES = ft_atoi.c ft_bzero.c ft_isalnum.c ft_isalpha.c ft_isascii.c \
- ft_isprint.c ft_itoa.c ft_memalloc.c ft_memccpy.c ft_memchr.c \
- ft_memcmp.c ft_memcpy.c ft_memdel.c ft_memmove.c ft_memset.c \
- ft_putchar.c ft_putchar_fd.c ft_putendl.c ft_putendl_fd.c \
- ft_putnbr.c ft_putnbr_fd.c ft_putstr.c ft_putstr_fd.c ft_strcat.c \
- ft_strchr.c ft_strclr.c ft_strcmp.c ft_strcpy.c ft_strdel.c \
- ft_strdup.c ft_strequ.c ft_striter.c ft_striteri.c ft_strjoin.c \
- ft_strlcat.c ft_strlen.c ft_strmap.c ft_strmapi.c ft_strncat.c \
- ft_strncmp.c ft_strncpy.c ft_strnequ.c ft_strnew.c ft_strnstr.c \
- ft_strrchr.c ft_split.c ft_strstr.c ft_substr.c ft_strtrim.c \
- ft_tolower.c ft_toupper.c ft_strlcpy.c ft_calloc.c ft_strndup.c \
- ft_strjoin_free.c ft_strjoin_free_snd.c ft_strcount.c \
- $(GET_NEXT_LINE_DIR)/get_next_line.c ft_isdigit.c
- # ft_printf.c ft_sprintf.c ft_snprintf.c ft_asprintf.c ft_dprintf.c \
- # ft_vprintf.c ft_vsprintf.c ft_vsnprintf.c ft_vasprintf.c ft_vdprintf.c
-SRC = $(addprefix $(SRC_DIR)/,$(SRC_FILES))
+
+# SRC_CTYPE_DIR = ctype
+# SRC_CTYPE = ft_isalnum.c \
+# ft_isalpha.c \
+# ft_isascii.c \
+# ft_isdigit.c \
+# ft_isprint.c \
+# ft_tolower.c \
+# ft_toupper.c
+#
+# SRC_IO_DIR = io
+# SRC_IO = ft_asprintf.c \
+# ft_dprintf.c \
+# ft_printf \
+# ft_printf.c \
+# ft_putchar.c \
+# ft_putchar_fd.c \
+# ft_putendl.c \
+# ft_putendl_fd.c \
+# ft_putnbr.c \
+# ft_putnbr_fd.c \
+# ft_putstr.c \
+# ft_putstr_fd.c \
+# ft_snprintf.c \
+# ft_sprintf.c \
+# ft_vasprintf.c \
+# ft_vdprintf.c \
+# ft_vprintf.c \
+# ft_vsnprintf.c \
+# ft_vsprintf.c \
+# get_next_line
+#
+# SRC_LST_DIR = lst
+# SRC_LST = ft_lstadd_back.c \
+# ft_lstadd_front.c \
+# ft_lstclear.c \
+# ft_lstdelone.c \
+# ft_lstiter.c \
+# ft_lstlast.c \
+# ft_lstmap.c \
+# ft_lstnew.c \
+# ft_lstpop_front.c \
+# ft_lstsize.c
+#
+# SRC_MEM_DIR = mem
+# SRC_MEM = ft_bzero.c \
+# ft_calloc.c \
+# ft_memalloc.c \
+# ft_memccpy.c \
+# ft_memchr.c \
+# ft_memcmp.c \
+# ft_memcpy.c \
+# ft_memdel.c \
+# ft_memmove.c \
+# ft_memset.c
+#
+# SRC_STR_DIR = str
+# SRC_STR = ft_atoi.c \
+# ft_itoa.c \
+# ft_split.c \
+# ft_strcat.c \
+# ft_strchr.c \
+# ft_strclr.c \
+# ft_strcmp.c \
+# ft_strcount.c \
+# ft_strcpy.c \
+# ft_strdel.c \
+# ft_strdup.c \
+# ft_strequ.c \
+# ft_striter.c \
+# ft_striteri.c \
+# ft_strjoin.c \
+# ft_strjoin_free.c \
+# ft_strjoin_free_snd.c \
+# ft_strlcat.c \
+# ft_strlcpy.c \
+# ft_strlen.c \
+# ft_strmap.c \
+# ft_strmapi.c \
+# ft_strncat.c \
+# ft_strncmp.c \
+# ft_strncpy.c \
+# ft_strndup.c \
+# ft_strnequ.c \
+# ft_strnew.c \
+# ft_strnstr.c \
+# ft_strrchr.c \
+# ft_strstr.c \
+# ft_strtrim.c \
+# ft_substr.c
+
+SRC = $(shell find $(SRC_DIR) -name *.c)
+
+# SRC = $(addprefix $(SRC_DIR)/,$(SRC_FILES))
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
HEADER_FILES = libft.h get_next_line.h
HEADER = $(addprefix $(INCLUDE_DIR)/,$(HEADER_FILES))
-# BONUSSRC = ft_lstadd_back_bonus.c ft_lstadd_front_bonus.c ft_lstclear_bonus.c \
-# ft_lstdelone_bonus.c ft_lstiter_bonus.c ft_lstlast_bonus.c \
-# ft_lstmap_bonus.c ft_lstnew_bonus.c ft_lstsize_bonus.c ft_lstpop_front_bonus.c
-# BONUSOBJ = $(BONUSSRC:.c=.o)
+BONUSOBJ = $(BONUSSRC:.c=.o)
-all: dir_prerequisit $(NAME)
+all: make_build_dirs $(NAME)
-dir_prerequisit:
- @if [ ! -d "$(OBJ_DIR)" ]; then mkdir $(OBJ_DIR); fi
- @if [ ! -d "$(OBJ_DIR)/$(GET_NEXT_LINE_DIR)" ]; then \
- mkdir $(OBJ_DIR)/$(GET_NEXT_LINE_DIR); fi
+make_build_dirs:
+ @for dir in $$(find $(SRC_DIR)/* -type d | sed 's_$(SRC_DIR)/_$(OBJ_DIR)/_g'); \
+ do \
+ if [ ! -d "$$dir" ]; then mkdir -p $$dir; fi \
+ done
$(NAME): $(OBJ) $(HEADER)
$(LIB) $(NAME) $(OBJ)
-# bonus: $(BONUSOBJ) $(HEADER)
-# $(LIB) $(NAME) $(BONUSOBJ)
-
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CCFLAGS) -c -o $@ $<
@@ -71,4 +144,6 @@ clean:
fclean: clean
$(RM) $(NAME)
-re: fclean all
+re:
+ @make fclean
+ @make all
diff --git a/include/libft.h b/include/libft.h
index 0880568..3777f8a 100644
--- a/include/libft.h
+++ b/include/libft.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:45:02 by cacharle #+# #+# */
-/* Updated: 2019/11/21 03:39:19 by cacharle ### ########.fr */
+/* Updated: 2020/01/15 10:03:22 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,6 +27,10 @@
# define MAX(x, y) ((x) > (y) ? (x) : (y))
typedef unsigned char t_byte;
+typedef int t_bool;
+
+# define TRUE 1
+# define FALSE 0
/*
** memory
diff --git a/src/ft_isalnum.c b/src/ctype/ft_isalnum.c
index 1ee1e0f..1ee1e0f 100644
--- a/src/ft_isalnum.c
+++ b/src/ctype/ft_isalnum.c
diff --git a/src/ft_isalpha.c b/src/ctype/ft_isalpha.c
index 6f155b4..6f155b4 100644
--- a/src/ft_isalpha.c
+++ b/src/ctype/ft_isalpha.c
diff --git a/src/ft_isascii.c b/src/ctype/ft_isascii.c
index 51dcd1c..51dcd1c 100644
--- a/src/ft_isascii.c
+++ b/src/ctype/ft_isascii.c
diff --git a/src/ft_isdigit.c b/src/ctype/ft_isdigit.c
index f8a5850..f8a5850 100644
--- a/src/ft_isdigit.c
+++ b/src/ctype/ft_isdigit.c
diff --git a/src/ft_isprint.c b/src/ctype/ft_isprint.c
index c311709..c311709 100644
--- a/src/ft_isprint.c
+++ b/src/ctype/ft_isprint.c
diff --git a/src/ft_tolower.c b/src/ctype/ft_tolower.c
index 919469f..919469f 100644
--- a/src/ft_tolower.c
+++ b/src/ctype/ft_tolower.c
diff --git a/src/ft_toupper.c b/src/ctype/ft_toupper.c
index 8579b91..8579b91 100644
--- a/src/ft_toupper.c
+++ b/src/ctype/ft_toupper.c
diff --git a/src/ft_asprintf.c b/src/io/ft_asprintf.c
index 5eb62d9..5eb62d9 100644
--- a/src/ft_asprintf.c
+++ b/src/io/ft_asprintf.c
diff --git a/src/ft_dprintf.c b/src/io/ft_dprintf.c
index 8e60970..8e60970 100644
--- a/src/ft_dprintf.c
+++ b/src/io/ft_dprintf.c
diff --git a/src/ft_printf.c b/src/io/ft_printf.c
index 1b92bb2..1b92bb2 100644
--- a/src/ft_printf.c
+++ b/src/io/ft_printf.c
diff --git a/src/ft_printf/convert.c b/src/io/ft_printf/convert.c
index 398c754..398c754 1006