summaryrefslogtreecommitdiffstats
path: root/libft/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libft/Makefile253
1 files changed, 127 insertions, 126 deletions
diff --git a/libft/Makefile b/libft/Makefile
index d5d6e5d..2bd6342 100644
--- a/libft/Makefile
+++ b/libft/Makefile
@@ -1,16 +1,3 @@
-# **************************************************************************** #
-# LE - / #
-# / #
-# Makefile .:: .:/ . .:: #
-# +:+:+ +: +: +:+:+ #
-# By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ #
-# #+# #+ #+ #+# #
-# Created: 2019/12/11 13:14:43 by rbousset #+# ## ## #+# #
-# Updated: 2019/12/11 18:34:05 by rbousset ### #+. /#+ ###.fr #
-# / #
-# / #
-# **************************************************************************** #
-
default: all
#==============================================================================#
#--------------------------------- Shell --------------------------------------#
@@ -27,83 +14,136 @@ OBJS_DIR = obj/
#==============================================================================#
INCS = libft.h
#------------------------------------------------------------------------------#
-OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
+SRCS_NAME = ft_memset.c
+SRCS_NAME += ft_bzero.c
+SRCS_NAME += ft_memcpy.c
+SRCS_NAME += ft_memccpy.c
+SRCS_NAME += ft_memmove.c
+SRCS_NAME += ft_memchr.c
+SRCS_NAME += ft_memlchr.c
+SRCS_NAME += ft_memcmp.c
+SRCS_NAME += ft_strlen.c
+SRCS_NAME += ft_isalpha.c
+SRCS_NAME += ft_isdigit.c
+SRCS_NAME += ft_isalnum.c
+SRCS_NAME += ft_isascii.c
+SRCS_NAME += ft_isprint.c
+SRCS_NAME += ft_ischarset.c
+SRCS_NAME += ft_tolower.c
+SRCS_NAME += ft_toupper.c
+SRCS_NAME += ft_strchr.c
+SRCS_NAME += ft_strrchr.c
+SRCS_NAME += ft_strlchr.c
+SRCS_NAME += ft_strncmp.c
+SRCS_NAME += ft_strlcpy.c
+SRCS_NAME += ft_strlcat.c
+SRCS_NAME += ft_strnstr.c
+SRCS_NAME += ft_atoi.c
+SRCS_NAME += ft_calloc.c
+SRCS_NAME += ft_nrealloc.c
+SRCS_NAME += ft_strdup.c
+SRCS_NAME += ft_substr.c
+SRCS_NAME += ft_strjoin.c
+SRCS_NAME += ft_strtrim.c
+SRCS_NAME += ft_split.c
+SRCS_NAME += ft_itoa.c
+SRCS_NAME += ft_itoa_base.c
+SRCS_NAME += ft_uitoa.c
+SRCS_NAME += ft_uitoa_base.c
+SRCS_NAME += ft_strmapi.c
+SRCS_NAME += ft_putchar_fd.c
+SRCS_NAME += ft_putstr_fd.c
+SRCS_NAME += ft_putendl_fd.c
+SRCS_NAME += ft_putnbr_fd.c
+SRCS_NAME += ft_lstnew.c
+SRCS_NAME += ft_lstadd_front.c
+SRCS_NAME += ft_lstsize.c
+SRCS_NAME += ft_lstlast.c
+SRCS_NAME += ft_lstadd_back.c
+SRCS_NAME += ft_lstdelone.c
+SRCS_NAME += ft_lstclear.c
+SRCS_NAME += ft_lstiter.c
+SRCS_NAME += ft_lstmap.c
+SRCS_NAME += ft_putchar.c
+SRCS_NAME += ft_putnchar.c
+SRCS_NAME += ft_putstr.c
+SRCS_NAME += ft_putendl.c
+SRCS_NAME += ft_putnbr.c
+SRCS_NAME += ft_putnbr_base.c
+SRCS_NAME += ft_strnlen.c
+SRCS_NAME += ft_strcat.c
+SRCS_NAME += ft_strcmp.c
+SRCS_NAME += ft_isspace.c
+SRCS_NAME += ft_sqrt.c
+SRCS_NAME += ft_intlen.c
+SRCS_NAME += ft_intlen_base.c
+SRCS_NAME += ft_uintlen.c
+SRCS_NAME += ft_uintlen_base.c
+SRCS_NAME += ft_nstr.c
+SRCS_NAME += ft_memdel.c
+SRCS_NAME += ft_kernel_panic.c
+SRCS_NAME += get_next_line.c
+SRCS_NAME += get_next_line_utils.c
+SRCS_NAME += ft_printf.c
+SRCS_NAME += ft_dprintf.c
+SRCS_NAME += ft_sprintf.c
+SRCS_NAME += ft_printf_init_struct.c
+SRCS_NAME += ft_printf_get_flags.c
+SRCS_NAME += ft_printf_use_flags.c
+SRCS_NAME += ft_printf_get_width_nstr.c
+SRCS_NAME += ft_printf_treat_flags.c
+SRCS_NAME += ft_printf_parts.c
+SRCS_NAME += ft_printf_put_width.c
+SRCS_NAME += ft_printf_put_precision.c
+SRCS_NAME += ft_printf_put_char.c
+SRCS_NAME += ft_printf_put_str.c
+SRCS_NAME += ft_printf_put_ptr.c
+SRCS_NAME += ft_printf_put_int.c
+SRCS_NAME += ft_printf_put_hex.c
+SRCS_NAME += ft_printf_put_none.c
+SRCS_NAME += ft_printf_get_s_putlen.c
+SRCS_NAME += ft_printf_process.c
+SRCS_NAME += ft_printf_cat_output.c
+SRCS_NAME += ft_printf_flag_to_atoi.c
+#------------------------------------------------------------------------------#
+SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME})
#------------------------------------------------------------------------------#
-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
+OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
+#==============================================================================#
+#--------------------------------- UNIX ---------------------------------------#
+#==============================================================================#
+MKDIR = mkdir -p
+RM = rm -rf
+OS = $(shell uname)
#==============================================================================#
#-------------------------------- Compiler ------------------------------------#
#==============================================================================#
-CC = gcc
-CFLAGS = -Wall
+ifeq (${OS}, Linux)
+ DBG = -ggdb
+else
+ DBG = -glldb
+endif
+FSANITIZE = -fsanitize=address
+#------------------------------------------------------------------------------#
+ifeq (${OS}, Linux)
+ CC = gcc
+else
+ CC = clang
+endif
+#------------------------------------------------------------------------------#
+CFLAGS = -std=c89
+CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
-CFLAGS += ${DEBUG}
-CFLAGS += ${FSANITIZE}
+CFLAGS += -pedantic
+ifdef DEBUG
+ CFLAGS += ${DBG}
+endif
#------------------------------------------------------------------------------#
-DEBUG = -Og -ggdb
-FSANITIZE = -fsanitize=address
+ifdef ASAN
+ CFLAGS += ${DBG}
+ CFLAGS += ${FSANITIZE}
+endif
#------------------------------------------------------------------------------#
NAME = libft.a
#==============================================================================#
@@ -111,22 +151,16 @@ NAME = libft.a
#==============================================================================#
AR = ar rcs
#==============================================================================#
-#--------------------------------- UNIX ---------------------------------------#
-#==============================================================================#
-MKDIR = mkdir -p
-RM = rm -rf
-#==============================================================================#
#--------------------------------- Rules --------------------------------------#
#==============================================================================#
${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}${INCS}
@${MKDIR} ${OBJS_DIR}
- ${CC} ${CFLAGS} -I${INCS_DIR} -o $@ -c $<
+ ${CC} -c ${CFLAGS} -I${INCS_DIR} -o $@ $<
#------------------------------------------------------------------------------#
${NAME}: ${OBJS}
${AR} ${NAME} ${OBJS}
#------------------------------------------------------------------------------#
-all:
- @$(MAKE) --no-print-directory -j5 ${NAME}
+all: ${NAME}
#------------------------------------------------------------------------------#
clean:
${RM} ${OBJS_DIR}
@@ -136,41 +170,8 @@ fclean: clean
#------------------------------------------------------------------------------#
re: fclean all
#------------------------------------------------------------------------------#
-build: ${OBJS}
+run: ${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
+.PHONY: all clean clean fclean re run default
#==================================== EOF =====================================#