1515# The toplevel directory of the source tree. This is the directory
1616# that contains this "Makefile.in" and the "configure.in" script.
1717#
18- TOP = @srcdir @
18+ TOP = @abs_srcdir @
1919
2020
2121# C Compiler and options for use in building executables that
2222# will run on the platform that is doing the build.
2323#
2424BCC = @BUILD_CC@ @BUILD_CFLAGS@
2525
26- # C Compile and options for use in building executables that
26+ # TCC is the C Compile and options for use in building executables that
2727# will run on the target platform. (BCC and TCC are usually the
28- # same unless your are cross-compiling.)
28+ # same unless your are cross-compiling.) Separate CC and CFLAGS macros
29+ # are provide so that these aspects of the build process can be changed
30+ # on the "make" command-line. Ex: "make CC=clang CFLAGS=-fsanitize=undefined"
2931#
30- TCC = @CC@ @CPPFLAGS@ @CFLAGS@ -I. -I${TOP}/src -I${TOP}/ext/rtree
32+ CC = @CC@
33+ CFLAGS = @CPPFLAGS@ @CFLAGS@
34+ TCC = $(CC ) $(CFLAGS ) -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/fts3
3135
3236# Define this for the autoconf-based build, so that the code knows it can
3337# include the generated config.h
@@ -38,7 +42,7 @@ TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
3842# Omitting the define will cause extra debugging code to be inserted and
3943# includes extra comments when "EXPLAIN stmt" is used.
4044#
41- TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
45+ TCC += @TARGET_DEBUG@
4246
4347# Compiler options needed for programs that use the TCL library.
4448#
@@ -196,7 +200,7 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
196200 notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
197201 pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
198202 random.lo resolve.lo rowset.lo rtree.lo select.lo status.lo \
199- table.lo tokenize.lo trigger.lo \
203+ table.lo threads.lo tokenize.lo trigger.lo \
200204 update.lo util.lo vacuum.lo \
201205 vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
202206 vdbetrace.lo wal.lo walker.lo where.lo utf.lo vtab.lo $(CRYPTOLIBOBJ )
@@ -250,6 +254,7 @@ SRC = \
250254 $(TOP ) /src/mem3.c \
251255 $(TOP ) /src/mem5.c \
252256 $(TOP ) /src/memjournal.c \
257+ $(TOP ) /src/msvc.h \
253258 $(TOP ) /src/mutex.c \
254259 $(TOP ) /src/mutex.h \
255260 $(TOP ) /src/mutex_noop.c \
@@ -283,6 +288,7 @@ SRC = \
283288 $(TOP ) /src/sqliteInt.h \
284289 $(TOP ) /src/sqliteLimit.h \
285290 $(TOP ) /src/table.c \
291+ $(TOP ) /src/threads.c \
286292 $(TOP ) /src/tclsqlite.c \
287293 $(TOP ) /src/tokenize.c \
288294 $(TOP ) /src/trigger.c \
@@ -378,6 +384,7 @@ TESTSRC = \
378384 $(TOP ) /src/test_autoext.c \
379385 $(TOP ) /src/test_async.c \
380386 $(TOP ) /src/test_backup.c \
387+ $(TOP ) /src/test_blob.c \
381388 $(TOP ) /src/test_btree.c \
382389 $(TOP ) /src/test_config.c \
383390 $(TOP ) /src/test_demovfs.c \
@@ -413,6 +420,7 @@ TESTSRC = \
413420TESTSRC += \
414421 $(TOP ) /ext/misc/amatch.c \
415422 $(TOP ) /ext/misc/closure.c \
423+ $(TOP ) /ext/misc/eval.c \
416424 $(TOP ) /ext/misc/fileio.c \
417425 $(TOP ) /ext/misc/fuzzer.c \
418426 $(TOP ) /ext/misc/ieee754.c \
@@ -476,6 +484,7 @@ HDR = \
476484 $(TOP ) /src/hash.h \
477485 $(TOP ) /src/hwtime.h \
478486 keywordhash.h \
487+ $(TOP ) /src/msvc.h \
479488 $(TOP ) /src/mutex.h \
480489 opcodes.h \
481490 $(TOP ) /src/os.h \
@@ -547,6 +556,11 @@ mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
547556 $(LTLINK ) -o $@ -I. $(TOP ) /mptest/mptest.c sqlite3.c \
548557 $(TLIBS ) -rpath " $( libdir) "
549558
559+ mptest : mptester$(EXE )
560+ rm -f mptest1.db
561+ ./mptester$(EXE ) mptest1.db $(TOP ) /mptest/crash01.test
562+ rm -f mptest2.db
563+ ./mptester$(EXE ) mptest2.db $(TOP ) /mptest/multiwrite01.test
550564
551565# This target creates a directory named "tsrc" and fills it with
552566# copies of all of the C source code and header files needed to
@@ -770,6 +784,9 @@ status.lo: $(TOP)/src/status.c $(HDR)
770784table.lo : $(TOP ) /src/table.c $(HDR )
771785 $(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/table.c
772786
787+ threads.lo : $(TOP ) /src/threads.c $(HDR )
788+ $(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/threads.c
789+
773790tokenize.lo : $(TOP ) /src/tokenize.c keywordhash.h $(HDR )
774791 $(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/tokenize.c
775792
@@ -948,19 +965,37 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC)
948965 $(LTLINK ) -DSQLITE_NO_SYNC=1 $(TEMP_STORE ) $(TESTFIXTURE_FLAGS ) \
949966 -o $@ $(TESTFIXTURE_SRC ) $(LIBTCL ) $(TLIBS )
950967
951-
968+ # A very detailed test running most or all test cases
952969fulltest : testfixture$(TEXE ) sqlcipher$(TEXE )
953970 ./testfixture$(TEXE ) $(TOP ) /test/all.test
954971
972+ # Really really long testing
955973soaktest : testfixture$(TEXE ) sqlcipher$(TEXE )
956974 ./testfixture$(TEXE ) $(TOP ) /test/all.test -soak=1
957975
976+ # Do extra testing but not aeverything.
958977fulltestonly : testfixture$(TEXE ) sqlcipher$(TEXE )
959978 ./testfixture$(TEXE ) $(TOP ) /test/full.test
960979
980+ # This is the common case. Run many tests but not those that take
981+ # a really long time.
982+ #
961983test : testfixture$(TEXE ) sqlcipher$(TEXE )
962984 ./testfixture$(TEXE ) $(TOP ) /test/veryquick.test
963985
986+ # Run a test using valgrind. This can take a really long time
987+ # because valgrind is so much slower than a native machine.
988+ #
989+ valgrindtest : testfixture$(TEXE ) sqlite3$(TEXE )
990+ OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE ) $(TOP ) /test/permutations.test valgrind
991+
992+ # A very fast test that checks basic sanity. The name comes from
993+ # the 60s-era electronics testing: "Turn it on and see if smoke
994+ # comes out."
995+ #
996+ smoketest : testfixture$(TEXE )
997+ ./testfixture$(TEXE ) $(TOP ) /test/main.test
998+
964999sqlite3_analyzer.c : sqlite3.c $(TOP ) /src/test_stat.c $(TOP ) /src/tclsqlite.c $(TOP ) /tool/spaceanal.tcl
9651000 echo " #define TCLSH 2" > $@
9661001 cat sqlite3.c $(TOP ) /src/test_stat.c $(TOP ) /src/tclsqlite.c >> $@
@@ -996,12 +1031,45 @@ wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.c
9961031speedtest1$(TEXE ) : $(TOP ) /test/wordcount.c sqlite3.lo
9971032 $(LTLINK ) -o $@ $(TOP ) /test/speedtest1.c sqlite3.lo $(TLIBS )
9981033
1034+ # This target will fail if the SQLite amalgamation contains any exported
1035+ # symbols that do not begin with "sqlite3_". It is run as part of the
1036+ # releasetest.tcl script.
1037+ #
1038+ checksymbols : sqlite3.lo
1039+ nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
1040+ echo ' 0 errors out of 1 tests'
1041+
1042+ # Build the amalgamation-autoconf package.
1043+ #
1044+ amalgamation-tarball : sqlite3.c
1045+ TOP=$(TOP ) sh $(TOP ) /tool/mkautoconfamal.sh
1046+
1047+ # The next two rules are used to support the "threadtest" target. Building
1048+ # threadtest runs a few thread-safety tests that are implemented in C. This
1049+ # target is invoked by the releasetest.tcl script.
1050+ #
1051+ THREADTEST3_SRC = $(TOP ) /test/threadtest3.c \
1052+ $(TOP ) /test/tt3_checkpoint.c \
1053+ $(TOP ) /test/tt3_index.c \
1054+ $(TOP ) /test/tt3_vacuum.c \
1055+ $(TOP ) /test/tt3_stress.c \
1056+ $(TOP ) /test/tt3_lookaside1.c
1057+
1058+ threadtest3$(TEXE ) : sqlite3.lo $(THREADTEST3_SRC )
1059+ $(LTLINK ) $(TOP ) /test/threadtest3.c sqlite3.lo -o $@ $(TLIBS )
1060+
1061+ threadtest : threadtest3$(TEXE )
1062+ ./threadtest3$(TEXE )
1063+
1064+ releasetest :
1065+ $(TCLSH_CMD ) $(TOP ) /test/releasetest.tcl
1066+
9991067# Standard install and cleanup targets
10001068#
10011069lib_install : libsqlcipher.la
10021070 $(INSTALL ) -d $(DESTDIR )$(libdir )
10031071 $(LTINSTALL ) libsqlcipher.la $(DESTDIR )$(libdir )
1004-
1072+
10051073install : sqlcipher$(BEXE ) lib_install sqlite3.h sqlcipher.pc ${HAVE_TCL:1=tcl_install}
10061074 $(INSTALL ) -d $(DESTDIR )$(bindir )
10071075 $(LTINSTALL ) sqlcipher$(BEXE ) $(DESTDIR )$(bindir )
0 commit comments