-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.am
292 lines (247 loc) · 7.3 KB
/
Makefile.am
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
282
283
284
285
286
287
288
289
290
291
292
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
include_HEADERS = include/raft.h
raftincludedir = $(includedir)/raft
raftinclude_HEADERS =
lib_LTLIBRARIES = libraft.la
libraft_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
libraft_la_LDFLAGS = -version-info 0:7:0
libraft_la_SOURCES = \
src/byte.c \
src/client.c \
src/compress.c \
src/configuration.c \
src/convert.c \
src/election.c \
src/entry.c \
src/err.c \
src/heap.c \
src/log.c \
src/membership.c \
src/progress.c \
src/raft.c \
src/recv.c \
src/recv_append_entries.c \
src/recv_append_entries_result.c \
src/recv_request_vote.c \
src/recv_request_vote_result.c \
src/recv_install_snapshot.c \
src/recv_timeout_now.c \
src/replication.c \
src/snapshot.c \
src/start.c \
src/state.c \
src/syscall.c \
src/tick.c \
src/tracing.c \
src/hook.c \
src/event.c \
src/request.c \
src/snapshot_sampler.c \
src/metric.c
bin_PROGRAMS =
check_PROGRAMS = \
test/unit/core
TESTS = $(check_PROGRAMS)
check_LTLIBRARIES = libtest.la
libtest_la_CFLAGS = $(AM_CFLAGS) -DMUNIT_TEST_NAME_LEN=60 -Wno-unused-result -Wno-conversion
libtest_la_SOURCES = \
test/lib/fault.c \
test/lib/fsm.c \
test/lib/heap.c \
test/lib/munit.c \
test/lib/munit_mock.c \
test/lib/tracer.c \
test/lib/tcp.c
test_unit_core_SOURCES = \
src/byte.c \
src/compress.c \
src/configuration.c \
src/err.c \
src/heap.c \
src/log.c \
src/event.c \
test/unit/main_core.c \
test/unit/test_byte.c \
test/unit/test_compress.c \
test/unit/test_configuration.c \
test/unit/test_err.c \
test/unit/test_log.c \
test/unit/test_queue.c \
test/unit/test_request.c \
test/unit/test_snapshotsampler.c \
test/unit/test_metric.c
test_unit_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion -std=gnu11
test_unit_core_LDADD = libtest.la ./.libs/libraft.a
if LZ4_AVAILABLE
test_unit_core_CFLAGS += -DLZ4_AVAILABLE
test_unit_core_LDFLAGS = $(LZ4_LIBS)
test_unit_core_LDFLAGS += -Wl,--wrap=LZ4F_createCompressionContext,--wrap=raft_malloc,--wrap=LZ4F_compressBegin
libraft_la_CFLAGS += -DLZ4_AVAILABLE
libraft_la_LDFLAGS += $(LZ4_LIBS)
endif # LZ4_AVAILABLE
if LZ4_ENABLED
test_unit_core_CFLAGS += -DLZ4_ENABLED
libraft_la_CFLAGS += -DLZ4_ENABLED
endif # LZ4_ENABLED
if FIXTURE_ENABLED
libraft_la_SOURCES += src/fixture.c
raftinclude_HEADERS += include/raft/fixture.h
check_PROGRAMS += \
test/integration/core \
test/fuzzy/core
libtest_la_SOURCES += \
test/lib/cluster.c
test_integration_core_SOURCES = \
test/integration/main_core.c \
test/integration/test_apply.c \
test/integration/test_assign.c \
test/integration/test_barrier.c \
test/integration/test_bootstrap.c \
test/integration/test_digest.c \
test/integration/test_election.c \
test/integration/test_fixture.c \
test/integration/test_heap.c \
test/integration/test_membership.c \
test/integration/test_recover.c \
test/integration/test_replication.c \
test/integration/test_snapshot.c \
test/integration/test_strerror.c \
test/integration/test_tick.c \
test/integration/test_transfer.c \
test/integration/test_start.c \
test/integration/test_paper.c \
test/integration/test_etcd_migrate_1.c \
test/integration/test_etcd_migrate_2.c \
test/integration/test_etcd_migrate_3.c \
test/integration/test_joint_consensus.c \
test/integration/mocks.c
test_integration_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion -std=gnu11
test_integration_core_LDFLAGS = -no-install
test_integration_core_LDADD = libtest.la ./.libs/libraft.a
test_integration_core_LDFLAGS += -Wl,--wrap=logAppendCommands,--wrap=requestRegEnqueue,--wrap=replicationTrigger
test_integration_core_LDFLAGS += -Wl,--wrap=logAppend,--wrap=configurationCopy,--wrap=logAcquire
test_fuzzy_core_SOURCES = \
test/fuzzy/main_core.c \
test/fuzzy/test_election.c \
test/fuzzy/test_liveness.c \
test/fuzzy/test_membership.c \
test/fuzzy/test_replication.c
test_fuzzy_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_fuzzy_core_LDFLAGS = -no-install
test_fuzzy_core_LDADD = libtest.la ./.libs/libraft.a
endif # FIXTURE_ENABLED
if UV_ENABLED
libraft_la_SOURCES += \
src/uv.c \
src/uv_append.c \
src/uv_encoding.c \
src/uv_finalize.c \
src/uv_fs.c \
src/uv_ip.c \
src/uv_list.c \
src/uv_metadata.c \
src/uv_os.c \
src/uv_prepare.c \
src/uv_recv.c \
src/uv_segment.c \
src/uv_send.c \
src/uv_snapshot.c \
src/uv_tcp.c \
src/uv_tcp_listen.c \
src/uv_tcp_connect.c \
src/uv_truncate.c \
src/uv_writer.c
libraft_la_LDFLAGS += $(UV_LIBS)
raftinclude_HEADERS += include/raft/uv.h
check_PROGRAMS += \
test/unit/uv \
test/integration/uv
libtest_la_SOURCES += \
test/lib/aio.c \
test/lib/dir.c \
test/lib/tcp.c \
test/lib/loop.c
test_unit_uv_SOURCES = \
src/err.c \
src/heap.c \
src/syscall.c \
src/tracing.c \
src/uv_fs.c \
src/uv_os.c \
src/uv_writer.c \
test/unit/main_uv.c \
test/unit/test_uv_fs.c \
test/unit/test_uv_writer.c
test_unit_uv_LDFLAGS = $(UV_LIBS)
test_unit_uv_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_unit_uv_LDADD = libtest.la
# The integration/uv test is not linked to libraft, but built
# directly against the libraft sources in order to test some
# non-visible, non-API functions.
test_integration_uv_SOURCES = \
${libraft_la_SOURCES} \
test/integration/main_uv.c \
test/integration/test_uv_init.c \
test/integration/test_uv_append.c \
test/integration/test_uv_bootstrap.c \
test/integration/test_uv_load.c \
test/integration/test_uv_recover.c \
test/integration/test_uv_recv.c \
test/integration/test_uv_send.c \
test/integration/test_uv_set_term.c \
test/integration/test_uv_tcp_connect.c \
test/integration/test_uv_tcp_listen.c \
test/integration/test_uv_snapshot_put.c \
test/integration/test_uv_truncate.c
test_integration_uv_CFLAGS = $(AM_CFLAGS) -Wno-type-limits -Wno-conversion
test_integration_uv_LDFLAGS = -no-install $(UV_LIBS)
test_integration_uv_LDADD = libtest.la
AM_CFLAGS += $(UV_CFLAGS)
if LZ4_AVAILABLE
test_integration_uv_CFLAGS += -DLZ4_AVAILABLE
test_integration_uv_LDFLAGS += $(LZ4_LIBS)
endif # LZ4_AVAILABLE
if LZ4_ENABLED
test_integration_uv_CFLAGS += -DLZ4_ENABLED
endif # LZ4_ENABLED
endif # UV_ENABLED
if EXAMPLE_ENABLED
bin_PROGRAMS += \
example/server \
example/cluster
example_server_SOURCES = example/server.c
example_server_LDFLAGS = -no-install $(UV_LIBS)
example_server_LDADD = libraft.la
example_cluster_SOURCES = example/cluster.c
endif # EXAMPLE_ENABLED
if BENCHMARK_ENABLED
bin_PROGRAMS += \
benchmark/os-disk-write
benchmark_os_disk_write_SOURCES = benchmark/os_disk_write.c
benchmark_os_disk_write_LDFLAGS = -luring
endif # BENCHMARK_ENABLED
if DEBUG_ENABLED
AM_CFLAGS += -Werror -O0 -fno-omit-frame-pointer -DENABLE_TRACE
else
AM_CFLAGS += -DNDEBUG -fno-omit-frame-pointer
endif
if SANITIZE_ENABLED
AM_CFLAGS += -fsanitize=address
endif
if LTO_ENABLED
AM_CFLAGS += -flto
endif
if CODE_COVERAGE_ENABLED
include $(top_srcdir)/aminclude_static.am
CODE_COVERAGE_DIRECTORY=./src
CODE_COVERAGE_OUTPUT_DIRECTORY=coverage
CODE_COVERAGE_OUTPUT_FILE=coverage.info
CODE_COVERAGE_IGNORE_PATTERN="/usr/include/*"
CODE_COVERAGE_BRANCH_COVERAGE=1
CODE_COVERAGE_LCOV_OPTIONS=$(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) --rc lcov_excl_br_line="assert\("
clean-local: code-coverage-clean
distclean-local: code-coverage-dist-clean
endif # CODE_COVERAGE_ENABLED
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @[email protected]