woody-woodpacker/Makefile

61 lines
1.2 KiB
Makefile
Raw Normal View History

2024-08-27 08:43:56 +00:00
NAME = woody_woodpacker
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
SRC_FILE = main.c \
2024-08-27 09:43:26 +00:00
woody_woodpacker.c \
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
OBJ_FILE = $(SRC_FILE:.c=.o)
2024-02-14 10:37:05 +00:00
2024-08-27 08:43:56 +00:00
INC_FILE = woody.h \
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
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))
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
CC = gcc
CFLAGS = -Wall -Werror -Wextra
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
LIB = ft_printf/libftprintf.a
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
GREEN = \033[32m
RED = \033[31m
ORANGE = \033[33m
PURPLE = \033[35m
CYAN = \033[36m
WHITE = \033[0m
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
all: $(NAME)
2024-02-14 08:58:04 +00:00
2024-08-27 09:43:26 +00:00
$(NAME): ft_printf $(OBJ) $(INC)
2024-08-27 08:43:56 +00:00
@$(CC) $(CFLAGS) $(OBJ) $(LIB) -o $(NAME)
@echo -e "$(GREEN)[OK]$(WHITE) $(NAME)"
2024-02-14 08:58:04 +00:00
2024-08-27 08:43:56 +00:00
$(OBJ_DIR)%.o: $(SRC_DIR)%.c $(INC)
@if [ ! -d ./obj ]; then \
mkdir -p ./obj; \
fi;
2024-08-27 09:43:26 +00:00
@$(CC) $(CFLAGS) -I $(INC_DIR) -I ft_printf/inc -o $@ -c $<
@echo -e "$(CYAN)[CC]$(WHITE) $(<:$(SRC_DIR)%=%)"
ft_printf:
@echo -e "$(PURPLE)[MAKE]$(WHITE) ft_printf"
@make --no-print-directory -C ft_printf
2024-02-14 08:58:04 +00:00
clean:
2024-08-27 08:43:56 +00:00
@make --no-print-directory -C ft_printf 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 ft_printf 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
2024-08-27 08:43:56 +00:00
re: fclean all
2024-02-14 08:58:04 +00:00
2024-08-27 09:43:26 +00:00
.PHONY: all ft_printf clean fclean re