-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (34 loc) · 1022 Bytes
/
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
NAME = minitalk
SERVER = server
CLIENT = client
SRC = server.c \
client.c \
wrapper.c
LIBFT = ./libft/libft.a
SRCS_PATH = src
OBJS_PATH = obj
SRCS = $(addprefix $(SRCS_PATH)/, $(SRC))
OBJS = $(addprefix $(OBJS_PATH)/, $(SRC:.c=.o))
CC = cc -Wall -Wextra -Werror
RM = rm -rf
all: $(NAME)
$(NAME): $(OBJS_PATH) $(LIBFT) $(OBJS) $(SERVER) $(CLIENT)
$(SERVER): $(OBJS_PATH) $(LIBFT) $(OBJS)
$(CC) $(addprefix $(OBJS_PATH)/, server.o) \
$(addprefix $(OBJS_PATH)/, wrapper.o) $(LIBFT) -o $(SERVER)
$(CLIENT): $(OBJS_PATH) $(LIBFT) $(OBJS)
$(CC) $(addprefix $(OBJS_PATH)/, client.o) \
$(addprefix $(OBJS_PATH)/, wrapper.o) $(LIBFT) -o $(CLIENT)
$(OBJS_PATH):
mkdir -p $(OBJS_PATH)
$(OBJS_PATH)/%.o: $(SRCS_PATH)/%.c
$(CC) -c $< -o $@
$(LIBFT):
make -C ./libft
clean:
$(RM) $(OBJS_PATH)
fclean: clean
make fclean -C ./libft
$(RM) $(SERVER) $(CLIENT)
re: fclean all
.PHONY: all clean fclean re