-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (52 loc) · 2.19 KB
/
Makefile
File metadata and controls
70 lines (52 loc) · 2.19 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gguiulfo <gguiulfo@student.42.us.org> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/05/16 07:02:04 by gguiulfo #+# #+# #
# Updated: 2017/06/18 22:21:27 by gguiulfo ### ########.fr #
# #
# **************************************************************************** #
NAME := kift
CC := gcc
CFLAGS += -Wall -Wextra -Werror
CFLAGS += -I includes -I libft/includes
CFLAGS += `pkg-config --cflags pocketsphinx sphinxbase` -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\"
LDFLAGS += `pkg-config --libs pocketsphinx sphinxbase`
LDFLAGS += -L libft/ -lft
OBJDIR := obj
SRCDIR := src
LIBFT := libft/libft.a
KIFTFILES := kift_continous kift_commands kift_server kift_log kift_utils \
kift_more_cmds kift_extra_cmds
SRC := $(addprefix $(SRCDIR)/, $(addsuffix .c, $(KIFTFILES)))
OBJ := $(patsubst $(SRCDIR)/%, $(OBJDIR)/%, $(SRC:.c=.o)) \
MAX := $(words $(OBJ))
n := x
increment = $1 x
COUNTER = $(words $n)$(eval n := $(call increment,$n))
.PHONY = all clean fclean re obj
all: obj $(NAME)
obj:
@mkdir -p $(OBJDIR)
$(LIBFT):
@make -C libft
$(NAME): $(LIBFT) $(OBJ)
@printf "\r\e[32mCompiling...(%d/%d)[DONE]\n\e[0m" $(MAX) $(MAX)
@$(CC) $(LDFLAGS) -o $@ $^
@printf "\e[32mCompiled Executable\e[0m\n"
$(OBJDIR)/%.o: $(SRCDIR)/%.c
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) $(LDFLAG) -o $@ -c $<
@printf "\r\e[32mCompiling...(%d/%d)\e[0m" $(COUNTER) $(MAX)
clean:
@rm -rf $(OBJDIR)
@printf "\e[32mRemoved Object Files\e[0m\n"
@make -C libft clean
fclean: clean
@rm -rf $(NAME) out.wav
@printf "\e[32mRemoved Executable\e[0m\n"
@make -C libft fclean
re: fclean all