1 ###############################################################################
2 # The following macros should be defined before this script is
5 # TOP The toplevel directory of the source tree. This is the
6 # directory that contains this "Makefile.in" and the
7 # "configure.in" script.
9 # BCC C Compiler and options for use in building executables that
10 # will run on the platform that is doing the build.
12 # THREADLIB Specify any extra linker options needed to make the library
15 # OPTS Extra compiler command-line options.
17 # EXE The suffix to add to executable files. ".exe" for windows
20 # TCC C Compiler and options for use in building executables that
21 # will run on the target platform. This is usually the same
22 # as BCC, unless you are cross-compiling.
24 # AR Tools used to build a static library.
27 # TCL_FLAGS Extra compiler options needed for programs that use the
30 # LIBTCL Linker options needed to link against the TCL library.
32 # READLINE_FLAGS Compiler options needed for programs that use the
35 # LIBREADLINE Linker options needed by programs using readline() must
38 # NAWK Nawk compatible awk program. Older (obsolete?) solaris
39 # systems need this to avoid using the original AT&T AWK.
41 # Once the macros above are defined, the rest of this make script will
42 # build the SQLite library and testing tools.
43 ################################################################################
45 # This is how we compile
47 TCCX
= $(TCC
) $(OPTS
) -I.
-I
$(TOP
)/src
-I
$(TOP
)
48 TCCX
+= -I
$(TOP
)/ext
/rtree
-I
$(TOP
)/ext
/icu
-I
$(TOP
)/ext
/fts3
49 TCCX
+= -I
$(TOP
)/ext
/async
51 # Object files for the SQLite library.
53 LIBOBJ
+= alter.o analyze.o attach.o auth.o \
54 backup.o bitvec.o btmutex.o btree.o build.o \
55 callback.o complete.o ctime.o date.o delete.o expr.o fault.o fkey.o \
56 fts3.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
57 fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o fts3_write.o \
58 func.o global.o hash.o \
59 icu.o insert.o journal.o legacy.o loadext.o \
60 main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
62 mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \
63 notify.o opcodes.o os.o os_os2.o os_unix.o os_win.o \
64 pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
65 random.o resolve.o rowset.o rtree.o select.o status.o \
66 table.o tokenize.o trigger.o \
67 update.o util.o vacuum.o \
68 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbetrace.o \
69 wal.o walker.o where.o utf.o vtab.o
73 # All of the source code files.
77 $(TOP
)/src
/analyze.c \
82 $(TOP
)/src
/btmutex.c \
85 $(TOP
)/src
/btreeInt.h \
87 $(TOP
)/src
/callback.c \
88 $(TOP
)/src
/complete.c \
100 $(TOP
)/src
/insert.c \
101 $(TOP
)/src
/journal.c \
102 $(TOP
)/src
/legacy.c \
103 $(TOP
)/src
/loadext.c \
105 $(TOP
)/src
/malloc.c \
111 $(TOP
)/src
/memjournal.c \
114 $(TOP
)/src
/mutex_noop.c \
115 $(TOP
)/src
/mutex_os2.c \
116 $(TOP
)/src
/mutex_unix.c \
117 $(TOP
)/src
/mutex_w32.c \
118 $(TOP
)/src
/notify.c \
121 $(TOP
)/src
/os_common.h \
122 $(TOP
)/src
/os_os2.c \
123 $(TOP
)/src
/os_unix.c \
124 $(TOP
)/src
/os_win.c \
128 $(TOP
)/src
/pcache.c \
129 $(TOP
)/src
/pcache.h \
130 $(TOP
)/src
/pcache1.c \
131 $(TOP
)/src
/pragma.c \
132 $(TOP
)/src
/prepare.c \
133 $(TOP
)/src
/printf.c \
134 $(TOP
)/src
/random.c \
135 $(TOP
)/src
/resolve.c \
136 $(TOP
)/src
/rowset.c \
137 $(TOP
)/src
/select.c \
138 $(TOP
)/src
/status.c \
140 $(TOP
)/src
/sqlite.h.in \
141 $(TOP
)/src
/sqlite3ext.h \
142 $(TOP
)/src
/sqliteInt.h \
143 $(TOP
)/src
/sqliteLimit.h \
145 $(TOP
)/src
/tclsqlite.c \
146 $(TOP
)/src
/tokenize.c \
147 $(TOP
)/src
/trigger.c \
149 $(TOP
)/src
/update.c \
151 $(TOP
)/src
/vacuum.c \
154 $(TOP
)/src
/vdbeapi.c \
155 $(TOP
)/src
/vdbeaux.c \
156 $(TOP
)/src
/vdbeblob.c \
157 $(TOP
)/src
/vdbemem.c \
158 $(TOP
)/src
/vdbetrace.c \
159 $(TOP
)/src
/vdbeInt.h \
163 $(TOP
)/src
/walker.c \
166 # Source code for extensions
169 $(TOP
)/ext
/fts1
/fts1.c \
170 $(TOP
)/ext
/fts1
/fts1.h \
171 $(TOP
)/ext
/fts1
/fts1_hash.c \
172 $(TOP
)/ext
/fts1
/fts1_hash.h \
173 $(TOP
)/ext
/fts1
/fts1_porter.c \
174 $(TOP
)/ext
/fts1
/fts1_tokenizer.h \
175 $(TOP
)/ext
/fts1
/fts1_tokenizer1.c
177 $(TOP
)/ext
/fts2
/fts2.c \
178 $(TOP
)/ext
/fts2
/fts2.h \
179 $(TOP
)/ext
/fts2
/fts2_hash.c \
180 $(TOP
)/ext
/fts2
/fts2_hash.h \
181 $(TOP
)/ext
/fts2
/fts2_icu.c \
182 $(TOP
)/ext
/fts2
/fts2_porter.c \
183 $(TOP
)/ext
/fts2
/fts2_tokenizer.h \
184 $(TOP
)/ext
/fts2
/fts2_tokenizer.c \
185 $(TOP
)/ext
/fts2
/fts2_tokenizer1.c
187 $(TOP
)/ext
/fts3
/fts3.c \
188 $(TOP
)/ext
/fts3
/fts3.h \
189 $(TOP
)/ext
/fts3
/fts3Int.h \
190 $(TOP
)/ext
/fts3
/fts3_expr.c \
191 $(TOP
)/ext
/fts3
/fts3_hash.c \
192 $(TOP
)/ext
/fts3
/fts3_hash.h \
193 $(TOP
)/ext
/fts3
/fts3_icu.c \
194 $(TOP
)/ext
/fts3
/fts3_porter.c \
195 $(TOP
)/ext
/fts3
/fts3_snippet.c \
196 $(TOP
)/ext
/fts3
/fts3_tokenizer.h \
197 $(TOP
)/ext
/fts3
/fts3_tokenizer.c \
198 $(TOP
)/ext
/fts3
/fts3_tokenizer1.c \
199 $(TOP
)/ext
/fts3
/fts3_write.c
201 $(TOP
)/ext
/icu
/sqliteicu.h \
204 $(TOP
)/ext
/rtree
/rtree.h \
205 $(TOP
)/ext
/rtree
/rtree.c
208 # Generated source code files
219 # Source code to the test files.
231 $(TOP
)/src
/test_autoext.c \
232 $(TOP
)/src
/test_async.c \
233 $(TOP
)/src
/test_backup.c \
234 $(TOP
)/src
/test_btree.c \
235 $(TOP
)/src
/test_config.c \
236 $(TOP
)/src
/test_demovfs.c \
237 $(TOP
)/src
/test_devsym.c \
238 $(TOP
)/src
/test_func.c \
239 $(TOP
)/src
/test_hexio.c \
240 $(TOP
)/src
/test_init.c \
241 $(TOP
)/src
/test_intarray.c \
242 $(TOP
)/src
/test_journal.c \
243 $(TOP
)/src
/test_malloc.c \
244 $(TOP
)/src
/test_mutex.c \
245 $(TOP
)/src
/test_onefile.c \
246 $(TOP
)/src
/test_osinst.c \
247 $(TOP
)/src
/test_pcache.c \
248 $(TOP
)/src
/test_schema.c \
249 $(TOP
)/src
/test_server.c \
250 $(TOP
)/src
/test_stat.c \
251 $(TOP
)/src
/test_tclvar.c \
252 $(TOP
)/src
/test_thread.c \
253 $(TOP
)/src
/test_vfs.c \
254 $(TOP
)/src
/test_wsd.c
256 #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
257 #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
260 $(TOP
)/src
/attach.c \
261 $(TOP
)/src
/backup.c \
267 $(TOP
)/src
/insert.c \
271 $(TOP
)/src
/os_os2.c \
272 $(TOP
)/src
/os_unix.c \
273 $(TOP
)/src
/os_win.c \
275 $(TOP
)/src
/pragma.c \
276 $(TOP
)/src
/prepare.c \
277 $(TOP
)/src
/printf.c \
278 $(TOP
)/src
/random.c \
279 $(TOP
)/src
/pcache.c \
280 $(TOP
)/src
/pcache1.c \
281 $(TOP
)/src
/select.c \
282 $(TOP
)/src
/tokenize.c \
285 $(TOP
)/src
/vdbeapi.c \
286 $(TOP
)/src
/vdbeaux.c \
288 $(TOP
)/src
/vdbemem.c \
291 $(TOP
)/ext
/fts3
/fts3.c \
292 $(TOP
)/ext
/fts3
/fts3_expr.c \
293 $(TOP
)/ext
/fts3
/fts3_tokenizer.c \
294 $(TOP
)/ext
/fts3
/fts3_write.c \
295 $(TOP
)/ext
/async
/sqlite3async.c
297 # Header files used by all library source files.
301 $(TOP
)/src
/btreeInt.h \
303 $(TOP
)/src
/hwtime.h \
308 $(TOP
)/src
/os_common.h \
310 $(TOP
)/src
/pcache.h \
313 $(TOP
)/src
/sqlite3ext.h \
314 $(TOP
)/src
/sqliteInt.h \
315 $(TOP
)/src
/sqliteLimit.h \
319 # Header files used by extensions
322 $(TOP
)/ext
/fts1
/fts1.h \
323 $(TOP
)/ext
/fts1
/fts1_hash.h \
324 $(TOP
)/ext
/fts1
/fts1_tokenizer.h
326 $(TOP
)/ext
/fts2
/fts2.h \
327 $(TOP
)/ext
/fts2
/fts2_hash.h \
328 $(TOP
)/ext
/fts2
/fts2_tokenizer.h
330 $(TOP
)/ext
/fts3
/fts3.h \
331 $(TOP
)/ext
/fts3
/fts3Int.h \
332 $(TOP
)/ext
/fts3
/fts3_hash.h \
333 $(TOP
)/ext
/fts3
/fts3_tokenizer.h
335 $(TOP
)/ext
/rtree
/rtree.h
337 $(TOP
)/ext
/icu
/sqliteicu.h
339 # This is the default Makefile target. The objects listed here
340 # are what get build when you type just "make" with no arguments.
342 all: sqlite3.h libsqlite3.a sqlite3
$(EXE
)
344 libsqlite3.a
: $(LIBOBJ
)
345 $(AR
) libsqlite3.a
$(LIBOBJ
)
346 $(RANLIB
) libsqlite3.a
348 sqlite3
$(EXE
): $(TOP
)/src
/shell.c libsqlite3.a sqlite3.h
349 $(TCCX
) $(READLINE_FLAGS
) -o sqlite3
$(EXE
) \
351 libsqlite3.a
$(LIBREADLINE
) $(TLIBS
) $(THREADLIB
)
353 # This target creates a directory named "tsrc" and fills it with
354 # copies of all of the C source code and header files needed to
355 # build on the target system. Some of the C source code and header
356 # files are automatically generated. This target takes care of
357 # all that automatic generation.
359 target_source
: $(SRC
) $(TOP
)/tool
/vdbe-compress.tcl
363 rm tsrc
/sqlite.h.in tsrc
/parse.y
364 tclsh
$(TOP
)/tool
/vdbe-compress.tcl
<tsrc
/vdbe.c
>vdbe.new
365 mv vdbe.new tsrc
/vdbe.c
368 sqlite3.c
: target_source
$(TOP
)/tool
/mksqlite3c.tcl
369 tclsh
$(TOP
)/tool
/mksqlite3c.tcl
370 cp sqlite3.c tclsqlite3.c
371 cat
$(TOP
)/src
/tclsqlite.c
>>tclsqlite3.c
373 fts2amal.c
: target_source
$(TOP
)/ext
/fts2
/mkfts2amal.tcl
374 tclsh
$(TOP
)/ext
/fts2
/mkfts2amal.tcl
376 fts3amal.c
: target_source
$(TOP
)/ext
/fts3
/mkfts3amal.tcl
377 tclsh
$(TOP
)/ext
/fts3
/mkfts3amal.tcl
379 # Rules to build the LEMON compiler generator
381 lemon
: $(TOP
)/tool
/lemon.c
$(TOP
)/src
/lempar.c
382 $(BCC
) -o lemon
$(TOP
)/tool
/lemon.c
383 cp
$(TOP
)/src
/lempar.c .
385 # Rules to build individual *.o files from generated *.c files. This
394 # Rules to build individual *.o files from files in the src directory.
396 %.o
: $(TOP
)/src
/%.c
$(HDR
)
399 tclsqlite.o
: $(TOP
)/src
/tclsqlite.c
$(HDR
)
400 $(TCCX
) $(TCL_FLAGS
) -c
$(TOP
)/src
/tclsqlite.c
404 # Rules to build opcodes.c and opcodes.h
406 opcodes.c
: opcodes.h
$(TOP
)/mkopcodec.awk
407 sort -n
-b
-k
3 opcodes.h |
$(NAWK
) -f
$(TOP
)/mkopcodec.awk
>opcodes.c
409 opcodes.h
: parse.h
$(TOP
)/src
/vdbe.c
$(TOP
)/mkopcodeh.awk
410 cat parse.h
$(TOP
)/src
/vdbe.c | \
411 $(NAWK
) -f
$(TOP
)/mkopcodeh.awk
>opcodes.h
413 # Rules to build parse.c and parse.h - the outputs of lemon.
417 parse.c
: $(TOP
)/src
/parse.y lemon
$(TOP
)/addopcodes.awk
418 cp
$(TOP
)/src
/parse.y .
420 .
/lemon
$(OPTS
) parse.y
421 mv parse.h parse.h.temp
422 $(NAWK
) -f
$(TOP
)/addopcodes.awk parse.h.temp
>parse.h
424 sqlite3.h
: $(TOP
)/src
/sqlite.h.in
$(TOP
)/manifest.uuid
$(TOP
)/VERSION
425 tclsh
$(TOP
)/tool
/mksqlite3h.tcl
$(TOP
) >sqlite3.h
427 keywordhash.h
: $(TOP
)/tool
/mkkeywordhash.c
428 $(BCC
) -o mkkeywordhash
$(OPTS
) $(TOP
)/tool
/mkkeywordhash.c
429 .
/mkkeywordhash
>keywordhash.h
433 # Rules to build the extension objects.
435 icu.o
: $(TOP
)/ext
/icu
/icu.c
$(HDR
) $(EXTHDR
)
436 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/icu
/icu.c
438 fts2.o
: $(TOP
)/ext
/fts2
/fts2.c
$(HDR
) $(EXTHDR
)
439 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2.c
441 fts2_hash.o
: $(TOP
)/ext
/fts2
/fts2_hash.c
$(HDR
) $(EXTHDR
)
442 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2_hash.c
444 fts2_icu.o
: $(TOP
)/ext
/fts2
/fts2_icu.c
$(HDR
) $(EXTHDR
)
445 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2_icu.c
447 fts2_porter.o
: $(TOP
)/ext
/fts2
/fts2_porter.c
$(HDR
) $(EXTHDR
)
448 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2_porter.c
450 fts2_tokenizer.o
: $(TOP
)/ext
/fts2
/fts2_tokenizer.c
$(HDR
) $(EXTHDR
)
451 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2_tokenizer.c
453 fts2_tokenizer1.o
: $(TOP
)/ext
/fts2
/fts2_tokenizer1.c
$(HDR
) $(EXTHDR
)
454 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts2
/fts2_tokenizer1.c
456 fts3.o
: $(TOP
)/ext
/fts3
/fts3.c
$(HDR
) $(EXTHDR
)
457 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3.c
459 fts3_expr.o
: $(TOP
)/ext
/fts3
/fts3_expr.c
$(HDR
) $(EXTHDR
)
460 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_expr.c
462 fts3_hash.o
: $(TOP
)/ext
/fts3
/fts3_hash.c
$(HDR
) $(EXTHDR
)
463 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_hash.c
465 fts3_icu.o
: $(TOP
)/ext
/fts3
/fts3_icu.c
$(HDR
) $(EXTHDR
)
466 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_icu.c
468 fts3_snippet.o
: $(TOP
)/ext
/fts3
/fts3_snippet.c
$(HDR
) $(EXTHDR
)
469 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_snippet.c
471 fts3_porter.o
: $(TOP
)/ext
/fts3
/fts3_porter.c
$(HDR
) $(EXTHDR
)
472 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_porter.c
474 fts3_tokenizer.o
: $(TOP
)/ext
/fts3
/fts3_tokenizer.c
$(HDR
) $(EXTHDR
)
475 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_tokenizer.c
477 fts3_tokenizer1.o
: $(TOP
)/ext
/fts3
/fts3_tokenizer1.c
$(HDR
) $(EXTHDR
)
478 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_tokenizer1.c
480 fts3_write.o
: $(TOP
)/ext
/fts3
/fts3_write.c
$(HDR
) $(EXTHDR
)
481 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/fts3
/fts3_write.c
483 rtree.o
: $(TOP
)/ext
/rtree
/rtree.c
$(HDR
) $(EXTHDR
)
484 $(TCCX
) -DSQLITE_CORE
-c
$(TOP
)/ext
/rtree
/rtree.c
487 # Rules for building test programs and for running tests
489 tclsqlite3
: $(TOP
)/src
/tclsqlite.c libsqlite3.a
490 $(TCCX
) $(TCL_FLAGS
) -DTCLSH
=1 -o tclsqlite3 \
491 $(TOP
)/src
/tclsqlite.c libsqlite3.a
$(LIBTCL
) $(THREADLIB
)
494 # Rules to build the 'testfixture' application.
496 TESTFIXTURE_FLAGS
= -DSQLITE_TEST
=1 -DSQLITE_CRASH_TEST
=1
497 TESTFIXTURE_FLAGS
+= -DSQLITE_SERVER
=1 -DSQLITE_PRIVATE
="" -DSQLITE_CORE
499 testfixture
$(EXE
): $(TESTSRC2
) libsqlite3.a
$(TESTSRC
) $(TOP
)/src
/tclsqlite.c
500 $(TCCX
) $(TCL_FLAGS
) -DTCLSH
=1 $(TESTFIXTURE_FLAGS
) \
501 $(TESTSRC
) $(TESTSRC2
) $(TOP
)/src
/tclsqlite.c \
502 -o testfixture
$(EXE
) $(LIBTCL
) $(THREADLIB
) libsqlite3.a
504 amalgamation-testfixture
$(EXE
): sqlite3.c
$(TESTSRC
) $(TOP
)/src
/tclsqlite.c
505 $(TCCX
) $(TCL_FLAGS
) -DTCLSH
=1 $(TESTFIXTURE_FLAGS
) \
506 $(TESTSRC
) $(TOP
)/src
/tclsqlite.c sqlite3.c \
507 -o testfixture
$(EXE
) $(LIBTCL
) $(THREADLIB
)
509 fts3-testfixture
$(EXE
): sqlite3.c fts3amal.c
$(TESTSRC
) $(TOP
)/src
/tclsqlite.c
510 $(TCCX
) $(TCL_FLAGS
) -DTCLSH
=1 $(TESTFIXTURE_FLAGS
) \
511 -DSQLITE_ENABLE_FTS3
=1 \
512 $(TESTSRC
) $(TOP
)/src
/tclsqlite.c sqlite3.c fts3amal.c \
513 -o testfixture
$(EXE
) $(LIBTCL
) $(THREADLIB
)
515 fulltest
: testfixture
$(EXE
) sqlite3
$(EXE
)
516 .
/testfixture
$(EXE
) $(TOP
)/test/all.
test
518 soaktest
: testfixture
$(EXE
) sqlite3
$(EXE
)
519 .
/testfixture
$(EXE
) $(TOP
)/test/all.
test -soak
=1
521 test: testfixture
$(EXE
) sqlite3
$(EXE
)
522 .
/testfixture
$(EXE
) $(TOP
)/test/veryquick.
test
524 sqlite3_analyzer
$(EXE
): $(TOP
)/src
/tclsqlite.c sqlite3.c
$(TESTSRC
) \
525 $(TOP
)/tool
/spaceanal.tcl
532 $(TOP
)/tool
/spaceanal.tcl
>spaceanal_tcl.h
533 $(TCCX
) $(TCL_FLAGS
) -DTCLSH
=2 $(TESTFIXTURE_FLAGS
) \
534 -DSQLITE_TEST
=1 -DSQLITE_PRIVATE
="" \
535 $(TESTSRC
) $(TOP
)/src
/tclsqlite.c sqlite3.c \
536 -o sqlite3_analyzer
$(EXE
) \
537 $(LIBTCL
) $(THREADLIB
)
539 TEST_EXTENSION
= $(SHPREFIX
)testloadext.
$(SO
)
540 $(TEST_EXTENSION
): $(TOP
)/src
/test_loadext.c
541 $(MKSHLIB
) $(TOP
)/src
/test_loadext.c
-o
$(TEST_EXTENSION
)
543 extensiontest
: testfixture
$(EXE
) $(TEST_EXTENSION
)
544 .
/testfixture
$(EXE
) $(TOP
)/test/loadext.
test
547 # Standard install and cleanup targets
549 install: sqlite3 libsqlite3.a sqlite3.h
551 mv libsqlite3.a
/usr
/lib
552 mv sqlite3.h
/usr
/include
555 rm -f
*.o sqlite3 libsqlite3.a sqlite3.h opcodes.
*
556 rm -f lemon lempar.c parse.
* sqlite
*.
tar.gz mkkeywordhash keywordhash.h
558 rm -f
*.da
*.bb
*.bbg gmon.out
559 rm -rf tsrc target_source
560 rm -f testloadext.dll libtestloadext.so
561 rm -f sqlite3.c fts?amal.c tclsqlite3.c