-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (48 loc) · 2.15 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: liabanzh <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/03/20 16:55:36 by liabanzh #+# #+# #
# Updated: 2017/03/20 16:55:38 by liabanzh ### ########.fr #
# #
# **************************************************************************** #
NAME1 = push_swap
NAME2 = checker
MAIN1 = src/push_swap.c
MAIN2 = src/checker.c
SRC = src/commands.c src/include.c src/middle.c src/sort.c src/dop.c \
src/optimize.c src/optimize2.c src/sort_tools.c src/rrr.c \
src/sort_dop.c src/optimize2_dop.c
CC = gcc
LIB = libft/libft.a
FLAGS = -Wall -Wextra -Werror
.PHONY: all re clean fclean
all: $(NAME1) $(NAME2)
$(NAME2): $(LIB) $(SRC:.c=.o) $(MAIN2:.c=.o)
@echo ">\033[32mCompiling Checker program\033[0m"
@ $(CC) -o $(NAME2) $(LIB) $(SRC:.c=.o) $(MAIN2:.c=.o) $(FLAGS) -g
@echo ">\033[32mCompiling of Checker finished successfuly!\033[0m\n"
$(NAME1): $(LIB) $(SRC:.c=.o) $(MAIN1:.c=.o)
@echo ">\033[32mCompiling executable file\033[0m"
@ $(CC) -o $(NAME1) $(LIB) $(SRC:.c=.o) $(MAIN1:.c=.o) $(FLAGS) -g
@echo ">\033[32mCompiling finished successfuly!\033[0m\n"
$(LIB):
@echo ">\033[32mStarting compile LIBFT library...\033[0m"
@make -C ./libft
@echo ">\033[32mStarting compile project files...\033[0m"
$(MAIN1:.c=.o): $(MAIN1)
@ $(CC) -o $@ -c $< $(FLAGS)
$(MAIN2:.c=.o): $(MAIN2)
@ $(CC) -o $@ -c $< $(FLAGS)
%.o: %.c
@ $(CC) -o $@ -c $< $(FLAGS)
clean:
@make clean -C ./libft
@rm -f $(SRC:.c=.o) $(MAIN1:.c=.o) $(MAIN2:.c=.o)
fclean: clean
@rm -f $(LIB) $(NAME1) $(NAME2)
@echo ">\033[32mCleaning successfull!\033[0m\n"
re: fclean all