From 94d61d8aaee7a3df0dc1f055e27e0f4484cb3ffa Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 14 Jan 2020 15:47:21 +0100 Subject: Linux version without '_' prefix --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f1aa92d..7a3282e 100644 --- a/Makefile +++ b/Makefile @@ -12,26 +12,33 @@ RM = rm -f LIB = ar rcs +UNAME = $(shell uname) CC = gcc -CCFLAGS = -Wall -Wextra -fomit-frame-pointer +CCFLAGS = -Wall -Wextra -fomit-frame-pointer -fPIC NASM = nasm -NASMFLAGS = -f macho64 +ifeq ($(UNAME),Linux) + NASMFLAGS = -f elf64 +else + NASMFLAGS = -f macho64 +endif NAME = libasm.a ASMSRC = ft_strlen.s ft_strcpy.s ft_strcmp.s ft_write.s ft_read.s \ - ft_strdup.s ft_atoi_base.s ft_list_push_front.s \ - ft_list_size.s ft_list_sort.s ft_list_remove_if.s + ft_strdup.s ft_atoi_base.s #ft_list_push_front.s \ + # ft_list_size.s ft_list_sort.s ft_list_remove_if.s ASMOBJ = $(ASMSRC:.s=.o) +TESTNAME = runtest + all: $(NAME) $(NAME): $(ASMOBJ) $(LIB) $(NAME) $(ASMOBJ) test: all - $(CC) main.c $(NAME) + $(CC) main.c $(NAME) -o $(TESTNAME) %.o: %.s $(NASM) $(NASMFLAGS) -o $@ $< -- cgit