-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (62 loc) · 2.83 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
70
71
72
73
74
75
76
77
78
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ffoissey <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/11/05 18:25:23 by ffoissey #+# #+# #
# Updated: 2019/04/02 14:29:08 by ffoissey ### ########.fr #
# #
# **************************************************************************** #
CHECKER = checker
PUSH_SWAP = push_swap
FILE_CHECKER = checker exec
FILE_PUSH_SWAP = push_swap make_simple algo algo500 order tool_push_swap post_process algo_tool
FILE_COM = print_stack process tool tool2
LIB = libft/libft.a
SRCS_CHECKER = $(patsubst %,srcs_checker/ft_%.c,$(FILE_CHECKER))
OBJS_CHECKER = $(patsubst %,objs_checker/ft_%.o,$(FILE_CHECKER))
SRCS_PUSH_SWAP = $(patsubst %,srcs_push_swap/ft_%.c,$(FILE_PUSH_SWAP))
OBJS_PUSH_SWAP = $(patsubst %,objs_push_swap/ft_%.o,$(FILE_PUSH_SWAP))
SRCS_COM = $(patsubst %,srcs_com/ft_%.c,$(FILE_COM))
OBJS_COM = $(patsubst %,objs_checker/ft_%.o,$(FILE_COM))
DIR_OBJS_CHECKER = objs_checker/
DIR_OBJS_PUSH_SWAP = objs_push_swap/
INCLUDES += -I includes/
INCLUDES += -I libft/includes
INCLUDES += -I libft/includes/get_next_line
INCLUDES += -I libft/includes/ft_printf
HEAD += includes/checker.h
HEAD += includes/push_swap.h
HEAD += includes/common.h
CFLAGS = -Wall -Werror -Wextra
CC = clang
all: $(CHECKER) $(PUSH_SWAP)
$(CHECKER): $(DIR_OBJS_CHECKER) $(OBJS_CHECKER) $(OBJS_COM) $(LIB)
$(CC) $(CFLAGS) $(OBJS_CHECKER) $(OBJS_COM) $(LIB) $(INCLUDES) -o $@
$(OBJS_COM): objs_checker/%.o: srcs_checker/%.c $(HEAD)
$(CC) $(CFLAGS) -c $< $(INCLUDES) -o $@
$(DIR_OBJS_CHECKER):
mkdir objs_checker
$(OBJS_CHECKER): objs_checker/%.o: srcs_checker/%.c $(HEAD)
$(CC) $(CFLAGS) -c $< $(INCLUDES) -o $@
$(PUSH_SWAP): $(DIR_OBJS_PUSH_SWAP) $(OBJS_PUSH_SWAP) $(OBJS_COM) $(LIB)
$(CC) $(CFLAGS) $(OBJS_PUSH_SWAP) $(OBJS_COM) $(LIB) $(INCLUDES) -o $@
$(DIR_OBJS_PUSH_SWAP):
mkdir objs_push_swap
$(OBJS_PUSH_SWAP): objs_push_swap/%.o: srcs_push_swap/%.c $(HEAD)
$(CC) $(CFLAGS) -c $< $(INCLUDES) -o $@
$(LIB): FORCE
make -C libft/
clean:
make clean -C libft/
rm -Rf $(DIR_OBJS_CHECKER) $(DIR_OBJS_PUSH_SWAP) $(OBJS_CHECKER) $(OBJS_PUSH_SWAP) $(DIR_OBJS_COM) $(OBJS_COM)
fclean: clean
make fclean -C libft/
rm -f $(CHECKER) $(PUSH_SWAP)
re: fclean all
up:
git add -A && git commit -m"up" && git push
FORCE:
.PHONY: clean fclean re all FORCE