woody-woodpacker/ft_printf/Makefile

69 lines
1.4 KiB
Makefile
Raw Normal View History

2024-08-27 08:43:56 +00:00
NAME = libftprintf.a
SRC_FILE = ft_printf.c \
ft_parser.c \
ft_int_case.c \
ft_char_case.c \
ft_str_case.c \
ft_ui_case.c \
ft_x_case.c \
ft_ptr_case.c \
ft_percent_case.c \
ft_printf_memset.c \
OBJ_FILE = $(SRC_FILE:.c=.o)
INC_FILE = ft_printf.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
PURPLE = \033[35m
CYAN = \033[36m
WHITE = \033[0m
all: $(NAME)
2024-08-27 09:43:26 +00:00
$(NAME): libft $(OBJ) $(INC)
2024-08-27 08:43:56 +00:00
@cp libft/libft.a $(NAME)
@ar -rcs $(NAME) $(OBJ)
@ranlib $(NAME)
@echo -e "$(GREEN)[OK]$(WHITE) $(NAME)"
$(OBJ_DIR)%.o: $(SRC_DIR)%.c libft/ $(INC)
@if [ ! -d ./obj ]; then \
mkdir -p ./obj; \
fi;
@$(CC) $(CFLAGS) -I $(INC_DIR) -I libft/inc -o $@ -c $<
2024-08-27 09:43:26 +00:00
@echo -e "$(CYAN)[CC]$(WHITE) $(<:$(SRC_DIR)%=%)"
libft:
@echo -e "$(PURPLE)[MAKE]$(WHITE) libft"
@make --no-print-directory -C ./libft
2024-02-14 08:58:04 +00:00
clean:
2024-08-27 08:43:56 +00:00
@make --no-print-directory -C libft clean
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
@rm -rf $(OBJ_DIR)
2024-02-14 08:58:04 +00:00
2024-08-27 09:43:26 +00:00
fclean:
2024-08-27 08:43:56 +00:00
@make --no-print-directory -C libft fclean
2024-08-27 09:43:26 +00:00
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
@rm -rf $(OBJ_DIR)
2024-08-27 08:43:56 +00:00
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
@rm -f $(NAME)
2024-02-14 08:58:04 +00:00
re: fclean all
2024-08-27 09:43:26 +00:00
.PHONY: all libft clean fclean re