-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
148 lines (120 loc) · 4.07 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
NAME = uchat
NAME_SERVER = uchat_server
INC = ./inc/*.h
SRC := $(wildcard src/*.c) \
$(wildcard src/daemon_voice/*.c) \
$(wildcard src/db/*.c) \
$(wildcard src/help/*.c) \
$(wildcard src/json_functions/*.c) \
$(wildcard src/server/*.c) \
$(wildcard src/client/*.c) \
$(wildcard src/ssl/*.c)
OBJ = $(addprefix obj/, $(notdir $(SRC:%.c=%.o)))
LIBMX = libmx/libmx.a
PA = ./source/libportaudio/libportaudio.a
SF = ./source/libsndfile/libsndfile.a
OG = ./source/libogg/libogg.a
FC = ./source/libflac/libFLAC.a
OP = ./source/libopus/libopus.a
VB = ./source/libvorbis/lib/libvorbis.a \
./source/libvorbis/lib/libvorbisenc.a \
./source/libvorbis/lib/libvorbisfile.a
OP_PATH = -I./source/libopus/include
VB_PATH = -I./source/libvorbis/include
OG_PATH = -I./source/libogg/include
FC_PATH = -I./source/libflac/include
SSL_PATH = -I/usr/local/opt/openssl/include
PA_PATH = -I./source/libportaudio/include
SF_PATH = -I./source/libsndfile/include
ADD_FLAG = -framework CoreAudio \
-framework AudioToolbox \
-framework AudioUnit \
-framework Carbon
FLAGS = $(SSL_PATH) $(SANFLAG) \
$(PA_PATH) $(SF_PATH) $(OG_PATH) $(FC_PATH) $(VB_PATH) $(OP_PATH) \
-std=c11 -Wall -Wextra -Werror -Wpedantic
SANFLAG = -g -fsanitize=address
SQLITE = -lsqlite3
PTHREAD = -lpthread
SSL = -L/usr/local/opt/openssl/lib/ -lssl -lcrypto
INCD = inc
all: $(NAME)
install: $(NAME)
$(NAME): $(LIBMX) $(OBJ)
@chmod 777 ./source/create_database.sh
@./source/create_database.sh
@make clean
@clang $(FLAGS) `pkg-config --cflags --libs gtk+-3.0` \
$(OBJ) $(LIBMX) $(PA) $(SF) $(OG) $(FC) $(VB) $(OP) \
-o $(NAME) $(SQLITE) $(SSL) $(PTHREAD) $(ADD_FLAG)
@clang $(FLAGS) `pkg-config --cflags --libs gtk+-3.0` \
$(OBJ) $(LIBMX) $(PA) $(SF) $(OG) $(FC) $(VB) $(OP) \
-o $(NAME_SERVER) $(SQLITE) $(SSL) $(PTHREAD) $(ADD_FLAG)
@printf "\x1b[32;1m$(NAME) created\x1b[0m\n"
$(LIBMX):
@make -C libmx
$(OBJ): | obj
client: $(LIBMX) $(OBJ)
@clang $(FLAGS) `pkg-config --cflags --libs gtk+-3.0` \
$(OBJ) $(LIBMX) $(PA) $(SF) $(OG) $(FC) $(VB) $(OP) \
-o $(NAME) $(SQLITE) $(SSL) $(PTHREAD) $(ADD_FLAG)
server: $(LIBMX) $(OBJ)
@clang $(FLAGS) `pkg-config --cflags --libs gtk+-3.0` \
$(OBJ) $(LIBMX) $(PA) $(SF) $(OG) $(FC) $(VB) $(OP) \
-o $(NAME_SERVER) $(SQLITE) $(SSL) $(PTHREAD) $(ADD_FLAG)
obj:
@mkdir obj
obj/%.o: src/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/daemon_voice/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/db/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/help/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/json_functions/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/server/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/client/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
obj/%.o: src/ssl/%.c $(INC)
@clang $(FLAGS) `pkg-config --cflags gtk+-3.0` -o $@ -c $<
@printf "\x1b[32mcompiled: \x1b[0m[$<]\n"
clean:
@rm -rf *.o ush.dSYM
@make clean -C libmx
uninstall: clean
@make uninstall -C libmx
@make clean
@rm -rf ./obj
@rm -rf $(NAME)
@rm -rf $(NAME_SERVER)
@chmod 777 ./source/del_cash.sh
@./source/del_cash.sh
@rm -rf database.db
@rm -rf database
reinstall: uninstall install
keys:
@chmod 777 ./source/compiler_script.sh
@./source/compiler_script.sh
db:
@chmod 777 ./source/create_database.sh
@./source/create_database.sh
del_cash:
@chmod 777 ./source/del_cash.sh
@./source/del_cash.sh
del_keys:
@rm -rf ./source/keys
del_db:
@rm -rf database.db
@rm -rf database
d:
@clang $(FLAGS) $(SANFLAG) $(SQLITE) $(SSL) $(PTHREAD) src/*.c libmx/libmx.a