-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (37 loc) · 868 Bytes
/
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
NAME = ft_nm
CC = gcc
INC = -I ./includes -I libft/includes
SRCS_PATH = ./sources/
SRCS = main.c\
utils.c\
ehdr.c\
phdr.c\
shdr.c\
options.c\
symbols.c\
types.c
OBJS_PATH = ./objects/
OBJS = $(addprefix $(OBJS_PATH), $(SRCS:.c=.o))
DEPS = $(OBJS:.o=.d)
CFLAGS = -Wall -Wextra -Werror
CPPFLAGS = -MMD -c -g3
LIBFT = libft/libft.a
all: build
$(NAME): $(OBJS) $(LIBFT)
@$(MAKE) --no-print-directory -C libft/
$(CC) $(CFLAGS) $(OBJS) $(LIBFT) -o $@
$(OBJS_PATH)%.o: $(SRCS_PATH)%.c
mkdir -p $(OBJS_PATH)
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $@ $(INC)
libft:
@$(MAKE) --no-print-directory -C libft/
build: libft $(NAME)
clean:
rm -rf $(OBJS_PATH)
fclean: clean
$(MAKE) --no-print-directory -C libft/ fclean
rm -rf $(NAME)
re: fclean
$(MAKE) all
.PHONY: all, clean, fclean, re, libft
-include $(DEPS)