#******************************************************************************#
#                                                                              #
#                                                         :::      ::::::::    #
#    Makefile                                           :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2015/11/27 00:02:23 by bchanot           #+#    #+#              #
#*   Updated: 2018/10/12 22:30:35 by bchanot          ###   ########.fr       *#
#                                                                              #
#******************************************************************************#

CC = gcc -Wall -Wextra -Werror -g
NAME = libft.a
OBJS_DIR = .objects/
SRCS_DIR = srcs/
INC = -I./includes
FILES = ft_atoi \
	ft_strrchr \
	ft_bzero \
	ft_memalloc \
	ft_strsplit \
	ft_isalnum \
	ft_isnum \
	ft_memccpy \
	ft_strjoin \
	ft_strstr \
	ft_isalpha \
	ft_memchr \
	ft_putstr \
	ft_strlcat \
	ft_strsub \
	ft_isascii \
	ft_memcmp \
	ft_strlen \
	ft_strtrim \
	ft_isdigit \
	ft_memcpy \
	ft_strcat \
	ft_tolower \
	ft_isprint \
	ft_memdel \
	ft_strchr \
	ft_toupper \
	ft_strncat \
	ft_strcmp \
	ft_strncmp \
	ft_memset \
	ft_strcpy \
	ft_strncpy \
	ft_putchar \
	ft_strnequ \
	ft_strdup \
	ft_strnew \
	ft_putendl \
	ft_strequ \
	ft_strnstr \
	ft_cptchar \
	ft_puttab \
	ft_exit \
	ft_sqrt \
	ft_unicode \
	ft_strnjoin \
	ft_getchar \
	ft_charjoin \
	ft_isupper \
	ft_islower \
	ft_memdel2 \
	ft_strisdigit \
	ft_strcmp_end \
	ft_tablen \
	ft_swap \
	ft_tabnew \
	ft_printf \
	ft_strcorr \
	ft_strichr \
	ft_strreplace \
	ft_cptcmp \
	ft_itoa_base_depth \
	ft_itoa_base \
	ft_take_last_chain \
	ft_nb_word \
	ft_tabjoin \
	ft_getenv \
	ft_tabdup \
	ft_cptchar_glued \
	ft_puthex \
	ft_putascii \
	ft_system \
	ft_print_memory \
	ft_dup_first_word \
	ft_strndup \
	ft_strmerge \
	ft_take_args \
	ft_take_opts \
	ft_get_file_content \
	ft_str_upper \
	ft_str_lower \
	ft_pow \
	ft_nbrlen \
	ft_putnbr \
	get_next_line
PRINTF = pf_b \
		pf_c \
		pf_c_up \
		pf_d_up \
		pf_di \
		pf_len \
		pf_more_inf \
		pf_o \
		pf_o_up \
		pf_p \
		pf_percent \
		pf_putnbr \
		pf_putnbrlong \
		pf_putstr \
		pf_s \
		pf_s_up \
		pf_take_inf \
		pf_u \
		pf_u_up \
		pf_x \
		pf_x_up
SRC_PRINTF = $(addprefix ft_printf/, $(PRINTF))
SRC = $(FILES) $(SRC_PRINTF)
OBJS := $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRC)))
RED = \033[1;31m
BLUE = \033[1;34m
CYAN = \033[0;36m
GREEN = \033[1;32m
YELLOW = \033[1;33m
EOC = \033[0m

all: $(NAME)

$(NAME): $(OBJS)
	@ar rc $(NAME) $(OBJS)
	@ranlib $(NAME)
	@echo -e "$(GREEN)Libft crated.$(EOC)"

$(OBJS_DIR)%.o: $(SRCS_DIR)%.c
	@mkdir -p $(dir $@)
	$(CC) -c $< $(INC) -o $@

clean:
	@/bin/rm -rf $(OBJS_DIR)

fclean: clean
	@/bin/rm -f $(NAME)

re: fclean all

.PHONY: all clean fclean re
