-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (80 loc) · 1.98 KB
/
Makefile
File metadata and controls
101 lines (80 loc) · 1.98 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
##
## EPITECH PROJECT, 2024
## Makefile
## File description:
## AN ASM makefile
##
# PARAM
NAME = libasm.so
_SRC = strlen.asm \
strchr.asm \
strrchr.asm \
strcmp.asm \
strstr.asm \
strncmp.asm \
strcasecmp.asm \
strpbrk.asm \
strcspn.asm \
memset.asm \
memcpy.asm \
memmove.asm \
rindex.asm \
index.asm \
memfrob.asm \
SRCDIR = src/
SRC = $(addprefix $(SRCDIR), $(_SRC))
OBJ = $(SRC:.asm=.o)
# MAKEFILE
WARNING = -W -Wall -Wextra
INCLUDE_DIR = -I ./include
CFLAGS = $(INCLUDE_DIR) $(WARNING)
CFLAGS_TEST = $(CFLAGS) -lcriterion --coverage -g3
SRC_TESTS = $(wildcard $(addprefix tests/, *).c)
CC = gcc
#ASM FLAGS
ASM = nasm
LD = ld
LDFLAGS = -fPIC -shared
NASMFLAGS = -f elf64 -Werror
all: $(NAME)
$(NAME): $(OBJ)
@$(LD) $(LDFLAGS) -o $(NAME) $(OBJ) \
&& echo -e "$(GREEN)-------- COMPILED --------$(END)" \
|| echo -e "$(RED)-------- $(BOLD)ERROR$(END)$(RED) --------$(END)"
%.o: %.asm
@$(ASM) $(NASMFLAGS) -o $@ $< \
&& echo -e "$(GREEN)[OK]$(BOLD)" $< "$(END)" \
|| echo -e "$(RED)[KO]$(BOLD)" $< "$(END)"
clean:
@rm -rf $(OBJ)
@echo -e "$(RED)[DELETE] $(OBJ)$(END)"
fclean: clean
@rm -rf $(NAME)
@echo -e "$(RED)[DELETE] $(NAME)$(END)"
@echo -e "$(RED)-------- CLEANED --------$(END)\n"
re: fclean all
@rm -f $(OBJ)
tests_run: fclean all $(NAME)
@$(CC) -o tests/test.out $(SRC_TESTS) $(CFLAGS_TEST)
./tests/test.out --verbose
# gcovr --exclude tests/
tests_clean:
rm -f *.gcda
rm -f *.gcno
rm -f tests/test.out*
ftest_run:
@echo -e "\n$(GREEN)-------- FTEST --------$(END)"
@cp libasm.so ftest/
@cd ftest/ && ftest -f .ftest.toml
.PHONY: all clean fclean re tests_run tests_clean
# TEXT COLOR AND STYLE
END = \x1b[0m
BOLD = \x1b[1m
GREY = \x1b[30m
RED = \x1b[31m
GREEN = \x1b[32m
YELLOW = \x1b[33m
BLUE = \x1b[34m
PURPLE = \x1b[35m
CYAN = \x1b[36m
WHITE = \x1b[37m