-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
281 lines (242 loc) · 8.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
CXXFLAGS += -I./
CXXFLAGS += -I./protos
CXXFLAGS += -I./third_party/boringssl/include
CXXFLAGS += -std=c++11 -Wall -g -c -o
LIB_FILES :=-lglog -lgflags -L/usr/local/lib -lgtest -lgtest_main -lpthread -lz -lminizip \
./third_party/boringssl/build/crypto/libcrypto.a \
./third_party/boringssl/build/ssl/libssl.a \
./third_party/boringssl/build/decrepit/libdecrepit.a \
-L./third_party/libsm2/ -lmpr_sm2 \
\
-L/usr/local/lib -lgrpc++ -lgrpc -lgrpc++_reflection \
-lprotobuf -lpthread -ldl
# -lnspr4 \
-ldl \
-lmysqlclient
PROTOC = protoc
GRPC_CPP_PLUGIN=grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
PROTOS_PATH = ./protos
CPP_SOURCES := \
./base/ascii_ctype.cc \
./base/numbers.cc \
./base/string_piece.cc \
./base/string_util.cc \
./base/string_printf.cc \
./base/string_encode.cc \
./base/status.cc \
./base/pickle.cc \
./base/time.cc \
./base/file_path.cc \
./base/file.cc \
./base/file_util.cc \
./base/file_enumerator.cc \
./base/scoped_file.cc \
./base/ref_counted.cc \
./base/test/opaque_ref_counted.cc \
./base/once.cc \
./base/location.cc \
\
./zip/zip_internal.cc \
./zip/zip_reader.cc \
./zip/zip.cc \
\
\
./crypto/openssl_util.cc \
./crypto/symmetric_key.cc \
./crypto/symmetric_encryptor.cc \
./crypto/symmetric_crypt.cc \
./crypto/symmetric_util.cc \
./crypto/sm2_util.cc \
./crypto/sm2_access_point.cc \
./crypto/asymmetric_padding.cc \
./crypto/asymmetric_key.cc \
\
./crypto/memory_input_stream.cc \
./crypto/memory_output_stream.cc \
./crypto/file_input_stream.cc \
./crypto/file_output_stream.cc \
./crypto/sm2_asymmetric_encryptor.cc \
\
./protos/crypto_server.pb.cc \
./protos/crypto_server.grpc.pb.cc \
\
./service/symmetric_service.cc \
./service/asymmetric_service.cc \
\
./threading/time_util.cc \
./threading/mutex.cc \
./threading/monitor.cc \
./threading/thread_factory.cc \
./threading/thread_manager.cc \
\
CPP_OBJECTS := $(CPP_SOURCES:.cc=.o)
TESTS := \
./base/file_path_unittest \
./base/once_unittest \
./base/ref_counted_unittest \
./base/pickle_unittest \
./base/time_unittest \
./base/numbers_unittest \
./zip/zip_reader_unittest \
./zip/zip_unittest \
\
./crypto/symmetric_key_unittest \
./crypto/symmetric_encryptor_unittest \
./crypto/sm2_unittest \
./crypto/sm2_util_unittest \
./crypto/asymmetric_padding_unittest \
./crypto/sm2_access_point_unittest \
\
./crypto/memory_input_stream_unittest \
./crypto/memory_output_stream_unittest \
./crypto/file_input_stream_unittest \
\
./crypto/sm2_asymmetric_encryptor_unittest \
./crypto/symmetric_util_unittest \
\
./service/crypto_server \
\
./threading/thread_factory_unittest \
./threading/thread_manager_unittest \
./threading/mutex_unittest \
\
\
all: $(CPP_OBJECTS) $(TESTS)
.cc.o:
@echo " [CXX] $@"
@$(CXX) $(CXXFLAGS) $@ $<
vpath %.proto $(PROTOS_PATH)
.PRECIOUS: %.grpc.pb.cc
%.grpc.pb.cc: %.proto
@echo " [GEN] $@"
@$(PROTOC) -I $(PROTOS_PATH) --grpc_out=$(PROTOS_PATH) --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
.PRECIOUS: %.pb.cc
%.pb.cc: %.proto
@echo " [GEN] $@"
@$(PROTOC) -I $(PROTOS_PATH) --cpp_out=$(PROTOS_PATH) $<
#############
./base/file_path_unittest: ./base/file_path_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/file_path_unittest.o: ./base/file_path_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./base/time_unittest: ./base/time_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/time_unittest.o: ./base/time_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./base/once_unittest: ./base/once_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/once_unittest.o: ./base/once_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./base/pickle_unittest: ./base/pickle_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/pickle_unittest.o: ./base/pickle_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./base/numbers_unittest: ./base/numbers_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/numbers_unittest.o: ./base/numbers_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./zip/zip_reader_unittest: ./zip/zip_reader_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./zip/zip_reader_unittest.o: ./zip/zip_reader_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./zip/zip_unittest: ./zip/zip_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./zip/zip_unittest.o: ./zip/zip_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/sm2_unittest: ./crypto/sm2_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/sm2_unittest.o: ./crypto/sm2_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/sm2_access_point_unittest: ./crypto/sm2_access_point_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/sm2_access_point_unittest.o: ./crypto/sm2_access_point_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/sm2_util_unittest: ./crypto/sm2_util_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/sm2_util_unittest.o: ./crypto/sm2_util_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/asymmetric_padding_unittest: ./crypto/asymmetric_padding_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/asymmetric_padding_unittest.o: ./crypto/asymmetric_padding_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/symmetric_key_unittest: ./crypto/symmetric_key_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/symmetric_key_unittest.o: ./crypto/symmetric_key_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/symmetric_encryptor_unittest: ./crypto/symmetric_encryptor_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/symmetric_encryptor_unittest.o: ./crypto/symmetric_encryptor_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/memory_input_stream_unittest: ./crypto/memory_input_stream_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/memory_input_stream_unittest.o: ./crypto/memory_input_stream_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/memory_output_stream_unittest: ./crypto/memory_output_stream_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/memory_output_stream_unittest.o: ./crypto/memory_output_stream_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/file_input_stream_unittest: ./crypto/file_input_stream_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/file_input_stream_unittest.o: ./crypto/file_input_stream_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/symmetric_util_unittest: ./crypto/symmetric_util_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/symmetric_util_unittest.o: ./crypto/symmetric_util_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./crypto/sm2_asymmetric_encryptor_unittest: ./crypto/sm2_asymmetric_encryptor_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./crypto/sm2_asymmetric_encryptor_unittest.o: ./crypto/sm2_asymmetric_encryptor_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./service/crypto_server: ./service/crypto_server.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./service/crypto_server.o: ./service/crypto_server.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./threading/thread_factory_unittest: ./threading/thread_factory_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./threading/thread_factory_unittest.o: ./threading/thread_factory_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./threading/thread_manager_unittest: ./threading/thread_manager_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./threading/thread_manager_unittest.o: ./threading/thread_manager_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./threading/mutex_unittest: ./threading/mutex_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./threading/mutex_unittest.o: ./threading/mutex_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
./base/ref_counted_unittest: ./base/ref_counted_unittest.o
@echo " [LINK] $@"
@$(CXX) -o $@ $< $(CPP_OBJECTS) $(LIB_FILES)
./base/ref_counted_unittest.o: ./base/ref_counted_unittest.cc
@$(CXX) -Wno-unused-variable $(CXXFLAGS) $@ $<
db_clean:
`find ./db -name "*.o" | xarg rm -fr`
clean:
rm -fr base/*.o
rm -fr threading/*.o
rm -fr zip/*.o
rm -fr crypto/*.o
@rm -fr $(TESTS)
@rm -fr $(CPP_OBJECTS)