-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.am
299 lines (261 loc) · 9.49 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
293
294
295
296
297
298
299
# Makefile.am - automake file for lcdb
# Copyright (c) 2022, Christopher Jeffrey (MIT License).
# https://github.com/chjj/lcdb
#
# Initialization
#
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I$(top_srcdir)/include
licensedir = $(datadir)/licenses/$(PACKAGE_NAME)
pkgconfigdir = $(libdir)/pkgconfig
dist_doc_DATA = README.md
dist_license_DATA = LICENSE
pkgconfig_DATA = lcdb.pc
EXTRA_DIST = cmake/ \
etc/ \
scripts/ \
autogen.sh \
CHANGELOG.md \
CMakeLists.txt \
Makefile.msvc \
lcdb-cmake.pc.in
#
# Dependencies
#
SUBDIRS = . test
#
# Headers
#
include_HEADERS = include/lcdb.h include/lcdb_c.h
noinst_HEADERS = compat/stdint.h
#
# Sources
#
lcdb_sources = src/util/arena.c \
src/util/arena.h \
src/util/array.c \
src/util/array.h \
src/util/atomic.c \
src/util/atomic.h \
src/util/bloom.c \
src/util/bloom.h \
src/util/buffer.c \
src/util/buffer.h \
src/util/cache.c \
src/util/cache.h \
src/util/coding.h \
src/util/comparator.c \
src/util/comparator.h \
src/util/crc32c.c \
src/util/crc32c.h \
src/util/env.c \
src/util/env.h \
src/util/env_mem_impl.h \
src/util/env_unix_impl.h \
src/util/env_win_impl.h \
src/util/extern.h \
src/util/hash.c \
src/util/hash.h \
src/util/internal.c \
src/util/internal.h \
src/util/logger.c \
src/util/options.c \
src/util/options.h \
src/util/port.c \
src/util/port.h \
src/util/port_none_impl.h \
src/util/port_unix_impl.h \
src/util/port_win_impl.h \
src/util/random.c \
src/util/random.h \
src/util/rbt.c \
src/util/rbt.h \
src/util/slice.c \
src/util/slice.h \
src/util/snappy.c \
src/util/snappy.h \
src/util/status.c \
src/util/status.h \
src/util/strutil.c \
src/util/strutil.h \
src/util/thread_pool.c \
src/util/thread_pool.h \
src/util/types.h \
src/util/vector.c \
src/util/vector.h \
src/table/block.c \
src/table/block.h \
src/table/block_builder.c \
src/table/block_builder.h \
src/table/filter_block.c \
src/table/filter_block.h \
src/table/format.c \
src/table/format.h \
src/table/iterator.c \
src/table/iterator.h \
src/table/iterator_wrapper.h \
src/table/merger.c \
src/table/merger.h \
src/table/table.c \
src/table/table.h \
src/table/table_builder.c \
src/table/table_builder.h \
src/table/two_level_iterator.c \
src/table/two_level_iterator.h \
src/builder.c \
src/builder.h \
src/c.c \
src/db_impl.c \
src/db_impl.h \
src/db_iter.c \
src/db_iter.h \
src/dbformat.c \
src/dbformat.h \
src/dumpfile.c \
src/dumpfile.h \
src/filename.c \
src/filename.h \
src/log_format.h \
src/log_reader.c \
src/log_reader.h \
src/log_writer.c \
src/log_writer.h \
src/memtable.c \
src/memtable.h \
src/repair.c \
src/skiplist.c \
src/skiplist.h \
src/snapshot.h \
src/table_cache.c \
src/table_cache.h \
src/version_edit.c \
src/version_edit.h \
src/version_set.c \
src/version_set.h \
src/write_batch.c \
src/write_batch.h
#
# Targets
#
liblcdb_la_SOURCES = $(lcdb_sources)
liblcdb_la_CFLAGS =
if ENABLE_SHARED
liblcdb_la_CFLAGS += -DLDB_EXPORT
liblcdb_la_LDFLAGS = -no-undefined
if MINGW
liblcdb_la_LDFLAGS += -avoid-version -Wl,--output-def,.libs/lcdb.def
else
liblcdb_la_LDFLAGS += -version-info @ABI_VERSION@
endif
endif
lib_LTLIBRARIES = liblcdb.la
if ENABLE_LWDB
liblwdb_la_SOURCES = contrib/lwdb/lwdb.c
liblwdb_la_LDFLAGS = -static
noinst_LTLIBRARIES = liblwdb.la
endif
lcdbutil_SOURCES = src/dbutil.c
lcdbutil_LDADD = liblcdb.la
bin_PROGRAMS = lcdbutil
noinst_PROGRAMS =
#
# Benchmarks
#
bench_sources = bench/histogram.c \
bench/histogram.h \
src/util/testutil.c \
src/util/testutil.h
if ENABLE_BENCH
db_bench_SOURCES = bench/db_bench.c $(bench_sources)
db_bench_CFLAGS = -I$(top_srcdir)/src
db_bench_LDFLAGS = -static
db_bench_LDADD = liblcdb.la
noinst_PROGRAMS += db_bench
endif
if HAVE_BDB
db_bench_bdb_SOURCES = bench/db_bench_bdb.c $(bench_sources)
db_bench_bdb_CFLAGS = -I$(top_srcdir)/src
db_bench_bdb_LDFLAGS = -static
db_bench_bdb_LDADD = liblcdb.la -ldb
noinst_PROGRAMS += db_bench_bdb
endif
if HAVE_KCDB
db_bench_tree_db_SOURCES = bench/db_bench_tree_db.c $(bench_sources)
db_bench_tree_db_CFLAGS = -I$(top_srcdir)/src
db_bench_tree_db_LDFLAGS = -static
db_bench_tree_db_LDADD = liblcdb.la -lkyotocabinet
noinst_PROGRAMS += db_bench_tree_db
endif
if HAVE_LEVELDB
db_bench_leveldb_SOURCES = bench/db_bench_leveldb.c $(bench_sources)
db_bench_leveldb_CFLAGS = -I$(top_srcdir)/src
db_bench_leveldb_LDFLAGS = -static
db_bench_leveldb_LDADD = liblcdb.la -lleveldb
noinst_PROGRAMS += db_bench_leveldb
endif
if HAVE_LMDB
db_bench_lmdb_SOURCES = bench/db_bench_lmdb.c $(bench_sources)
db_bench_lmdb_CFLAGS = -I$(top_srcdir)/src
db_bench_lmdb_LDFLAGS = -static
db_bench_lmdb_LDADD = liblcdb.la -llmdb
noinst_PROGRAMS += db_bench_lmdb
endif
if HAVE_SQLITE3
db_bench_sqlite3_SOURCES = bench/db_bench_sqlite3.c $(bench_sources)
db_bench_sqlite3_CFLAGS = -I$(top_srcdir)/src
db_bench_sqlite3_LDFLAGS = -static
db_bench_sqlite3_LDADD = liblcdb.la -lsqlite3
noinst_PROGRAMS += db_bench_sqlite3
endif
#
# Fuzzer
#
if ENABLE_FUZZER
db_fuzz_SOURCES = $(lcdb_sources) contrib/fuzzer.c
db_fuzz_CFLAGS = -I$(top_srcdir)/src -DLDB_MEMENV \
-fsanitize=fuzzer,address,undefined
db_fuzz_LDFLAGS = -fsanitize=fuzzer,address,undefined
noinst_PROGRAMS += db_fuzz
endif
#
# WASI
#
if WASI
INITIAL_MEMORY = 16777216
MAX_MEMORY = 2147483648
STACK_SIZE = 5242880
lcdb_wasm_SOURCES = $(lcdb_sources)
lcdb_wasm_CFLAGS = -DLDB_EXPORT
lcdb_wasm_LDFLAGS = -mexec-model=reactor \
-Wl,--allow-undefined \
-Wl,--initial-memory=$(INITIAL_MEMORY) \
-Wl,--max-memory=$(MAX_MEMORY) \
-Wl,-z,stack-size=$(STACK_SIZE) \
-Wl,--stack-first \
-Wl,--export-dynamic \
-Wl,--export=malloc \
-Wl,--export=free
bin_PROGRAMS += lcdb.wasm
endif
#
# Emscripten
#
if EMSCRIPTEN
INITIAL_MEMORY = 16777216
MAX_MEMORY = 2147483648
STACK_SIZE = 5242880
lcdb_js_SOURCES = $(lcdb_sources)
lcdb_js_CFLAGS = -DLDB_EXPORT
lcdb_js_LDFLAGS = -s SINGLE_FILE=1 \
-s ASSERTIONS=0 \
-s NODERAWFS=1 \
-s NODEJS_CATCH_EXIT=0 \
-s NODEJS_CATCH_REJECTION=0 \
-s ALLOW_MEMORY_GROWTH=1 \
-s INITIAL_MEMORY=$(INITIAL_MEMORY) \
-s MAXIMUM_MEMORY=$(MAX_MEMORY) \
-s TOTAL_STACK=$(STACK_SIZE) \
-s ENVIRONMENT=node \
-s EXPORTED_FUNCTIONS=@etc/exports.json
bin_PROGRAMS += lcdb.js
endif