-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 2.39 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
# **************************************************************************** #
# #
# ::: ::: ::: #
# Makefile :+: :+: :+: :+: #
# +:++:+ +:+ + +:+ #
# By: amahla <ammah.connect@outlook.fr> +#+ +:+ +#+ +#+ #
# +#+ +#+ +#+ +#+ #
# Created: 2023/10/17 02:01:51 by amahla #+# #+# #+# #+# #
# Updated: 2023/11/11 17:40:15 by amahla ### ######## ######## #
# #
# **************************************************************************** #
NAME = ft_nm
CC := gcc
CFLAGS := -Wall -Werror -Wextra
DFLAGS := -MMD -MP
LIBDIR := libft
INC := -I libft/libft/includes -I inc
LIB := -L libft -lft
OUTDIR := obj
SRCDIR := src
SRC := $(addprefix $(SRCDIR)/, nm.c \
file_reader.c \
file_parser.c \
print_symbols.c \
utils.c \
$(addprefix elf64/, parse_class64.c \
quicksort64.c \
find_letter64.c \
) \
$(addprefix elf32/, parse_class32.c \
quicksort32.c \
find_letter32.c \
) \
)
OBJ := $(SRC:.c=.o)
DEP := $(SRC:.c=.d)
RM := rm -rf
all : $(NAME)
$(OUTDIR)/%.o : %.c
$(CC) $(DFLAGS) $(CFLAGS) $(INC) -o $@ -c $<
$(NAME) : $(OUTDIR) $(addprefix $(OUTDIR)/, $(OBJ))
@$(MAKE) -j -C $(LIBDIR) > /dev/null
$(CC) $(CFLAGS) -o $@ $(addprefix $(OUTDIR)/, $(OBJ)) $(INC) $(LIB)
$(OUTDIR) :
@mkdir -p $(addprefix $@/, $(addprefix $(SRCDIR)/, elf64))
@mkdir -p $(addprefix $@/, $(addprefix $(SRCDIR)/, elf32))
.PHONY : all debug test clean fclean re
debug : CFLAGS=-g3 -Wall -Werror -Wextra
debug : all
test : all
./tests/script.sh
clean :
@$(MAKE) clean -C $(LIBDIR) > /dev/null
$(RM) $(OUTDIR)
fclean : clean
@$(MAKE) fclean -C $(LIBDIR) > /dev/null
$(RM) $(NAME) ./tests/output
re : fclean
@$(MAKE) re -j -C $(LIBDIR) > /dev/null
make all
-include $(addprefix $(OUTDIR)/, $(DEP)))
-include $(addprefix $(OUTDIR)/, $(addprefix $(DEP)/, elf64)))
-include $(addprefix $(OUTDIR)/, $(addprefix $(DEP)/, elf32)))