From c1a848d05bc151f03532aafc298193963e93ada8 Mon Sep 17 00:00:00 2001 From: gbrochar Date: Sat, 24 Feb 2024 08:17:58 +0100 Subject: [PATCH] feat: Makefile and test main --- Makefile | 27 +++++++++++++++++++++++++++ libasm.h | 8 ++++++++ main.c | 6 ++++++ 3 files changed, 41 insertions(+) create mode 100644 Makefile create mode 100644 libasm.h create mode 100644 main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..10bd765 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +NAME = libasm + +SRC = ft_strlen.s + +OBJ = $(SRC:.s=.o) + +%.o:%.s + nasm -f elf64 $< -o $@ + +all: $(NAME) + +$(NAME): $(OBJ) + ar rcs libasm.a $(OBJ) + +test: $(NAME) + gcc -Wall -Werror -Wextra main.c -L. -lasm -o libasm_unit_tests + +clean: + rm $(OBJ) + +fclean: + rm libasm.a + rm libasm_unit_tests + +re: fclean all + +.PHONY: all test diff --git a/libasm.h b/libasm.h new file mode 100644 index 0000000..3499474 --- /dev/null +++ b/libasm.h @@ -0,0 +1,8 @@ +#ifndef _LIBASM_H +# define _LIBASM_H + +#include + +ssize_t ft_strlen(const char *); + +#endif diff --git a/main.c b/main.c new file mode 100644 index 0000000..fedfe6c --- /dev/null +++ b/main.c @@ -0,0 +1,6 @@ +#include "libasm.h" + +int main() { + printf("%ld\n", ft_strlen("c'est moi la chaine de 36 caracteres")); + return 0; +}