feat: Makefile and test main

This commit is contained in:
gbrochar 2024-02-24 08:17:58 +01:00
parent e41fd99ce1
commit c1a848d05b
3 changed files with 41 additions and 0 deletions

27
Makefile Normal file
View File

@ -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

8
libasm.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef _LIBASM_H
# define _LIBASM_H
#include <stdio.h>
ssize_t ft_strlen(const char *);
#endif

6
main.c Normal file
View File

@ -0,0 +1,6 @@
#include "libasm.h"
int main() {
printf("%ld\n", ft_strlen("c'est moi la chaine de 36 caracteres"));
return 0;
}