5
# This makefile is suppose to be configured automatically using the
6
# autoconf. But if that does not work for you, you can configure
7
# the makefile manually. Just set the parameters below to values that
8
# work well for your system.
10
# If the configure script does not work out-of-the-box, you might
11
# be able to get it to work by giving it some hints. See the comment
12
# at the beginning of configure.in for additional information.
15
# The toplevel directory of the source tree. This is the directory
16
# that contains this "Makefile.in" and the "configure.in" script.
20
# C Compiler and options for use in building executables that
21
# will run on the platform that is doing the build.
23
BCC = @BUILD_CC@ @BUILD_CFLAGS@
25
# C Compile and options for use in building executables that
26
# will run on the target platform. (BCC and TCC are usually the
27
# same unless your are cross-compiling.)
29
TCC = @CC@ @CFLAGS@ -I. -I${TOP}/src
31
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
32
# Omitting the define will cause extra debugging code to be inserted and
33
# includes extra comments when "EXPLAIN stmt" is used.
35
TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
37
# Compiler options needed for programs that use the TCL library.
39
TCC += @TCL_INCLUDE_SPEC@
41
# The library that programs using TCL must link against.
43
LIBTCL = @TCL_LIB_SPEC@ @TCL_LIBS@
45
# Compiler options needed for programs that use the readline() library.
47
READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
49
# The library that programs using readline() must link against.
51
LIBREADLINE = @TARGET_READLINE_LIBS@
53
# Should the database engine be compiled threadsafe
55
TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
57
# The pthreads library if needed
59
LIBPTHREAD=@TARGET_THREAD_LIB@
61
# Do threads override each others locks by default (1), or do we test (-1)
63
TCC += -DSQLITE_THREAD_OVERRIDE_LOCK=@THREADSOVERRIDELOCKS@
65
# The fdatasync library
68
# Flags controlling use of the in memory btree implementation
70
# TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
71
# default to file, 2 to default to memory, and 3 to force temporary
72
# tables to always be in memory.
74
TEMP_STORE = -DTEMP_STORE=@TEMP_STORE@
76
# Version numbers and release number for the SQLite being compiled.
79
VERSION_NUMBER = @VERSION_NUMBER@
85
TEXE = @TARGET_EXEEXT@
87
# The following variable is "1" if the configure script was able to locate
88
# the tclConfig.sh file. It is an empty string otherwise. When this
89
# variable is "1", the TCL extension library (libtclsqlite3.so) is built
94
# The suffix used on shared libraries. Ex: ".dll", ".so", ".dylib"
96
SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
98
# The directory into which to store package information for
100
# Some standard variables and programs
103
exec_prefix = @exec_prefix@
107
ALLOWRELEASE = @ALLOWRELEASE@
109
# libtool compile/link/install
110
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC)
111
LTLINK = $(LIBTOOL) --mode=link $(TCC) @LDFLAGS@
112
LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
114
# nawk compatible awk.
117
# You should not have to change anything below this line
118
###############################################################################
119
TCC += -DSQLITE_OMIT_LOAD_EXTENSION=1
121
# Object files for the SQLite library.
123
LIBOBJ = alter.lo analyze.lo attach.lo auth.lo btmutex.lo btree.lo build.lo \
124
callback.lo complete.lo date.lo \
125
delete.lo expr.lo func.lo hash.lo journal.lo insert.lo loadext.lo \
126
main.lo malloc.lo mem1.lo mem2.lo mem3.lo mem4.lo mutex.lo \
127
mutex_os2.lo mutex_unix.lo mutex_w32.lo \
128
opcodes.lo os.lo os_unix.lo os_win.lo os_os2.lo \
129
pager.lo parse.lo pragma.lo prepare.lo printf.lo random.lo \
130
select.lo table.lo tokenize.lo trigger.lo update.lo \
132
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbefifo.lo vdbemem.lo \
133
where.lo utf.lo legacy.lo vtab.lo
135
# All of the source code files.
139
$(TOP)/src/analyze.c \
140
$(TOP)/src/attach.c \
142
$(TOP)/src/btmutex.c \
146
$(TOP)/src/callback.c \
147
$(TOP)/src/complete.c \
149
$(TOP)/src/delete.c \
154
$(TOP)/src/insert.c \
155
$(TOP)/src/journal.c \
156
$(TOP)/src/legacy.c \
157
$(TOP)/src/loadext.c \
159
$(TOP)/src/malloc.c \
165
$(TOP)/src/mutex_os2.c \
166
$(TOP)/src/mutex_unix.c \
167
$(TOP)/src/mutex_w32.c \
169
$(TOP)/src/os_unix.c \
170
$(TOP)/src/os_win.c \
171
$(TOP)/src/os_os2.c \
175
$(TOP)/src/pragma.c \
176
$(TOP)/src/prepare.c \
177
$(TOP)/src/printf.c \
178
$(TOP)/src/random.c \
179
$(TOP)/src/select.c \
181
$(TOP)/src/sqlite.h.in \
182
$(TOP)/src/sqliteInt.h \
184
$(TOP)/src/tclsqlite.c \
185
$(TOP)/src/tokenize.c \
186
$(TOP)/src/trigger.c \
188
$(TOP)/src/update.c \
190
$(TOP)/src/vacuum.c \
193
$(TOP)/src/vdbeapi.c \
194
$(TOP)/src/vdbeaux.c \
195
$(TOP)/src/vdbeblob.c \
196
$(TOP)/src/vdbefifo.c \
197
$(TOP)/src/vdbemem.c \
198
$(TOP)/src/vdbeInt.h \
202
# Source code for extensions
205
$(TOP)/ext/fts1/fts1.c \
206
$(TOP)/ext/fts1/fts1.h \
207
$(TOP)/ext/fts1/fts1_hash.c \
208
$(TOP)/ext/fts1/fts1_hash.h \
209
$(TOP)/ext/fts1/fts1_porter.c \
210
$(TOP)/ext/fts1/fts1_tokenizer.h \
211
$(TOP)/ext/fts1/fts1_tokenizer1.c
214
# Source code to the test files.
217
$(TOP)/src/attach.c \
223
$(TOP)/src/insert.c \
224
$(TOP)/src/malloc.c \
226
$(TOP)/src/os_os2.c \
227
$(TOP)/src/os_unix.c \
228
$(TOP)/src/os_win.c \
230
$(TOP)/src/pragma.c \
231
$(TOP)/src/prepare.c \
232
$(TOP)/src/printf.c \
233
$(TOP)/src/select.c \
243
$(TOP)/src/test_autoext.c \
244
$(TOP)/src/test_async.c \
245
$(TOP)/src/test_btree.c \
246
$(TOP)/src/test_config.c \
247
$(TOP)/src/test_hexio.c \
248
$(TOP)/src/test_malloc.c \
249
$(TOP)/src/test_md5.c \
250
$(TOP)/src/test_onefile.c \
251
$(TOP)/src/test_schema.c \
252
$(TOP)/src/test_server.c \
253
$(TOP)/src/test_tclvar.c \
254
$(TOP)/src/test_thread.c \
255
$(TOP)/src/tokenize.c \
259
$(TOP)/src/vdbeapi.c \
260
$(TOP)/src/vdbeaux.c \
261
$(TOP)/src/vdbemem.c \
265
# Header files used by all library source files.
270
$(TOP)/src/btreeInt.h \
272
$(TOP)/src/sqliteLimit.h \
276
$(TOP)/src/os_common.h \
277
$(TOP)/src/sqlite3ext.h \
278
$(TOP)/src/sqliteInt.h \
282
# Header files used by extensions
285
$(TOP)/ext/fts1/fts1.h \
286
$(TOP)/ext/fts1/fts1_hash.h \
287
$(TOP)/ext/fts1/fts1_tokenizer.h
289
# Header files used by the VDBE submodule
295
# This is the default Makefile target. The objects listed here
296
# are what get build when you type just "make" with no arguments.
298
all: sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
300
Makefile: $(TOP)/Makefile.in
303
# Generate the file "last_change" which contains the date of change
304
# of the most recently modified source code file
307
cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
308
| $(NAWK) '{print $$5,$$6}' >last_change
310
libsqlite3.la: $(LIBOBJ)
311
$(LTLINK) -o libsqlite3.la $(LIBOBJ) $(LIBPTHREAD) \
312
${ALLOWRELEASE} -rpath $(libdir) -version-info "8:6:8"
314
libtclsqlite3.la: tclsqlite.lo libsqlite3.la
315
$(LTLINK) -o libtclsqlite3.la tclsqlite.lo \
316
$(LIBOBJ) @TCL_STUB_LIB_SPEC@ $(LIBPTHREAD) \
317
-rpath $(libdir)/sqlite \
318
-version-info "8:6:8"
320
sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h
321
$(LTLINK) $(READLINE_FLAGS) $(LIBPTHREAD) \
322
-o $@ $(TOP)/src/shell.c libsqlite3.la \
323
$(LIBREADLINE) $(TLIBS)
325
# This target creates a directory named "tsrc" and fills it with
326
# copies of all of the C source code and header files needed to
327
# build on the target system. Some of the C source code and header
328
# files are automatically generated. This target takes care of
329
# all that automatic generation.
331
target_source: $(SRC) parse.c opcodes.c keywordhash.h $(VDBEHDR)
334
cp $(SRC) $(VDBEHDR) tsrc
335
rm tsrc/sqlite.h.in tsrc/parse.y
336
cp parse.c opcodes.c keywordhash.h tsrc
338
sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
339
tclsh $(TOP)/tool/mksqlite3c.tcl
341
# Rules to build the LEMON compiler generator
343
lemon$(BEXE): $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
344
$(BCC) -o lemon$(BEXE) $(TOP)/tool/lemon.c
345
cp $(TOP)/tool/lempar.c .
348
# Rules to build individual files
350
alter.lo: $(TOP)/src/alter.c $(HDR)
351
$(LTCOMPILE) -c $(TOP)/src/alter.c
353
analyze.lo: $(TOP)/src/analyze.c $(HDR)
354
$(LTCOMPILE) -c $(TOP)/src/analyze.c
356
attach.lo: $(TOP)/src/attach.c $(HDR)
357
$(LTCOMPILE) -c $(TOP)/src/attach.c
359
auth.lo: $(TOP)/src/auth.c $(HDR)
360
$(LTCOMPILE) -c $(TOP)/src/auth.c
362
btmutex.lo: $(TOP)/src/btmutex.c $(HDR)
363
$(LTCOMPILE) -c $(TOP)/src/btmutex.c
365
btree.lo: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
366
$(LTCOMPILE) -c $(TOP)/src/btree.c
368
build.lo: $(TOP)/src/build.c $(HDR)
369
$(LTCOMPILE) -c $(TOP)/src/build.c
371
callback.lo: $(TOP)/src/callback.c $(HDR)
372
$(LTCOMPILE) -c $(TOP)/src/callback.c
374
complete.lo: $(TOP)/src/complete.c $(HDR)
375
$(LTCOMPILE) -c $(TOP)/src/complete.c
377
date.lo: $(TOP)/src/date.c $(HDR)
378
$(LTCOMPILE) -c $(TOP)/src/date.c
380
delete.lo: $(TOP)/src/delete.c $(HDR)
381
$(LTCOMPILE) -c $(TOP)/src/delete.c
383
expr.lo: $(TOP)/src/expr.c $(HDR)
384
$(LTCOMPILE) -c $(TOP)/src/expr.c
386
func.lo: $(TOP)/src/func.c $(HDR)
387
$(LTCOMPILE) -c $(TOP)/src/func.c
389
hash.lo: $(TOP)/src/hash.c $(HDR)
390
$(LTCOMPILE) -c $(TOP)/src/hash.c
392
insert.lo: $(TOP)/src/insert.c $(HDR)
393
$(LTCOMPILE) -c $(TOP)/src/insert.c
395
journal.lo: $(TOP)/src/journal.c $(HDR)
396
$(LTCOMPILE) -c $(TOP)/src/journal.c
398
legacy.lo: $(TOP)/src/legacy.c $(HDR)
399
$(LTCOMPILE) -c $(TOP)/src/legacy.c
401
loadext.lo: $(TOP)/src/loadext.c $(HDR)
402
$(LTCOMPILE) -c $(TOP)/src/loadext.c
404
main.lo: $(TOP)/src/main.c $(HDR)
405
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/main.c
407
malloc.lo: $(TOP)/src/malloc.c $(HDR)
408
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/malloc.c
410
mem1.lo: $(TOP)/src/mem1.c $(HDR)
411
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem1.c
413
mem2.lo: $(TOP)/src/mem2.c $(HDR)
414
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem2.c
416
mem3.lo: $(TOP)/src/mem3.c $(HDR)
417
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem3.c
419
mem4.lo: $(TOP)/src/mem4.c $(HDR)
420
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem4.c
422
mutex.lo: $(TOP)/src/mutex.c $(HDR)
423
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex.c
425
mutex_os2.lo: $(TOP)/src/mutex_os2.c $(HDR)
426
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_os2.c
428
mutex_unix.lo: $(TOP)/src/mutex_unix.c $(HDR)
429
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_unix.c
431
mutex_w32.lo: $(TOP)/src/mutex_w32.c $(HDR)
432
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_w32.c
434
pager.lo: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
435
$(LTCOMPILE) -c $(TOP)/src/pager.c
437
opcodes.lo: opcodes.c
438
$(LTCOMPILE) -c opcodes.c
440
opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
441
sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
443
opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
444
cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
446
os.lo: $(TOP)/src/os.c $(HDR)
447
$(LTCOMPILE) -c $(TOP)/src/os.c
449
os_unix.lo: $(TOP)/src/os_unix.c $(HDR)
450
$(LTCOMPILE) -c $(TOP)/src/os_unix.c
452
os_win.lo: $(TOP)/src/os_win.c $(HDR)
453
$(LTCOMPILE) -c $(TOP)/src/os_win.c
455
os_os2.lo: $(TOP)/src/os_os2.c $(HDR)
456
$(LTCOMPILE) -c $(TOP)/src/os_os2.c
458
parse.lo: parse.c $(HDR)
459
$(LTCOMPILE) -c parse.c
463
parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
464
cp $(TOP)/src/parse.y .
465
./lemon$(BEXE) $(OPTS) parse.y
466
mv parse.h parse.h.temp
467
$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
469
pragma.lo: $(TOP)/src/pragma.c $(HDR)
470
$(LTCOMPILE) -c $(TOP)/src/pragma.c
472
prepare.lo: $(TOP)/src/prepare.c $(HDR)
473
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/prepare.c
475
printf.lo: $(TOP)/src/printf.c $(HDR)
476
$(LTCOMPILE) -c $(TOP)/src/printf.c
478
random.lo: $(TOP)/src/random.c $(HDR)
479
$(LTCOMPILE) -c $(TOP)/src/random.c
481
select.lo: $(TOP)/src/select.c $(HDR)
482
$(LTCOMPILE) -c $(TOP)/src/select.c
484
sqlite3.h: $(TOP)/src/sqlite.h.in
485
sed -e s/--VERS--/$(RELEASE)/ $(TOP)/src/sqlite.h.in | \
486
sed -e s/--VERSION-NUMBER--/$(VERSION_NUMBER)/ >sqlite3.h
488
table.lo: $(TOP)/src/table.c $(HDR)
489
$(LTCOMPILE) -c $(TOP)/src/table.c
491
tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR)
492
$(LTCOMPILE) -c $(TOP)/src/tclsqlite.c
494
tokenize.lo: $(TOP)/src/tokenize.c keywordhash.h $(HDR)
495
$(LTCOMPILE) -c $(TOP)/src/tokenize.c
497
keywordhash.h: $(TOP)/tool/mkkeywordhash.c
498
$(BCC) -o mkkeywordhash$(BEXE) $(OPTS) $(TOP)/tool/mkkeywordhash.c
499
./mkkeywordhash$(BEXE) >keywordhash.h
501
trigger.lo: $(TOP)/src/trigger.c $(HDR)
502
$(LTCOMPILE) -c $(TOP)/src/trigger.c
504
update.lo: $(TOP)/src/update.c $(HDR)
505
$(LTCOMPILE) -c $(TOP)/src/update.c
507
utf.lo: $(TOP)/src/utf.c $(HDR)
508
$(LTCOMPILE) -c $(TOP)/src/utf.c
510
util.lo: $(TOP)/src/util.c $(HDR)
511
$(LTCOMPILE) -c $(TOP)/src/util.c
513
vacuum.lo: $(TOP)/src/vacuum.c $(HDR)
514
$(LTCOMPILE) -c $(TOP)/src/vacuum.c
516
vdbe.lo: $(TOP)/src/vdbe.c $(VDBEHDR)
517
$(LTCOMPILE) -c $(TOP)/src/vdbe.c
519
vdbeapi.lo: $(TOP)/src/vdbeapi.c $(VDBEHDR)
520
$(LTCOMPILE) -c $(TOP)/src/vdbeapi.c
522
vdbeaux.lo: $(TOP)/src/vdbeaux.c $(VDBEHDR)
523
$(LTCOMPILE) -c $(TOP)/src/vdbeaux.c
525
vdbeblob.lo: $(TOP)/src/vdbeblob.c $(VDBEHDR)
526
$(LTCOMPILE) -c $(TOP)/src/vdbeblob.c
528
vdbefifo.lo: $(TOP)/src/vdbefifo.c $(VDBEHDR)
529
$(LTCOMPILE) -c $(TOP)/src/vdbefifo.c
531
vdbemem.lo: $(TOP)/src/vdbemem.c $(VDBEHDR)
532
$(LTCOMPILE) -c $(TOP)/src/vdbemem.c
534
vtab.lo: $(TOP)/src/vtab.c $(VDBEHDR)
535
$(LTCOMPILE) -c $(TOP)/src/vtab.c
537
where.lo: $(TOP)/src/where.c $(HDR)
538
$(LTCOMPILE) -c $(TOP)/src/where.c
540
tclsqlite-shell.lo: $(TOP)/src/tclsqlite.c $(HDR)
541
$(LTCOMPILE) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c
543
tclsqlite-stubs.lo: $(TOP)/src/tclsqlite.c $(HDR)
544
$(LTCOMPILE) -DTCL_USE_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c
546
tclsqlite3: tclsqlite-shell.lo libsqlite3.la
547
$(LTLINK) -o tclsqlite3 tclsqlite-shell.lo \
548
libsqlite3.la $(LIBTCL)
550
testfixture$(TEXE): $(TOP)/src/tclsqlite.c libsqlite3.la $(TESTSRC)
551
$(LTLINK) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
552
-DSQLITE_NO_SYNC=1 $(TEMP_STORE) \
553
-o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \
554
libsqlite3.la $(LIBTCL)
557
fulltest: testfixture$(TEXE) sqlite3$(TEXE)
558
./testfixture $(TOP)/test/all.test
560
test: testfixture$(TEXE) sqlite3$(TEXE)
561
./testfixture $(TOP)/test/quick.test
563
sqlite3_analyzer$(TEXE): $(TOP)/src/tclsqlite.c libtclsqlite3.la \
564
$(TESTSRC) $(TOP)/tool/spaceanal.tcl
571
$(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
572
$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 $(TEMP_STORE)\
573
-o sqlite3_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \
574
libtclsqlite3.la $(LIBTCL)
577
install: sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
578
$(INSTALL) -d $(DESTDIR)$(libdir)
579
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
580
$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
581
$(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(exec_prefix)/bin
582
$(INSTALL) -d $(DESTDIR)$(prefix)/include
583
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(prefix)/include
584
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(prefix)/include
585
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig;
586
$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig;
588
tcl_install: libtclsqlite3.la
589
tclsh $(TOP)/tclinstaller.tcl $(VERSION)
592
rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
593
rm -f sqlite3.h opcodes.*
595
rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
596
rm -f mkkeywordhash$(BEXE) keywordhash.h
598
rm -f *.da *.bb *.bbg gmon.out
599
rm -f testfixture$(TEXE) test.db
601
rm -f sqlite3.dll sqlite3.lib sqlite3.def
604
rm -f config.log config.status libtool Makefile config.h sqlite3.pc
611
REAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o)
613
$(REAL_LIBOBJ): $(LIBOBJ)
615
sqlite3.def: $(REAL_LIBOBJ)
616
echo 'EXPORTS' >sqlite3.def
617
nm $(REAL_LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \
618
| sed 's/^.* _//' >>sqlite3.def
620
sqlite3.dll: $(REAL_LIBOBJ) sqlite3.def
621
$(TCC) -shared -o sqlite3.dll sqlite3.def \
622
-Wl,"--strip-all" $(REAL_LIBOBJ)