-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (46 loc) · 1.72 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lpalacio <lpalacio@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/06/04 20:41:29 by lpalacio #+# #+# #
# Updated: 2024/06/04 21:25:26 by lpalacio ### ########.fr #
# #
# **************************************************************************** #
SRCS = so_long.c check_args.c
OBJDIR = bin
OBJS = ${SRCS:%.c=${OBJDIR}/%.o}
NAME = so_long
LIBDIR = lib
GNLLIB_DIR = ${LIBDIR}/gnl
LIBGNL = ${GNLLIB_DIR}/libgnl.a
LIBFT_DIR = ${LIBDIR}/ft
LIBFT = ${LIBFT_DIR}/libft.a
RM = rm -rf
CC = gcc
CFLAGS = -Wall -Werror -Wextra
CLIBGNL = -L ${GNLLIB_DIR} -lgnl
CLIBFT = -L ${LIBFT_DIR} -lft
all: $(NAME)
bin/%.o : %.c
@mkdir -p ${OBJDIR}
@${CC} ${CFLAGS} -c $< -o $@
$(NAME): $(OBJS) | $(LIBGNL) $(LIBFT)
@$(CC) -o $(NAME) $(OBJS) $(CLIBGNL) $(CLIBFT) $(CFLAGS)
@echo "so_long has been compiled"
$(LIBGNL):
@$(MAKE) -C $(GNLLIB_DIR)
$(LIBFT):
@$(MAKE) -C $(LIBFT_DIR)
clean:
@$(RM) ${OBJS} ${OBJDIR}
@$(MAKE) -C ${GNLLIB_DIR} clean
@$(MAKE) -C ${LIBFT_DIR} clean
fclean: clean
@${RM} ${NAME}
@$(MAKE) -C ${GNLLIB_DIR} fclean
@$(MAKE) -C ${LIBFT_DIR} fclean
re: fclean all
.PHONY: all clean fclean re