-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (29 loc) · 698 Bytes
/
Copy pathMakefile
File metadata and controls
39 lines (29 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
NAME := libasm.a
ASM_SRC := ft_strlen.s ft_strcpy.s ft_strcmp.s ft_write.s ft_read.s ft_strdup.s
SRC_DIR := src/
OBJ_DIR := obj/
OBJ := $(addprefix $(OBJ_DIR), $(ASM_SRC:.s=.o))
NASM := nasm
NASMFLAGS := -f elf64
CC := gcc
CFLAGS := -Wall -Wextra -Werror
RM := rm -f
AR := ar rcs
TEST_BIN := test.out
all: $(NAME)
$(NAME): $(OBJ)
$(AR) $(NAME) $(OBJ)
$(OBJ_DIR)%.o: $(SRC_DIR)%.s
@mkdir -p $(OBJ_DIR)
$(NASM) $(NASMFLAGS) $< -o $@
clean:
rm -rf $(OBJ_DIR)
fclean: clean
$(RM) $(NAME) $(TEST_BIN)
re: fclean all
test: $(TEST_BIN)
./$(TEST_BIN)
$(TEST_BIN): $(NAME) main.c
$(CC) $(CFLAGS) main.c -L. -lasm -o $(TEST_BIN)
test_re: fclean test
.PHONY: all clean fclean re test test_re