-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (31 loc) · 1 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
NAME = chat
FOLDER_SRC = src/
FOLDER_STRUCTS = src/structs/
FOLDER_ALL = $(FOLDER_SRC) $(FOLDER_STRUCTS)
FILES_SRC = utils.c interface.c base64.c websocket.c onsend.c \
tlv_queue.c tlv.c network.c checkers.c send.c \
hello.c clean.c neighbour.c flooding.c handlers.c \
threads.c signals.c main.c
FILES_STRUCTS = array.c list.c hashmap.c hashset.c
FILES_SRC_FP = $(addprefix $(FOLDER_SRC), $(FILES_SRC))
FILES_STRUCTS_FP = $(addprefix $(FOLDER_STRUCTS), $(FILES_STRUCTS))
FILES_FP = $(FILES_STRUCTS_FP) $(FILES_SRC_FP)
OBJ = $(FILES_FP:%.c=%.o)
CC = gcc
FLAGS = -g -Wall -Wextra -Wno-unused-parameter $(foreach d, $(FOLDER_ALL), -I $(d)) -rdynamic
LIBS = -lssl -lcrypto -pthread -lreadline
all: $(NAME)
%.o: %.c
@echo "Compiling $?"
@$(CC) $(FLAGS) -c $? -o $@ $(LIBS)
$(NAME): $(OBJ)
@echo "Build executable $(NAME)"
@$(CC) $(FLAGS) $(OBJ) -o $(NAME) $(LIBS)
@echo "Done."
clean:
@echo "Clean objects"
@rm -rf $(OBJ)
fclean: clean
@echo "Clean executable $(NAME)"
@rm -rf $(NAME)
re: fclean all