-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
executable file
·59 lines (44 loc) · 1.78 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
CC = gcc
RM = rm -f
SERVER = server
CFLAGS = -Wall -Wextra -Werror -g
INCLUDES = -I includes/ -I analyze_data/
LIBRARIES = -L$(HOME)/.brew/Cellar/cmu-pocketsphinx/HEAD-80d8e28/lib\
-L$(HOME)/.brew/Cellar/cmu-sphinxbase/HEAD-562d047/lib\
-lpocketsphinx -lsphinxbase -lsphinxad -lpthread -lm -lblas -llapack
EXEC_PKG = `pkg-config --cflags pocketsphinx sphinxbase`
FLAGS_SPHINX = -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\"\
`pkg-config --libs pocketsphinx sphinxbase`
BASE = server.c socket.c receive.c signal.c
REQUEST = request.c method.c post_content.c post_form.c post_multipart.c
FIELD = field_accept.c field_content_length.c field_content_type.c\
field_expect.c field_host.c
FIELDS = fields.c $(FIELD)
RESPONSE = response.c protocol.c content_type.c ft_free.c\
response_error.c response_success.c
QUEUE = queue_init.c node_init.c dequeue.c enqueue.c\
is_empty.c peek.c
LIBFT = strdel.c concat.c get_file_content.c $(addprefix queue/, $(QUEUE))
API = demo.c sendaudio.c
SPHINX = sphinx.c dispatch.c
REQUEST_FCT = $(addprefix request/, $(REQUEST) $(FIELDS))
RESPONSE_FCT = $(addprefix response/, $(RESPONSE))
LIBFT_FCT = $(addprefix libft/, $(LIBFT))
SPHINX_FCT = $(addprefix analyze_data/, $(SPHINX))
API_FCT = $(addprefix api/, $(API))
FUNCTIONS = $(addprefix srcs/, $(BASE) $(REQUEST_FCT) $(RESPONSE_FCT)\
$(LIBFT_FCT)) $(SPHINX_FCT) $(API_FCT)
OBJECTS = $(FUNCTIONS:.c=.o)
.PHONY: all clean fclean re
all: $(SERVER)
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(SERVER): $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDES) $^ -o $(SERVER) $(LIBRARIES)
analyze_data/sphinx.o:
$(CC) -c $(EXEC_PKG) $(FLAGS_SPHINX) analyze_data/sphinx.c -o $@
clean:
@$(RM) $(OBJECTS)
fclean: clean
@$(RM) $(SERVER)
re: fclean all