-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (42 loc) · 2.05 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yihssan <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/06/22 09:02:15 by yihssan #+# #+# #
# Updated: 2021/06/22 13:32:24 by yihssan ### ########.fr #
# #
# **************************************************************************** #
NAME = push_swap
BNAME = checker
CC = gcc
FLAGS = -Wall -Werror -Wextra
IDIR = -I. -I./libft -I../libft -I.. -I.
LIB = -L./libft -lft
MSRC = pushmain.c
BSRC = checker_bonus.c
SUBSRCS = pushswap.c operations.c operations2.c pushswap2.c sorts.c radixsort.c
BONUSSUB = operations.c operations2.c get_next_line.c get_next_line_utils.c checker_tools.c checker_tools2.c
SUBOBJS = $(SUBSRCS:%.c=%.o)
SUBBOBJS = $(BONUSSUB:%.c=%.o)
all: $(NAME)
$(NAME): $(addprefix ./srcs/,$(SUBOBJS)) | ./libft/libft.a
$(CC) $(FLAGS) $(IDIR) $(MSRC) -o $(NAME) $(addprefix ./srcs/,$(SUBOBJS)) $(LIB)
$(addprefix ./srcs/,$(SUBOBJS)):
cd srcs && $(CC) $(FLAGS) $(IDIR) -c $(SUBSRCS)
bonus: $(addprefix ./srcs_bonus/,$(SUBBOBJS)) | ./libft/libft.a
$(CC) $(FLAGS) $(IDIR) $(BSRC) -o $(BNAME) $(addprefix ./srcs_bonus/,$(SUBBOBJS)) $(LIB)
$(addprefix ./srcs_bonus/,$(SUBBOBJS)):
cd srcs_bonus && $(CC) $(FLAGS) $(IDIR) -c $(BONUSSUB)
./libft/libft.a: ./libft/libft.h
cd libft && $(MAKE) bonus && $(MAKE)
clean:
/bin/rm -f *.o
/bin/rm -f ./srcs/*.o ./srcs_bonus/*.o
cd libft && $(MAKE) clean
fclean: clean
/bin/rm -f $(NAME) $(BNAME)
cd libft && $(MAKE) fclean
re: fclean all $(BONUS) ./libft/libft.a