diff --git a/Makefile b/Makefile index 5d4908a..c679dc3 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ NAME ?= libasm.a SRCS_DIR = srcs SRCS_BONUS_DIR = srcs/bonus OBJS_DIR = .objs - SRCS_NAMES = ft_strlen.s\ ft_strcpy.s\ ft_strcmp.s\ @@ -27,13 +26,13 @@ FLAGS = -felf64 all: $(NAME) -libasm_bonus.a : $(OBJS_DIR) $(OBJS) $(OBJS_BONUS) - ar rcs libasm_bonus.a $(OBJS) $(OBJS_BONUS) - -test: test.c libasm_bonus.a +test: test.c bonus clang -z noexecstack test.c -L. -lasm_bonus -o test -g ./test || echo -e "\033[31m tests exited with an error code" +bonus: $(OBJS_DIR) $(OBJS) $(OBJS_BONUS) + ar rcs $@ $(OBJS) $(OBJS_BONUS) + $(NAME): $(OBJS_DIR) $(OBJS) ar rcs $@ $(OBJS) @@ -51,6 +50,5 @@ clean: fclean: clean rm -f $(NAME) test - rm -f libasm_bonus.a .PHONY: fclean clean all diff --git a/srcs/ft_read.s b/srcs/ft_read.s index 96197db..f014cd1 100644 --- a/srcs/ft_read.s +++ b/srcs/ft_read.s @@ -7,7 +7,7 @@ ft_read: syscall cmp rax, 0 ; if return is < 0, it's an error in negative - jg success + jge success neg rax ; inv errno, and set errno mov edi, eax diff --git a/srcs/ft_write.s b/srcs/ft_write.s index 355fab5..91c7f11 100644 --- a/srcs/ft_write.s +++ b/srcs/ft_write.s @@ -7,7 +7,7 @@ ft_write: syscall cmp rax, 0 ; if return is < 0, it's an error in negative - jg success + jge success neg rax ; inv errno, and set errno mov edi, eax