-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (64 loc) · 2.21 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#******************************************************************************#
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rbaum <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/06/23 15:32:39 by rbaum #+# #+# #
# Updated: 2016/07/12 00:29:37 by rbaum ### ########.fr #
# #
#******************************************************************************#
.PHONY: all, libft, clean, fclean, re
CC = gcc
CFLAG = -Wall -Wextra -Werror -g
NAME = corewar
SRC_PATH = ./src/
OBJ_PATH = ./obj/
LIBFT_PATH = ./libft/
INC_PATH = ./inc/
SRC_NAME = main.c\
check_arg.c\
singleton.c\
ft_format.c\
put_champ_in_memory.c\
write_memory.c\
start_war.c\
manage_players.c\
manage_arg.c\
add_proc.c\
go_visual.c\
get_value.c\
print_visual.c\
op.c\
live.c ld.c st.c add.c\
sub.c and.c or.c xor.c\
zjmp.c ldi.c sti.c fork.c\
lld.c lldi.c lfork.c aff.c\
OBJ_NAME = $(SRC_NAME:.c=.o)
LIBFT_NAME = libft.a
INC_NAME = vm.h
SRC = $(addprefix $(SRC_PATH),$(SRC_NAME))
OBJ = $(addprefix $(OBJ_PATH),$(OBJ_NAME))
LIBFT = $(addprefix $(LIBFT_PATH),$(LIBFT_NAME))
INC = $(addprefix $(INC_PATH),$(INC_NAME))
INCLIBFT = $(LIBFT_PATH)inc
LIBFT_FLAG = -L$(LIBFT_PATH) -lft
all: libft $(NAME)
$(NAME): $(OBJ)
@$(CC) $(LIBFT_FLAG) -o $@ $^ -fsanitize=address -lncurses
@echo "Done"
$(OBJ_PATH)%.o: $(SRC_PATH)%.c $(INC)
@mkdir -p $(OBJ_PATH)
@$(CC) $(CFLAG) -I$(INC_PATH) -I$(INCLIBFT) -o $@ -c $<
libft: $(LIBFT)
$(LIBFT): $(LIBFT_PATH)
@make -C $(LIBFT_PATH)
clean:
@make -C $(LIBFT_PATH) clean
@rm -f $(OBJ)
fclean:
@rm -f $(OBJ)
@make -C $(LIBFT_PATH) fclean
@rm -f $(NAME)
re: fclean all