# **************************************************************************** #
#                                                                              #
#                                                         :::      ::::::::    #
#    Makefile                                           :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: pbonilla <eirodeis.lepnj@gmail.com>        +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2021/01/18 18:08:51 by pbonilla          #+#    #+#              #
#    Updated: 2021/02/07 14:20:29 by pbonilla         ###   ########.fr        #
#                                                                              #
# **************************************************************************** #

NAME	= libft.a

SRCS_PATH	= ./

SRCS  =		$(SRCS_PATH)ft_atoi.c \
			$(SRCS_PATH)ft_toupper.c \
			$(SRCS_PATH)ft_bzero.c \
			$(SRCS_PATH)ft_isalnum.c \
			$(SRCS_PATH)ft_tolower.c \
			$(SRCS_PATH)ft_memcpy.c \
			$(SRCS_PATH)ft_memccpy.c \
			$(SRCS_PATH)ft_memmove.c \
			$(SRCS_PATH)ft_memset.c \
			$(SRCS_PATH)ft_memchr.c \
			$(SRCS_PATH)ft_memcmp.c \
			$(SRCS_PATH)ft_strlcat.c \
			$(SRCS_PATH)ft_strnstr.c \
			$(SRCS_PATH)ft_strlcat.c \
			$(SRCS_PATH)ft_strlen.c \
			$(SRCS_PATH)ft_strchr.c \
			$(SRCS_PATH)ft_strrchr.c \
			$(SRCS_PATH)ft_isalpha.c \
			$(SRCS_PATH)ft_isascii.c \
			$(SRCS_PATH)ft_strlcpy.c \
			$(SRCS_PATH)ft_strncmp.c \
			$(SRCS_PATH)ft_isdigit.c \
			$(SRCS_PATH)ft_isprint.c \
			$(SRCS_PATH)ft_toupper.c \
			$(SRCS_PATH)ft_bzero.c \
			$(SRCS_PATH)ft_strdup.c \
			$(SRCS_PATH)ft_strnstr.c \
			$(SRCS_PATH)ft_strnstr_nullterminated.c \
			$(SRCS_PATH)ft_calloc.c \
			$(SRCS_PATH)ft_substr.c \
			$(SRCS_PATH)ft_strjoin.c \
			$(SRCS_PATH)ft_u_itoa.c \
			$(SRCS_PATH)ft_itoa.c \
			$(SRCS_PATH)ft_strmapi.c \
			$(SRCS_PATH)ft_putchar_fd.c \
			$(SRCS_PATH)ft_putstr_fd.c \
			$(SRCS_PATH)ft_putnbr_fd.c \
			$(SRCS_PATH)ft_putendl_fd.c \
			$(SRCS_PATH)ft_strtrim.c \
			$(SRCS_PATH)ft_split.c \
			$(SRCS_PATH)ft_u_convert.c \
			$(SRCS_PATH)ft_convert_base.c \
			$(SRCS_PATH)ft_revert_int.c \


BONUS  =	$(SRCS_PATH)ft_lstnew.c \
			$(SRCS_PATH)ft_lstadd_front.c \
			$(SRCS_PATH)ft_lstsize.c \
			$(SRCS_PATH)ft_lstlast.c \
			$(SRCS_PATH)ft_lstadd_back.c \
			$(SRCS_PATH)ft_lstdelone.c \
			$(SRCS_PATH)ft_lstclear.c \
			$(SRCS_PATH)ft_lstiter.c \
			$(SRCS_PATH)ft_lstmap.c \

OBJS		= ${SRCS:.c=.o}

BONUS_OBJS	=  $(BONUS:.c=.o)

CC			= gcc

RM			= rm -f

CFLAGS		= -Wall -Wextra -Werror

$(NAME):	$(OBJS) 
	ar rc $(NAME) $(OBJS)
	ranlib $(NAME)

all:	$(NAME)

.c.o:
		${CC} ${INCLUDES} ${DEFINES} ${CFLAGS} -c $< -o $@

clean:
	rm -rf $(OBJS) $(BONUS_OBJS)

fclean: clean
	rm -rf $(NAME)

re: fclean all

bonus:	$(OBJS) $(BONUS_OBJS)
	ar rc $(NAME) $(OBJS) $(BONUS_OBJS)
	ranlib $(NAME)

.PHONY : all clean fclean re bonus