NAME = ft_nm SRC_FILES = main.c \ error.c \ header.c \ ident.c \ nm.c \ fetch.c \ ft_printf.c \ INC_FILES = ft_nm.h \ OBJ_FILES = $(SRC_FILES:.c=.o) SRC_DIR = src/ INC_DIR = inc/ OBJ_DIR = obj/ SRC = $(addprefix $(SRC_DIR), $(SRC_FILES)) INC = $(addprefix $(INC_DIR), $(INC_FILES)) OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILES)) CC = gcc CFLAGS = -Wall -Werror -Wextra -g2 LIB_NAME = libft RED = \033[31m GREEN = \033[32m YELLOW = \033[33m BLUE = \033[34m CYAN = \033[36m WHITE = \033[0m all: $(NAME) dump: $(NAME) hexdump -C ft_nm > aaa $(NAME): create_libft $(OBJ) $(INC) @$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC) @mv $(OBJ_FILES) $(OBJ_DIR) @$(CC) $(CFLAGS) $(OBJ) -o $(NAME) ./$(LIB_NAME)/libft.a @echo "$(GREEN)[OK]$(WHITE) $(NAME)" create_libft: @git submodule update --init @make -C $(LIB_NAME) @cp $(LIB_NAME)/libft.h inc/libft.h $(OBJ_DIR)%.o: $(SRC_DIR)%.c @if [ ! -d ./obj ]; then \ mkdir -p ./obj; \ fi; @$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $< @echo "$(CYAN)[CC]$(WHITE) $<" clean: @make -C $(LIB_NAME) clean @rm -f $(INC_DIR)/libft.h @rm -rf $(OBJ) fclean: clean @make -C $(LIB_NAME) fclean @rm -f $(NAME) re: fclean all .PHONY: all clean fclean re