-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
91 lines (67 loc) · 2.46 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: aphan <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/02/24 17:12:26 by aphan #+# #+# #
# Updated: 2017/06/18 15:30:30 by rmatos ### ########.fr #
# #
# **************************************************************************** #
CLIENT = client
SERVER = server
NAME = $(SERVER) $(CLIENT)
LDIR = libft
IDIR = includes
ODIR := obj
SDIR = src
PS_IDIR = ~/.brew/Cellar/cmu-pocketsphinx/HEAD-05b866c/include/pocketsphinx
S_IDIR = ~/.brew/Cellar/cmu-sphinxbase/HEAD-27a98f9/include
vpath %.c $(SDIR) $(SDIR)/command
HEADERS = -I $(IDIR) -I $(LDIR)/includes -I $(PS_IDIR) -I $(S_IDIR) -I $(S_IDIR)/sphinxbase
CC = gcc
CFLAGS = $(HEADERS) -g -Wall -Wextra -Werror
SPHINXFLAGS = -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\" \
`pkg-config --cflags --libs pocketsphinx sphinxbase`
LIBFT = -L $(LDIR) -lft
DEPS = $(IDIR)/kift.h
_OBJ = command.o cmd3.o cmd2.o cmd1.o \
audiotostr.o \
client.o server.o utility.o history.o
OBJ := $(addprefix $(ODIR)/,$(_OBJ))
_C_OBJ = client.o command.o cmd3.o cmd2.o cmd1.o utility.o history.o
C_OBJ := $(addprefix $(ODIR)/,$(_C_OBJ))
_S_OBJ = server.o audiotostr.o utility.o
S_OBJ := $(addprefix $(ODIR)/,$(_S_OBJ))
all: $(NAME)
$(ODIR)/%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(OBJ): | $(ODIR)
$(ODIR):
mkdir -p $@
@echo 'make directory $@'
FORCE:
$(NAME): $(LIBFT)
$(LIBFT): FORCE
$(MAKE) -C $(LDIR)
$(MAKE) -C osx-cpu-temp
$(CLIENT): $(C_OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(SPHINXFLAGS)
@echo 'compile $@'
$(SERVER): $(S_OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(SPHINXFLAGS)
@echo 'compile $@'
clean:
/bin/rm -rfv $(ODIR)
@echo '$@ $(NAME) $(ODIR)'
$(MAKE) -C $(LDIR) $@
$(MAKE) -C osx-cpu-temp $@
fclean: clean wav
/bin/rm -f $(NAME)
@echo '$< $(NAME)'
$(MAKE) -C $(LDIR) $@
re: fclean all
wav:
/bin/rm -rfv server_history
.PHONY: all clean fclean re wav