-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (55 loc) · 1.75 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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: vincent <[email protected]> +#+ #
# +#+ #
# Created: 2021/02/05 15:22:46 by vincent #+# #+# #
# Updated: 2021/03/28 11:57:50 by vincent ######## odam.nl #
# #
# **************************************************************************** #
NAME = libasm.a
all: $(NAME)
SRC = ft_strlen.s \
ft_strcpy.s \
ft_strcmp.s \
ft_strdup.s \
ft_write.s \
ft_read.s
BONUSFILES = ft_atoi_base_bonus.s \
ft_list_push_front_bonus.s \
ft_list_size_bonus.s \
ft_list_remove_if_bonus.s \
ft_list_sort_bonus.s
ifdef BONUS
FILES = $(SRC) $(BONUSFILES)
else
FILES = $(SRC)
endif
OBJ = $(addprefix objs/, $(FILES:.s=.o))
objs/%.o: %.s
$(shell mkdir -p $(dir $@))
nasm -g -O0 -f macho64 $< -o $@
$(NAME): $(OBJ)
ar -rcs $(NAME) $(OBJ)
BONUSOBJ = $(addprefix objs/, $(BONUSFILES:.s=.o))
bonus:
@make BONUS=1
build_tests:
@make -C tests test_mandatory
build_bonus_tests: bonus
@make -C tests test_bonus
run_tests:
@make -C tests test_mandatory RUN=1
run_bonus_tests: bonus
@make -C tests test_bonus RUN=1
clean:
$(RM) $(OBJ)
ifndef BONUS
$(RM) $(BONUSOBJ)
endif
$(RM) -r objs/
fclean: clean
$(RM) $(NAME)
re: fclean $(NAME)