# **************************************************************************** #
#                                                                              #
#                                                         :::      ::::::::    #
#    Makefile                                           :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: pbonilla <eirodeis.lepnj@gmail.com>        +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2021/01/18 18:08:51 by pbonilla          #+#    #+#              #
#    Updated: 2021/03/12 12:27:09 by pbonilla         ###   ########.fr        #
#                                                                              #
# **************************************************************************** #

LIBFT   = ./libft/libft.a

NAME	= libftprintf.a

SRCS_PATH	= srcs/

SRCS  =		$(SRCS_PATH)ft_printf.c \
			$(SRCS_PATH)ft_parser.c \
			$(SRCS_PATH)ft_int_case.c \
			$(SRCS_PATH)ft_char_case.c \
			$(SRCS_PATH)ft_str_case.c \
			$(SRCS_PATH)ft_ui_case.c \
			$(SRCS_PATH)ft_x_case.c \
			$(SRCS_PATH)ft_ptr_case.c \
			$(SRCS_PATH)ft_percent_case.c \
			$(SRCS_PATH)ft_printf_memset.c \

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

CC			= gcc

RM			= rm -f


CFLAGS		= -Wall -Wextra -Werror

INCLUDES	= -I libft

all:	${NAME}

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

$(NAME): ${OBJS}
		$(MAKE) bonus -C ./libft
		cp libft/libft.a $(NAME)
		ar -rcs $(NAME) $(OBJS)
		ranlib $(NAME)

clean:
		$(MAKE) clean -C ./libft
		${RM} ${OBJS}


fclean:	clean
		$(MAKE) fclean -C ./libft
		${RM} ${NAME}

re: fclean all

.PHONY : all clean fclean re