-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
49 lines (37 loc) · 1.63 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: apuchill <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/01/24 20:15:20 by apuchill #+# #+# #
# Updated: 2021/03/21 15:27:29 by apuchill ### ########.fr #
# #
# **************************************************************************** #
NAME = libft.a
DIR_SRCS = srcs
DIR_OBJS = objs
SUBDIRS = is to mem str put lst math gnl printf
SRCS_DIRS = $(foreach dir, $(SUBDIRS), $(addprefix $(DIR_SRCS)/, $(dir)))
OBJS_DIRS = $(foreach dir, $(SUBDIRS), $(addprefix $(DIR_OBJS)/, $(dir)))
SRCS = $(foreach dir, $(SRCS_DIRS), $(wildcard $(dir)/*.c))
OBJS = $(subst $(DIR_SRCS), $(DIR_OBJS), $(SRCS:.c=.o))
INCLUDES = -I includes
CC = clang
CFLAGS = -Wall -Wextra -Werror
RM = /bin/rm -f
$(DIR_OBJS)/%.o : $(DIR_SRCS)/%.c
@mkdir -p $(DIR_OBJS) $(OBJS_DIRS)
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
all: $(NAME)
$(NAME): $(OBJS)
@ar -rcs $(NAME) $(OBJS)
@ranlib $(NAME)
clean:
@$(RM) $(OBJS)
@$(RM) -r $(DIR_OBJS)
fclean: clean
@$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re