Compare commits
3 Commits
e98394cc4c
...
673c289b91
Author | SHA1 | Date |
---|---|---|
gbrochar | 673c289b91 | |
gbrochar | fec6a59f6b | |
gbrochar | 09440fd042 |
|
@ -1,6 +1,9 @@
|
|||
# ft_nm
|
||||
ft_nm
|
||||
|
||||
# libft
|
||||
inc/libft.h
|
||||
|
||||
# vim
|
||||
*.swp
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "libft2"]
|
||||
path = libft2
|
||||
url = https://git.gaetanbrochard.dev/gbrochar/libft2.git
|
14
Makefile
14
Makefile
|
@ -18,6 +18,8 @@ CC = gcc
|
|||
|
||||
CFLAGS = -Wall -Werror -Wextra
|
||||
|
||||
LIB_NAME = libft2
|
||||
|
||||
RED = \033[31m
|
||||
GREEN = \033[32m
|
||||
YELLOW = \033[33m
|
||||
|
@ -27,12 +29,17 @@ WHITE = \033[0m
|
|||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ) $(INC)
|
||||
$(NAME): create_libft $(OBJ) $(INC)
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC)
|
||||
@mv $(OBJ_FILES) $(OBJ_DIR)
|
||||
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME)
|
||||
@$(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)/inc/libft.h inc/libft.h
|
||||
|
||||
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
|
||||
@if [ ! -d ./obj ]; then \
|
||||
mkdir -p ./obj; \
|
||||
|
@ -41,9 +48,12 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.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
|
||||
|
|
|
@ -7,4 +7,6 @@
|
|||
# include <elf.h>
|
||||
# include <stdio.h>
|
||||
|
||||
# include "libft.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e6177d94293e31fd8e54d568455abb1108ad1f11
|
10
src/main.c
10
src/main.c
|
@ -1,7 +1,13 @@
|
|||
#include "ft_nm.h"
|
||||
|
||||
int main(void) {
|
||||
int fd = open("ft_nm", O_RDONLY);
|
||||
int main(int ac, char **av) {
|
||||
char *path = ft_strdup("a.out");
|
||||
if (ac > 1) {
|
||||
free(path);
|
||||
path = av[1];
|
||||
}
|
||||
int fd = open(path, O_RDONLY);
|
||||
printf("Opening file %s with fd %d\n", path, fd);
|
||||
void *ptr = NULL;
|
||||
Elf64_Ehdr *header;
|
||||
|
||||
|
|
Loading…
Reference in New Issue