-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (61 loc) · 1.4 KB
/
Makefile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
##
## EPITECH PROJECT, 2021
## B-ASM-400-PAR-4-1-asmminilibc-benjamin.reigner
## File description:
## Makefile
##
MAKEFLAGS = --no-print-directory
AS = nasm
CC ?= gcc
RM ?= rm -f
ASFLAGS = -f elf64
CFLAGS = -std=gnu11 -Wall -Wextra -O0
CPPFLAGS = -iquote include
NAME = libasm.so
SRC += src/memcpy.asm
SRC += src/memmove.asm
SRC += src/memset.asm
SRC += src/rindex.asm
SRC += src/strcasecmp.asm
SRC += src/strchr.asm
SRC += src/strcmp.asm
SRC += src/strcspn.asm
SRC += src/strlen.asm
SRC += src/strncmp.asm
SRC += src/strpbrk.asm
SRC += src/strstr.asm
OBJ = $(SRC:.asm=.o)
TSRC += tests/test_memcpy.c
TSRC += tests/test_memmove.c
TSRC += tests/test_memset.c
TSRC += tests/test_rindex.c
TSRC += tests/test_strcasecmp.c
TSRC += tests/test_strchr.c
TSRC += tests/test_strcmp.c
TSRC += tests/test_strcspn.c
TSRC += tests/test_strlen.c
TSRC += tests/test_strncmp.c
TSRC += tests/test_strpbrk.c
TSRC += tests/test_strstr.c
TOBJ = $(TSRC:.c=.o)
ifdef DEBUG
CFLAGS += -ggdb3
ASFLAGS += -g
endif
%.o: %.asm
$(AS) $(ASFLAGS) $<
all: $(NAME)
$(NAME): $(OBJ)
ld -shared -fPIC $(OBJ) -o $(NAME)
tests_run: LDLIBS += -lcriterion
tests_run: ASFLAGS += -D UNIT_TEST=1
tests_run: $(OBJ) $(TOBJ)
$(CC) -o unit_test $(OBJ) $(TOBJ) $(LDLIBS)
clean:
$(RM) $(OBJ)
$(RM) $(TOBJ)
fclean: clean
$(RM) $(NAME)
$(RM) unit_test
re: fclean all
.PHONY: all tests_run clean fclean re