woody-woodpacker/ft_printf/libft/Makefile

101 lines
1.8 KiB
Makefile

NAME = libft.a
SRC_FILE = ft_atoi.c \
ft_toupper.c \
ft_bzero.c \
ft_isalnum.c \
ft_tolower.c \
ft_memcpy.c \
ft_memccpy.c \
ft_memmove.c \
ft_memset.c \
ft_memchr.c \
ft_memcmp.c \
ft_strlcat.c \
ft_strnstr.c \
ft_strlcat.c \
ft_strlen.c \
ft_strchr.c \
ft_strrchr.c \
ft_isalpha.c \
ft_isascii.c \
ft_strlcpy.c \
ft_strncmp.c \
ft_isdigit.c \
ft_isprint.c \
ft_toupper.c \
ft_bzero.c \
ft_strdup.c \
ft_strnstr.c \
ft_strnstr_nullterminated.c \
ft_calloc.c \
ft_substr.c \
ft_strjoin.c \
ft_u_itoa.c \
ft_itoa.c \
ft_strmapi.c \
ft_putchar_fd.c \
ft_putstr_fd.c \
ft_putnbr_fd.c \
ft_putendl_fd.c \
ft_strtrim.c \
ft_split.c \
ft_u_convert.c \
ft_convert_base.c \
ft_revert_int.c \
ft_lstnew.c \
ft_lstadd_front.c \
ft_lstsize.c \
ft_lstlast.c \
ft_lstadd_back.c \
ft_lstdelone.c \
ft_lstclear.c \
ft_lstiter.c \
ft_lstmap.c \
OBJ_FILE = $(SRC_FILE:.c=.o)
INC_FILE = libft.h
SRC_DIR = src/
OBJ_DIR = obj/
INC_DIR = inc/
SRC = $(addprefix $(SRC_DIR), $(SRC_FILE))
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE))
INC = $(addprefix $(INC_DIR), $(INC_FILE))
CC = gcc
CFLAGS = -Wall -Werror -Wextra
GREEN = \033[32m
RED = \033[31m
ORANGE = \033[33m
CYAN = \033[36m
WHITE = \033[0m
all: $(NAME)
$(NAME): $(OBJ) $(INC)
@ar rc $(NAME) $(OBJ)
@ranlib $(NAME)
@echo -e "$(GREEN)[OK]$(WHITE) $(NAME)"
$(OBJ_DIR)%.o: $(SRC_DIR)%.c $(INC)
@if [ ! -d ./obj ]; then \
mkdir -p ./obj; \
fi;
@$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $<
@echo -e "$(CYAN)[CC]$(WHITE) $<"
clean:
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
@rm -rf $(OBJ_DIR)
fclean: clean
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
@rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re