forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
264 lines (231 loc) · 8.87 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
.PHONY: all opt unit clean debug release release_expanded test unittest allunit benchmark docs doxygen format sqlite imdb
all: release
opt: release
unit: unittest
imdb: third_party/imdb/data
GENERATOR=
FORCE_COLOR=
WARNINGS_AS_ERRORS=
FORCE_WARN_UNUSED_FLAG=
DISABLE_UNITY_FLAG=
DISABLE_SANITIZER_FLAG=
OSX_BUILD_UNIVERSAL_FLAG=
FORCE_32_BIT_FLAG=
ifeq ($(GEN),ninja)
GENERATOR=-G "Ninja"
FORCE_COLOR=-DFORCE_COLORED_OUTPUT=1
endif
ifeq (${TREAT_WARNINGS_AS_ERRORS}, 1)
WARNINGS_AS_ERRORS=-DTREAT_WARNINGS_AS_ERRORS=1
endif
ifeq (${OSX_BUILD_UNIVERSAL}, 1)
OSX_BUILD_UNIVERSAL_FLAG=-DOSX_BUILD_UNIVERSAL=1
endif
ifeq (${FORCE_32_BIT}, 1)
FORCE_32_BIT_FLAG=-DFORCE_32_BIT=1
endif
ifeq (${FORCE_WARN_UNUSED}, 1)
FORCE_WARN_UNUSED_FLAG=-DFORCE_WARN_UNUSED=1
endif
ifeq (${DISABLE_UNITY}, 1)
DISABLE_UNITY_FLAG=-DDISABLE_UNITY=1
endif
ifeq (${DISABLE_SANITIZER}, 1)
DISABLE_SANITIZER_FLAG=-DENABLE_SANITIZER=FALSE -DENABLE_UBSAN=0
endif
ifeq (${DISABLE_UBSAN}, 1)
DISABLE_SANITIZER_FLAG=-DENABLE_UBSAN=0
endif
ifeq (${DISABLE_VPTR_SANITIZER}, 1)
DISABLE_SANITIZER_FLAG:=${DISABLE_SANITIZER_FLAG} -DDISABLE_VPTR_SANITIZER=1
endif
ifeq (${FORCE_SANITIZER}, 1)
DISABLE_SANITIZER_FLAG:=${DISABLE_SANITIZER_FLAG} -DFORCE_SANITIZER=1
endif
ifeq (${THREADSAN}, 1)
DISABLE_SANITIZER_FLAG:=${DISABLE_SANITIZER_FLAG} -DENABLE_THREAD_SANITIZER=1
endif
ifeq (${STATIC_LIBCPP}, 1)
STATIC_LIBCPP=-DSTATIC_LIBCPP=TRUE
endif
EXTENSIONS=-DBUILD_PARQUET_EXTENSION=TRUE
ifeq (${DISABLE_PARQUET}, 1)
EXTENSIONS:=
endif
ifeq (${DISABLE_MAIN_DUCKDB_LIBRARY}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_MAIN_DUCKDB_LIBRARY=0
endif
ifeq (${EXTENSION_STATIC_BUILD}, 1)
EXTENSIONS:=${EXTENSIONS} -DEXTENSION_STATIC_BUILD=1
endif
ifeq (${DISABLE_BUILTIN_EXTENSIONS}, 1)
EXTENSIONS:=${EXTENSIONS} -DDISABLE_BUILTIN_EXTENSIONS=1
endif
ifeq (${BUILD_BENCHMARK}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_BENCHMARKS=1
endif
ifeq (${BUILD_ICU}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_ICU_EXTENSION=1
endif
ifeq (${BUILD_TPCH}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_TPCH_EXTENSION=1
endif
ifeq (${BUILD_TPCDS}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_TPCDS_EXTENSION=1
endif
ifeq (${BUILD_FTS}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_FTS_EXTENSION=1
endif
ifeq (${BUILD_VISUALIZER}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_VISUALIZER_EXTENSION=1
endif
ifeq (${BUILD_HTTPFS}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_HTTPFS_EXTENSION=1
endif
ifeq (${BUILD_JSON}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_JSON_EXTENSION=1
endif
ifeq (${BUILD_EXCEL}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_EXCEL_EXTENSION=1
endif
ifeq (${STATIC_OPENSSL}, 1)
EXTENSIONS:=${EXTENSIONS} -DOPENSSL_USE_STATIC_LIBS=1
endif
ifeq (${BUILD_SQLSMITH}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_SQLSMITH_EXTENSION=1
endif
ifeq (${BUILD_TPCE}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_TPCE=1
endif
ifeq (${BUILD_SUBSTRAIT_EXTENSION}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_SUBSTRAIT_EXTENSION=1
endif
ifeq (${BUILD_JDBC}, 1)
EXTENSIONS:=${EXTENSIONS} -DJDBC_DRIVER=1
endif
ifeq (${BUILD_ODBC}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_ODBC_DRIVER=1
endif
ifeq (${BUILD_PYTHON}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_PYTHON=1 -DBUILD_JSON_EXTENSION=1 -DBUILD_FTS_EXTENSION=1 -DBUILD_TPCH_EXTENSION=1 -DBUILD_VISUALIZER_EXTENSION=1 -DBUILD_TPCDS_EXTENSION=1 -DBUILD_SUBSTRAIT_EXTENSION=1
endif
ifeq (${BUILD_R}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_R=1
endif
ifeq (${CONFIGURE_R}, 1)
EXTENSIONS:=${EXTENSIONS} -DCONFIGURE_R=1
endif
ifeq (${BUILD_REST}, 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_REST=1
endif
ifneq ($(TIDY_THREADS),)
TIDY_THREAD_PARAMETER := -j ${TIDY_THREADS}
endif
ifneq ($(TIDY_BINARY),)
TIDY_BINARY_PARAMETER := -clang-tidy-binary ${TIDY_BINARY}
endif
ifeq ($(BUILD_ARROW_ABI_TEST), 1)
EXTENSIONS:=${EXTENSIONS} -DBUILD_ARROW_ABI_TEST=1
endif
ifneq ("${FORCE_QUERY_LOG}a", "a")
EXTENSIONS:=${EXTENSIONS} -DFORCE_QUERY_LOG=${FORCE_QUERY_LOG}
endif
clean:
rm -rf build
debug:
mkdir -p build/debug && \
cd build/debug && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DCMAKE_BUILD_TYPE=Debug ../.. && \
cmake --build . --config Debug
release_expanded:
mkdir -p build/release_expanded && \
cd build/release_expanded && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_WARN_UNUSED_FLAG} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build . --config Release
cldebug:
mkdir -p build/cldebug && \
cd build/cldebug && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${EXTENSIONS} -DBUILD_PYTHON=1 -DBUILD_R=1 -DENABLE_SANITIZER=0 -DENABLE_UBSAN=0 -DCMAKE_BUILD_TYPE=Debug ../.. && \
cmake --build . --config Debug
clreldebug:
mkdir -p build/clreldebug && \
cd build/clreldebug && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DBUILD_PYTHON=1 -DBUILD_R=1 -DBUILD_FTS_EXTENSION=1 -DENABLE_SANITIZER=0 -DENABLE_UBSAN=0 -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. && \
cmake --build . --config RelWithDebInfo
unittest: debug
build/debug/test/unittest
build/debug/tools/sqlite3_api_wrapper/test_sqlite3_api_wrapper
unittestci:
python3 scripts/run_tests_one_by_one.py build/debug/test/unittest
build/debug/tools/sqlite3_api_wrapper/test_sqlite3_api_wrapper
unittestarrow:
build/debug/test/unittest "[arrow]"
allunit: release_expanded # uses release build because otherwise allunit takes forever
build/release_expanded/test/unittest "*"
docs:
mkdir -p build/docs && \
doxygen Doxyfile
doxygen: docs
open build/docs/html/index.html
release:
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_WARN_UNUSED_FLAG} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${OSX_BUILD_UNIVERSAL_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build . --config Release
reldebug:
mkdir -p build/reldebug && \
cd build/reldebug && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. && \
cmake --build . --config RelWithDebInfo
relassert:
mkdir -p build/relassert && \
cd build/relassert && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DFORCE_ASSERT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. && \
cmake --build . --config RelWithDebInfo
benchmark:
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) ${WARNINGS_AS_ERRORS} ${FORCE_WARN_UNUSED_FLAG} ${FORCE_32_BIT_FLAG} ${DISABLE_UNITY_FLAG} ${DISABLE_SANITIZER_FLAG} ${OSX_BUILD_UNIVERSAL_FLAG} ${STATIC_LIBCPP} ${EXTENSIONS} -DBUILD_BENCHMARKS=1 -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build . --config Release
amaldebug:
mkdir -p build/amaldebug && \
python scripts/amalgamation.py && \
cd build/amaldebug && \
cmake $(GENERATOR) $(FORCE_COLOR) ${STATIC_LIBCPP} ${EXTENSIONS} ${FORCE_32_BIT_FLAG} -DAMALGAMATION_BUILD=1 -DCMAKE_BUILD_TYPE=Debug ../.. && \
cmake --build . --config Debug
tidy-check:
mkdir -p build/tidy && \
cd build/tidy && \
cmake -DCLANG_TIDY=1 -DDISABLE_UNITY=1 -DBUILD_ODBC_DRIVER=TRUE -DBUILD_PARQUET_EXTENSION=TRUE -DBUILD_PYTHON_PKG=TRUE -DBUILD_SHELL=0 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../.. && \
python3 ../../scripts/run-clang-tidy.py -quiet ${TIDY_THREAD_PARAMETER} ${TIDY_BINARY_PARAMETER}
tidy-fix:
mkdir -p build/tidy && \
cd build/tidy && \
cmake -DCLANG_TIDY=1 -DDISABLE_UNITY=1 -DBUILD_PARQUET_EXTENSION=TRUE -DBUILD_SHELL=0 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../.. && \
python3 ../../scripts/run-clang-tidy.py -fix
test_compile: # test compilation of individual cpp files
python scripts/amalgamation.py --compile
format-check:
python3 scripts/format.py --all --check
format-check-silent:
python3 scripts/format.py --all --check --silent
format-fix:
rm -rf src/amalgamation/*
python3 scripts/format.py --all --fix --noconfirm
format-head:
python3 scripts/format.py HEAD --fix --noconfirm
format-changes:
python3 scripts/format.py HEAD --fix --noconfirm
format-master:
python3 scripts/format.py master --fix --noconfirm
third_party/sqllogictest:
git clone --depth=1 --branch hawkfish-statistical-rounding https://github.com/cwida/sqllogictest.git third_party/sqllogictest
third_party/imdb/data:
wget -i "http://download.duckdb.org/imdb/list.txt" -P third_party/imdb/data
sqlite: release_expanded | third_party/sqllogictest
git --git-dir third_party/sqllogictest/.git pull
./build/release_expanded/test/unittest "[sqlitelogic]"
sqlsmith: debug
./build/debug/third_party/sqlsmith/sqlsmith --duckdb=:memory:
clangd:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ${EXTENSIONS} -B build/clangd .