-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (48 loc) · 1.85 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yhetman <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/04/10 01:20:26 by yhetman #+# #+# #
# Updated: 2019/09/18 17:22:54 by blukasho ### ########.fr #
# #
# **************************************************************************** #
.PHONY: all clean fclean re mclean mfclean mre
NAME := ft_ls
SRC_PATH := sources/
INC_PATH := includes/
LIB_PATH := libft/
OBJ_PATH := obj/
CC := clang
CFLAGS := -g3 -Wall -Wextra -Werror -fsanitize=address
IFLAGS := -I $(INC_PATH) -I $(LIB_PATH)
LIB := $(LIB_PATH)libft.a
HFILES := ft_ls structs
FILES := ft_ls flags errors \
sortings swap_files \
adding dir
HDRS := $(addprefix $(INC_PATH), $(addsuffix .h, $(HFILES)))
SRCS := $(addprefix $(SRC_PATH), $(addsuffix .c, $(FILES)))
OBJS := $(addprefix $(OBJ_PATH), $(SRCS:%.c=%.o))
all: $(NAME)
$(NAME): $(LIB) $(OBJ_PATH) $(OBJS)
$(CC) $(CFLAGS) $(IFLAGS) $(OBJS) $(LIB) -o $(NAME)
$(LIB):
make -C $(LIB_PATH)
$(OBJ_PATH):
mkdir -p $(OBJ_PATH)$(SRC_PATH)
$(OBJ_PATH)%.o: %.c $(HDRS)
$(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
clean: mclean
make clean -C $(LIB_PATH)
fclean: mfclean
make fclean -C $(LIB_PATH)
re: fclean all
mclean:
rm -rf $(OBJ_PATH)
mfclean:
rm -f $(NAME)
rm -rf $(OBJ_PATH)
mre: mfclean all