aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 12 insertions, 5 deletions
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 $@ $<