Compare commits

..

No commits in common. "673c289b91f9539c73b4314939929cda534e2139" and "e98394cc4ce1a35fc3570986712d45f6f217c82f" have entirely different histories.

6 changed files with 4 additions and 29 deletions

3
.gitignore vendored
View File

@ -1,9 +1,6 @@
# ft_nm # ft_nm
ft_nm ft_nm
# libft
inc/libft.h
# vim # vim
*.swp *.swp

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "libft2"]
path = libft2
url = https://git.gaetanbrochard.dev/gbrochar/libft2.git

View File

@ -18,8 +18,6 @@ CC = gcc
CFLAGS = -Wall -Werror -Wextra CFLAGS = -Wall -Werror -Wextra
LIB_NAME = libft2
RED = \033[31m RED = \033[31m
GREEN = \033[32m GREEN = \033[32m
YELLOW = \033[33m YELLOW = \033[33m
@ -29,17 +27,12 @@ WHITE = \033[0m
all: $(NAME) all: $(NAME)
$(NAME): create_libft $(OBJ) $(INC) $(NAME): $(OBJ) $(INC)
@$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC) @$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC)
@mv $(OBJ_FILES) $(OBJ_DIR) @mv $(OBJ_FILES) $(OBJ_DIR)
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME) ./$(LIB_NAME)/libft.a @$(CC) $(CFLAGS) $(OBJ) -o $(NAME)
@echo "$(GREEN)[OK]$(WHITE) $(NAME)" @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 $(OBJ_DIR)%.o: $(SRC_DIR)%.c
@if [ ! -d ./obj ]; then \ @if [ ! -d ./obj ]; then \
mkdir -p ./obj; \ mkdir -p ./obj; \
@ -48,12 +41,9 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.c
@echo "$(CYAN)[CC]$(WHITE) $<" @echo "$(CYAN)[CC]$(WHITE) $<"
clean: clean:
@make -C $(LIB_NAME) clean
@rm -f $(INC_DIR)/libft.h
@rm -rf $(OBJ) @rm -rf $(OBJ)
fclean: clean fclean: clean
@make -C $(LIB_NAME) fclean
@rm -f $(NAME) @rm -f $(NAME)
re: fclean all re: fclean all

View File

@ -7,6 +7,4 @@
# include <elf.h> # include <elf.h>
# include <stdio.h> # include <stdio.h>
# include "libft.h"
#endif #endif

1
libft2

@ -1 +0,0 @@
Subproject commit e6177d94293e31fd8e54d568455abb1108ad1f11

View File

@ -1,13 +1,7 @@
#include "ft_nm.h" #include "ft_nm.h"
int main(int ac, char **av) { int main(void) {
char *path = ft_strdup("a.out"); int fd = open("ft_nm", O_RDONLY);
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; void *ptr = NULL;
Elf64_Ehdr *header; Elf64_Ehdr *header;