-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (39 loc) · 1.22 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
SERVER = server
CLIENT = client
SERVER_BONUS = $(SERVER)
CLIENT_BONUS = $(CLIENT)
UTILS = utils/atoi.c utils/itoa.c utils/utils.c
UTILS_BONUS = bonus/utils/atoi_bonus.c bonus/utils/itoa_bonus.c bonus/utils/utils_bonus.c
HEADER = minitalk.h
HEADER_BONUS = bonus/minitalk_bonus.h
FLAGS = -Wall -Wextra -Werror
SRCS_S = server.c $(UTILS)
SRCS_C = client.c $(UTILS)
SRCS_S_BONUS = bonus/server_bonus.c $(UTILS)
SRCS_C_BONUS = bonus/client_bonus.c $(UTILS)
OBJ_S = $(@SRCS_S:.c=.o)
OBJ_C = $(@SRCS_B:.c=.o)
OBJ_S_BONUS = $(@SRCS_S_BONUS:.c=.o)
OBJ_C_BONUS = $(@SRCS_C_BONUS:.c=.o)
CC = gcc
all : $(CLIENT) $(SERVER)
$(CLIENT): $(OBJ_C)
@echo "[client compilation...]"
@$(CC) $(SRCS_C) -I $(HEADER) $(FLAGS) -o $(CLIENT)
@echo "[Done!]"
$(SERVER): $(OBJ_S)
@echo "[server compilation...]"
@$(CC) $(SRCS_S) -I $(HEADER) $(FLAGS) -o $(SERVER)
@echo "[Done!]"
bonus: fclean
@echo "[client (bonus) compilation...]"
@$(CC) $(SRCS_C_BONUS) -I $(HEADER) $(FLAGS) -o $(CLIENT)
@echo "[Done!]"
@echo "[server (bonus) compilation...]"
@$(CC) $(SRCS_S_BONUS) -I $(HEADER) $(FLAGS) -o $(SERVER)
@echo "[Done!]"
clean:
@rm -rf $(OBJ_S) $(OBJ_C) $(OBJ_S_BONUS) $(OBJ_C_BONUS)
fclean: clean
@rm -rf $(SERVER) $(CLIENT)
re : fclean all