summaryrefslogtreecommitdiffstats
path: root/libft/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'libft/Makefile')
-rw-r--r--libft/Makefile263
1 files changed, 161 insertions, 102 deletions
diff --git a/libft/Makefile b/libft/Makefile
index 1b41ad7..d5d6e5d 100644
--- a/libft/Makefile
+++ b/libft/Makefile
@@ -5,113 +5,172 @@
# +:+:+ +: +: +:+:+ #
# By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ #
# #+# #+ #+ #+# #
-# Created: 2019/10/08 15:04:55 by rbousset #+# ## ## #+# #
-# Updated: 2019/10/13 14:01:21 by rbousset ### #+. /#+ ###.fr #
+# Created: 2019/12/11 13:14:43 by rbousset #+# ## ## #+# #
+# Updated: 2019/12/11 18:34:05 by rbousset ### #+. /#+ ###.fr #
# / #
# / #
# **************************************************************************** #
-SRCS_DIR = src/
-SRCS = \
- ${SRCS_DIR}ft_memset.c \
- ${SRCS_DIR}ft_bzero.c \
- ${SRCS_DIR}ft_memcpy.c \
- ${SRCS_DIR}ft_memccpy.c \
- ${SRCS_DIR}ft_memmove.c \
- ${SRCS_DIR}ft_memchr.c \
- ${SRCS_DIR}ft_memcmp.c \
- ${SRCS_DIR}ft_strlen.c \
- ${SRCS_DIR}ft_isalpha.c \
- ${SRCS_DIR}ft_isdigit.c \
- ${SRCS_DIR}ft_isalnum.c \
- ${SRCS_DIR}ft_isascii.c \
- ${SRCS_DIR}ft_isprint.c \
- ${SRCS_DIR}ft_tolower.c \
- ${SRCS_DIR}ft_toupper.c \
- ${SRCS_DIR}ft_strchr.c \
- ${SRCS_DIR}ft_strrchr.c \
- ${SRCS_DIR}ft_strncmp.c \
- ${SRCS_DIR}ft_strlcpy.c \
- ${SRCS_DIR}ft_strlcat.c \
- ${SRCS_DIR}ft_strnstr.c \
- ${SRCS_DIR}ft_atoi.c \
- ${SRCS_DIR}ft_calloc.c \
- ${SRCS_DIR}ft_strdup.c \
- \
- ${SRCS_DIR}ft_substr.c \
- ${SRCS_DIR}ft_strjoin.c \
- ${SRCS_DIR}ft_strtrim.c \
- ${SRCS_DIR}ft_split.c \
- ${SRCS_DIR}ft_itoa.c \
- ${SRCS_DIR}ft_strmapi.c \
- ${SRCS_DIR}ft_putchar_fd.c \
- ${SRCS_DIR}ft_putstr_fd.c \
- ${SRCS_DIR}ft_putendl_fd.c \
- ${SRCS_DIR}ft_putnbr_fd.c \
- \
- ${SRCS_DIR}ft_lstnew.c \
- ${SRCS_DIR}ft_lstadd_front.c \
- ${SRCS_DIR}ft_lstsize.c \
- ${SRCS_DIR}ft_lstlast.c \
- ${SRCS_DIR}ft_lstadd_back.c \
- ${SRCS_DIR}ft_lstdelone.c \
- ${SRCS_DIR}ft_lstclear.c \
- ${SRCS_DIR}ft_lstiter.c \
- ${SRCS_DIR}ft_lstmap.c \
- ${SRCS_DIR}ft_putchar.c \
- ${SRCS_DIR}ft_putstr.c \
- ${SRCS_DIR}ft_putendl.c \
- ${SRCS_DIR}ft_putnbr.c \
- ${SRCS_DIR}ft_strnlen.c \
- ${SRCS_DIR}ft_strcat.c \
- ${SRCS_DIR}ft_strcmp.c \
- ${SRCS_DIR}ft_isspace.c \
- ${SRCS_DIR}ft_sqrt.c
-
-OBJS_DIR = obj/
-OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
-
-INCS_DIR = inc/
-INCS = libft.h
-
-CC = clang
-CFLAGS = -Wall -Wextra -Werror
-
-DEBUG = -g3
-FSANITIZE = -fsanitize=address
-
-AR = ar rcs
-NAME = libft.a
-
-MKDIR = mkdir -p
-RM = rm -rf
-
-
+default: all
+#==============================================================================#
+#--------------------------------- Shell --------------------------------------#
+#==============================================================================#
+SHELL := /bin/sh
+#==============================================================================#
+#------------------------------ Directories -----------------------------------#
+#==============================================================================#
+INCS_DIR = inc/
+SRCS_DIR = src/
+OBJS_DIR = obj/
+#==============================================================================#
+#--------------------------------- Files --------------------------------------#
+#==============================================================================#
+INCS = libft.h
+#------------------------------------------------------------------------------#
+OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
+#------------------------------------------------------------------------------#
+SRCS = ${SRCS_DIR}ft_memset.c
+SRCS += ${SRCS_DIR}ft_bzero.c
+SRCS += ${SRCS_DIR}ft_memcpy.c
+SRCS += ${SRCS_DIR}ft_memccpy.c
+SRCS += ${SRCS_DIR}ft_memmove.c
+SRCS += ${SRCS_DIR}ft_memchr.c
+SRCS += ${SRCS_DIR}ft_memlchr.c
+SRCS += ${SRCS_DIR}ft_memcmp.c
+SRCS += ${SRCS_DIR}ft_strlen.c
+SRCS += ${SRCS_DIR}ft_isalpha.c
+SRCS += ${SRCS_DIR}ft_isdigit.c
+SRCS += ${SRCS_DIR}ft_isalnum.c
+SRCS += ${SRCS_DIR}ft_isascii.c
+SRCS += ${SRCS_DIR}ft_isprint.c
+SRCS += ${SRCS_DIR}ft_ischarset.c
+SRCS += ${SRCS_DIR}ft_tolower.c
+SRCS += ${SRCS_DIR}ft_toupper.c
+SRCS += ${SRCS_DIR}ft_strchr.c
+SRCS += ${SRCS_DIR}ft_strrchr.c
+SRCS += ${SRCS_DIR}ft_strncmp.c
+SRCS += ${SRCS_DIR}ft_strlcpy.c
+SRCS += ${SRCS_DIR}ft_strlcat.c
+SRCS += ${SRCS_DIR}ft_strnstr.c
+SRCS += ${SRCS_DIR}ft_atoi.c
+SRCS += ${SRCS_DIR}ft_calloc.c
+SRCS += ${SRCS_DIR}ft_realloc.c
+SRCS += ${SRCS_DIR}ft_strdup.c
+SRCS += ${SRCS_DIR}ft_substr.c
+SRCS += ${SRCS_DIR}ft_strjoin.c
+SRCS += ${SRCS_DIR}ft_strtrim.c
+SRCS += ${SRCS_DIR}ft_split.c
+SRCS += ${SRCS_DIR}ft_itoa.c
+SRCS += ${SRCS_DIR}ft_itoa_base.c
+SRCS += ${SRCS_DIR}ft_strmapi.c
+SRCS += ${SRCS_DIR}ft_putchar_fd.c
+SRCS += ${SRCS_DIR}ft_putstr_fd.c
+SRCS += ${SRCS_DIR}ft_putendl_fd.c
+SRCS += ${SRCS_DIR}ft_putnbr_fd.c
+SRCS += ${SRCS_DIR}ft_lstnew.c
+SRCS += ${SRCS_DIR}ft_lstadd_front.c
+SRCS += ${SRCS_DIR}ft_lstsize.c
+SRCS += ${SRCS_DIR}ft_lstlast.c
+SRCS += ${SRCS_DIR}ft_lstadd_back.c
+SRCS += ${SRCS_DIR}ft_lstdelone.c
+SRCS += ${SRCS_DIR}ft_lstclear.c
+SRCS += ${SRCS_DIR}ft_lstiter.c
+SRCS += ${SRCS_DIR}ft_lstmap.c
+SRCS += ${SRCS_DIR}ft_putchar.c
+SRCS += ${SRCS_DIR}ft_putnchar.c
+SRCS += ${SRCS_DIR}ft_putstr.c
+SRCS += ${SRCS_DIR}ft_putendl.c
+SRCS += ${SRCS_DIR}ft_putnbr.c
+SRCS += ${SRCS_DIR}ft_putnbr_base.c
+SRCS += ${SRCS_DIR}ft_strnlen.c
+SRCS += ${SRCS_DIR}ft_strcat.c
+SRCS += ${SRCS_DIR}ft_strcmp.c
+SRCS += ${SRCS_DIR}ft_isspace.c
+SRCS += ${SRCS_DIR}ft_sqrt.c
+SRCS += ${SRCS_DIR}ft_intlen.c
+SRCS += ${SRCS_DIR}ft_intlen_base.c
+SRCS += ${SRCS_DIR}ft_nstr.c
+SRCS += ${SRCS_DIR}ft_kernel_panic.c
+SRCS += ${SRCS_DIR}get_next_line.c
+#==============================================================================#
+#-------------------------------- Compiler ------------------------------------#
+#==============================================================================#
+CC = gcc
+CFLAGS = -Wall
+CFLAGS += -Wextra
+CFLAGS += -Werror
+CFLAGS += ${DEBUG}
+CFLAGS += ${FSANITIZE}
+#------------------------------------------------------------------------------#
+DEBUG = -Og -ggdb
+FSANITIZE = -fsanitize=address
+#------------------------------------------------------------------------------#
+NAME = libft.a
+#==============================================================================#
+#-------------------------------- Library -------------------------------------#
+#==============================================================================#
+AR = ar rcs
+#==============================================================================#
+#--------------------------------- UNIX ---------------------------------------#
+#==============================================================================#
+MKDIR = mkdir -p
+RM = rm -rf
+#==============================================================================#
+#--------------------------------- Rules --------------------------------------#
+#==============================================================================#
${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}${INCS}
- @if [ ! -a ${OBJS_DIR} ]; then \
- ${MKDIR} ${OBJS_DIR}; \
- fi
- @${CC} ${CFLAGS} -I${INCS_DIR} -c $< -o $@
- @echo "Compiled $(subst ${OBJS_DIR},,$@)!"
-
-$(NAME): ${OBJS}
- @${AR} ${NAME} ${OBJS}
- @echo
- @echo "libft.a linked!"
-
-all: ${NAME}
-
+ @${MKDIR} ${OBJS_DIR}
+ ${CC} ${CFLAGS} -I${INCS_DIR} -o $@ -c $<
+#------------------------------------------------------------------------------#
+${NAME}: ${OBJS}
+ ${AR} ${NAME} ${OBJS}
+#------------------------------------------------------------------------------#
+all:
+ @$(MAKE) --no-print-directory -j5 ${NAME}
+#------------------------------------------------------------------------------#
clean:
- @${RM} ${OBJS}
- @echo "Removed obj files!"
-
+ ${RM} ${OBJS_DIR}
+#------------------------------------------------------------------------------#
fclean: clean
- @${RM} ${OBJS_DIR}
- @${RM} ${NAME}
- @echo "Removed everything!"
-
+ ${RM} ${NAME}
+#------------------------------------------------------------------------------#
re: fclean all
-
-default: all
-
-.PHONY: all clean clean fclean re
+#------------------------------------------------------------------------------#
+build: ${OBJS}
+ ${CC} ${CFLAGS} -Iinc/ -o a.out ${OBJS} ${SRCS_DIR}main.c
+#------------------------------------------------------------------------------#
+.PHONY: all clean clean fclean re default
+#==============================================================================#
+#-------------------------------- Colors --------------------------------------#
+#==============================================================================#
+_END = \033[0m
+_BOLD = \033[1m
+_UNDER = \033[4m
+#------------------------------------------------------------------------------#
+_NBLACK = \033[0;30m
+_NRED = \033[0;31m
+_NGREEN = \033[0;32m
+_NYELLOW = \033[0;33m
+_NBLUE = \033[0;34m
+_NMAGENTA = \033[0;35m
+_NCYAN = \033[0;36m
+_NWHITE = \033[0;37m
+#------------------------------------------------------------------------------#
+_BBLACK = \033[1;30m
+_BRED = \033[1;31m
+_BGREEN = \033[1;32m
+_BYELLOW = \033[1;33m
+_BBLUE = \033[1;34m
+_BMAGENTA = \033[1;35m
+_BCYAN = \033[1;36m
+_BWHITE = \033[1;37m
+#------------------------------------------------------------------------------#
+_IBLACK = \033[1;40m
+_IRED = \033[1;41m
+_IGREEN = \033[1;42m
+_IYELLOW = \033[1;43m
+_IBLUE = \033[1;44m
+_IMAGENTA = \033[1;45m
+_ICYAN = \033[1;46m
+_IWHITE = \033[1;47m
+#==================================== EOF =====================================#