61 lines
1.2 KiB
Makefile
61 lines
1.2 KiB
Makefile
NAME = woody_woodpacker
|
|
|
|
SRC_FILE = main.c \
|
|
woody_woodpacker.c \
|
|
|
|
OBJ_FILE = $(SRC_FILE:.c=.o)
|
|
|
|
INC_FILE = woody.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
|
|
|
|
LIB = ft_printf/libftprintf.a
|
|
|
|
GREEN = \033[32m
|
|
RED = \033[31m
|
|
ORANGE = \033[33m
|
|
PURPLE = \033[35m
|
|
CYAN = \033[36m
|
|
WHITE = \033[0m
|
|
|
|
all: $(NAME)
|
|
|
|
$(NAME): ft_printf $(OBJ) $(INC)
|
|
@$(CC) $(CFLAGS) $(OBJ) $(LIB) -o $(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) -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
|
|
|
|
clean:
|
|
@make --no-print-directory -C ft_printf clean
|
|
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
|
@rm -rf $(OBJ_DIR)
|
|
|
|
fclean:
|
|
@make --no-print-directory -C ft_printf fclean
|
|
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
|
@rm -rf $(OBJ_DIR)
|
|
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
|
|
@rm -f $(NAME)
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: all ft_printf clean fclean re
|