2024-03-12 19:24:48 +00:00
|
|
|
NAME = ft_nm
|
|
|
|
|
|
|
|
SRC_FILES = main.c \
|
2024-03-15 14:58:57 +00:00
|
|
|
error.c \
|
|
|
|
header.c \
|
2024-03-19 10:22:37 +00:00
|
|
|
ident.c \
|
2024-03-20 20:47:46 +00:00
|
|
|
nm.c \
|
|
|
|
fetch.c \
|
|
|
|
ft_printf.c \
|
2024-03-12 19:24:48 +00:00
|
|
|
|
|
|
|
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
|
2024-10-13 17:13:00 +00:00
|
|
|
|
|
|
|
CFLAGS = -Wall -Werror -Wextra -g2
|
2024-03-12 19:24:48 +00:00
|
|
|
|
2024-03-15 14:53:54 +00:00
|
|
|
LIB_NAME = libft
|
2024-03-13 14:41:03 +00:00
|
|
|
|
2024-03-12 19:24:48 +00:00
|
|
|
RED = \033[31m
|
|
|
|
GREEN = \033[32m
|
|
|
|
YELLOW = \033[33m
|
|
|
|
BLUE = \033[34m
|
|
|
|
CYAN = \033[36m
|
|
|
|
WHITE = \033[0m
|
|
|
|
|
|
|
|
all: $(NAME)
|
|
|
|
|
2024-03-25 10:06:09 +00:00
|
|
|
dump: $(NAME)
|
|
|
|
hexdump -C ft_nm > aaa
|
|
|
|
|
2024-03-13 14:41:03 +00:00
|
|
|
$(NAME): create_libft $(OBJ) $(INC)
|
2024-03-12 19:24:48 +00:00
|
|
|
@$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC)
|
|
|
|
@mv $(OBJ_FILES) $(OBJ_DIR)
|
2024-03-19 10:22:37 +00:00
|
|
|
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME) ./$(LIB_NAME)/libft.a
|
2024-03-12 19:24:48 +00:00
|
|
|
@echo "$(GREEN)[OK]$(WHITE) $(NAME)"
|
|
|
|
|
2024-03-13 14:41:03 +00:00
|
|
|
create_libft:
|
2024-03-13 15:00:01 +00:00
|
|
|
@git submodule update --init
|
2024-03-19 10:22:37 +00:00
|
|
|
@make -C $(LIB_NAME)
|
2024-03-15 14:53:54 +00:00
|
|
|
@cp $(LIB_NAME)/libft.h inc/libft.h
|
2024-03-13 14:41:03 +00:00
|
|
|
|
2024-03-12 19:24:48 +00:00
|
|
|
$(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:
|
2024-03-13 14:41:03 +00:00
|
|
|
@make -C $(LIB_NAME) clean
|
|
|
|
@rm -f $(INC_DIR)/libft.h
|
2024-03-12 19:24:48 +00:00
|
|
|
@rm -rf $(OBJ)
|
|
|
|
|
|
|
|
fclean: clean
|
2024-03-13 14:41:03 +00:00
|
|
|
@make -C $(LIB_NAME) fclean
|
2024-03-12 19:24:48 +00:00
|
|
|
@rm -f $(NAME)
|
|
|
|
|
|
|
|
re: fclean all
|
|
|
|
|
|
|
|
.PHONY: all clean fclean re
|