blob: 1d67c59be86f35b724339a199bcc68d721944ed5 [file] [log] [blame]
drh71eb93e2001-09-28 01:34:43 +00001###############################################################################
drh76800322002-08-13 20:45:39 +00002# The following macros should be defined before this script is
3# invoked:
4#
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.
8#
9# BCC C Compiler and options for use in building executables that
10# will run on the platform that is doing the build.
11#
drh76800322002-08-13 20:45:39 +000012# THREADLIB Specify any extra linker options needed to make the library
13# thread safe
14#
15# OPTS Extra compiler command-line options.
16#
17# EXE The suffix to add to executable files. ".exe" for windows
18# and "" for Unix.
19#
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.
23#
24# AR Tools used to build a static library.
25# RANLIB
26#
27# TCL_FLAGS Extra compiler options needed for programs that use the
28# TCL library.
29#
30# LIBTCL Linker options needed to link against the TCL library.
31#
32# READLINE_FLAGS Compiler options needed for programs that use the
33# readline() library.
34#
35# LIBREADLINE Linker options needed by programs using readline() must
36# link against.
37#
drhf1878b42006-01-23 18:06:52 +000038# NAWK Nawk compatible awk program. Older (obsolete?) solaris
39# systems need this to avoid using the original AT&T AWK.
drh76800322002-08-13 20:45:39 +000040#
41# Once the macros above are defined, the rest of this make script will
42# build the SQLite library and testing tools.
43################################################################################
drh71eb93e2001-09-28 01:34:43 +000044
45# This is how we compile
46#
drh3285db22007-09-03 22:00:39 +000047TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src
drh71eb93e2001-09-28 01:34:43 +000048
49# Object files for the SQLite library.
50#
drh900b31e2007-08-28 02:27:51 +000051LIBOBJ+= alter.o analyze.o attach.o auth.o btmutex.o btree.o build.o \
drha2b902d2005-08-14 17:53:20 +000052 callback.o complete.o date.o delete.o \
danielk1977c7b60172007-08-22 11:22:03 +000053 expr.o func.o hash.o insert.o journal.o loadext.o \
drh437b9012007-08-28 16:34:42 +000054 main.o malloc.o mem1.o mem2.o mutex.o mutex_os2.o \
55 mutex_unix.o mutex_w32.o \
drh90f6a5b2007-08-15 13:04:54 +000056 opcodes.o os.o os_os2.o os_unix.o os_win.o \
danielk1977fa256a32005-05-25 04:11:56 +000057 pager.o parse.o pragma.o prepare.o printf.o random.o \
drh38f82712004-06-18 17:10:16 +000058 select.o table.o tclsqlite.o tokenize.o trigger.o \
59 update.o util.o vacuum.o \
danielk1977b4e9af92007-05-01 17:49:49 +000060 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbefifo.o vdbemem.o \
drhb9bb7c12006-06-11 23:41:55 +000061 where.o utf.o legacy.o vtab.o
drh71eb93e2001-09-28 01:34:43 +000062
shess69c4ae22007-08-20 17:37:47 +000063EXTOBJ = icu.o
64EXTOBJ += fts1.o \
65 fts1_hash.o \
66 fts1_tokenizer1.o \
67 fts1_porter.o
68EXTOBJ += fts2.o \
69 fts2_hash.o \
70 fts2_icu.o \
71 fts2_porter.o \
72 fts2_tokenizer.o \
73 fts2_tokenizer1.o
74EXTOBJ += fts3.o \
75 fts3_hash.o \
76 fts3_icu.o \
77 fts3_porter.o \
78 fts3_tokenizer.o \
79 fts3_tokenizer1.o
danielk1977576d3db2007-06-25 14:28:48 +000080
drh71eb93e2001-09-28 01:34:43 +000081# All of the source code files.
82#
83SRC = \
drhd0e4a6c2005-02-15 20:47:57 +000084 $(TOP)/src/alter.c \
drh9f18e8a2005-07-08 12:13:04 +000085 $(TOP)/src/analyze.c \
drhc11d4f92003-04-06 21:08:24 +000086 $(TOP)/src/attach.c \
drhed6c8672003-01-12 18:02:16 +000087 $(TOP)/src/auth.c \
drh900b31e2007-08-28 02:27:51 +000088 $(TOP)/src/btmutex.c \
drh71eb93e2001-09-28 01:34:43 +000089 $(TOP)/src/btree.c \
90 $(TOP)/src/btree.h \
danielk1977e6a58a42007-08-31 17:42:48 +000091 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +000092 $(TOP)/src/build.c \
danielk1977fd9a0a42005-05-24 12:01:00 +000093 $(TOP)/src/callback.c \
drha2b902d2005-08-14 17:53:20 +000094 $(TOP)/src/complete.c \
drh7014aff2003-11-01 01:53:53 +000095 $(TOP)/src/date.c \
drh71eb93e2001-09-28 01:34:43 +000096 $(TOP)/src/delete.c \
97 $(TOP)/src/expr.c \
drhdc04c582002-02-24 01:55:15 +000098 $(TOP)/src/func.c \
drh71eb93e2001-09-28 01:34:43 +000099 $(TOP)/src/hash.c \
100 $(TOP)/src/hash.h \
101 $(TOP)/src/insert.c \
danielk1977c7b60172007-08-22 11:22:03 +0000102 $(TOP)/src/journal.c \
drh014ac192004-06-01 01:45:11 +0000103 $(TOP)/src/legacy.c \
drh1e397f82006-06-08 15:28:43 +0000104 $(TOP)/src/loadext.c \
drh71eb93e2001-09-28 01:34:43 +0000105 $(TOP)/src/main.c \
drha3152892007-05-05 11:48:52 +0000106 $(TOP)/src/malloc.c \
drh4c3645c2007-08-15 17:07:57 +0000107 $(TOP)/src/mem1.c \
108 $(TOP)/src/mem2.c \
drh90f6a5b2007-08-15 13:04:54 +0000109 $(TOP)/src/mutex.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000110 $(TOP)/src/mutex.h \
drh437b9012007-08-28 16:34:42 +0000111 $(TOP)/src/mutex_os2.c \
112 $(TOP)/src/mutex_unix.c \
113 $(TOP)/src/mutex_w32.c \
drh054889e2005-11-30 03:20:31 +0000114 $(TOP)/src/os.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000115 $(TOP)/src/os.h \
116 $(TOP)/src/os_common.h \
drh60a1e4b2006-06-03 18:02:15 +0000117 $(TOP)/src/os_os2.c \
drhbbd42a62004-05-22 17:41:58 +0000118 $(TOP)/src/os_unix.c \
119 $(TOP)/src/os_win.c \
drh71eb93e2001-09-28 01:34:43 +0000120 $(TOP)/src/pager.c \
121 $(TOP)/src/pager.h \
122 $(TOP)/src/parse.y \
drhc11d4f92003-04-06 21:08:24 +0000123 $(TOP)/src/pragma.c \
danielk1977fa256a32005-05-25 04:11:56 +0000124 $(TOP)/src/prepare.c \
drh71eb93e2001-09-28 01:34:43 +0000125 $(TOP)/src/printf.c \
126 $(TOP)/src/random.c \
127 $(TOP)/src/select.c \
128 $(TOP)/src/shell.c \
129 $(TOP)/src/sqlite.h.in \
drhde087bd2007-02-23 03:00:44 +0000130 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000131 $(TOP)/src/sqliteInt.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000132 $(TOP)/src/sqliteLimit.h \
drh71eb93e2001-09-28 01:34:43 +0000133 $(TOP)/src/table.c \
134 $(TOP)/src/tclsqlite.c \
135 $(TOP)/src/tokenize.c \
drhdc379452002-05-15 12:45:43 +0000136 $(TOP)/src/trigger.c \
drh1bbf5ee2004-05-11 01:18:24 +0000137 $(TOP)/src/utf.c \
drh71eb93e2001-09-28 01:34:43 +0000138 $(TOP)/src/update.c \
139 $(TOP)/src/util.c \
drhe1051c62003-04-06 20:52:32 +0000140 $(TOP)/src/vacuum.c \
drh71eb93e2001-09-28 01:34:43 +0000141 $(TOP)/src/vdbe.c \
142 $(TOP)/src/vdbe.h \
drheb2e1762004-05-27 01:53:56 +0000143 $(TOP)/src/vdbeapi.c \
drh9a324642003-09-06 20:12:01 +0000144 $(TOP)/src/vdbeaux.c \
danielk1977b4e9af92007-05-01 17:49:49 +0000145 $(TOP)/src/vdbeblob.c \
drha01f79d2005-07-08 13:07:59 +0000146 $(TOP)/src/vdbefifo.c \
drheb2e1762004-05-27 01:53:56 +0000147 $(TOP)/src/vdbemem.c \
drh9a324642003-09-06 20:12:01 +0000148 $(TOP)/src/vdbeInt.h \
drhb9bb7c12006-06-11 23:41:55 +0000149 $(TOP)/src/vtab.c \
drh71eb93e2001-09-28 01:34:43 +0000150 $(TOP)/src/where.c
151
drh0c979402006-10-03 19:12:32 +0000152# Source code for extensions
153#
154SRC += \
155 $(TOP)/ext/fts1/fts1.c \
156 $(TOP)/ext/fts1/fts1.h \
157 $(TOP)/ext/fts1/fts1_hash.c \
158 $(TOP)/ext/fts1/fts1_hash.h \
159 $(TOP)/ext/fts1/fts1_porter.c \
160 $(TOP)/ext/fts1/fts1_tokenizer.h \
161 $(TOP)/ext/fts1/fts1_tokenizer1.c
drhde087bd2007-02-23 03:00:44 +0000162SRC += \
163 $(TOP)/ext/fts2/fts2.c \
164 $(TOP)/ext/fts2/fts2.h \
165 $(TOP)/ext/fts2/fts2_hash.c \
166 $(TOP)/ext/fts2/fts2_hash.h \
drhd6e78a22007-07-20 13:42:26 +0000167 $(TOP)/ext/fts2/fts2_icu.c \
drhde087bd2007-02-23 03:00:44 +0000168 $(TOP)/ext/fts2/fts2_porter.c \
169 $(TOP)/ext/fts2/fts2_tokenizer.h \
drhd6e78a22007-07-20 13:42:26 +0000170 $(TOP)/ext/fts2/fts2_tokenizer.c \
drhde087bd2007-02-23 03:00:44 +0000171 $(TOP)/ext/fts2/fts2_tokenizer1.c
danielk197708ada512007-06-26 10:56:40 +0000172SRC += \
shess69c4ae22007-08-20 17:37:47 +0000173 $(TOP)/ext/fts3/fts3.c \
174 $(TOP)/ext/fts3/fts3.h \
175 $(TOP)/ext/fts3/fts3_hash.c \
176 $(TOP)/ext/fts3/fts3_hash.h \
177 $(TOP)/ext/fts3/fts3_icu.c \
178 $(TOP)/ext/fts3/fts3_porter.c \
179 $(TOP)/ext/fts3/fts3_tokenizer.h \
180 $(TOP)/ext/fts3/fts3_tokenizer.c \
181 $(TOP)/ext/fts3/fts3_tokenizer1.c
182SRC += \
danielk197708ada512007-06-26 10:56:40 +0000183 $(TOP)/ext/icu/icu.c
drhde087bd2007-02-23 03:00:44 +0000184
danielk197777b03a22007-06-20 08:49:05 +0000185
drhde087bd2007-02-23 03:00:44 +0000186# Generated source code files
187#
188SRC += \
189 keywordhash.h \
190 opcodes.c \
191 opcodes.h \
192 parse.c \
193 parse.h \
194 sqlite3.h
drh0c979402006-10-03 19:12:32 +0000195
196
drh71eb93e2001-09-28 01:34:43 +0000197# Source code to the test files.
198#
drhb6f41482004-05-14 01:58:11 +0000199TESTSRC = \
drh71eb93e2001-09-28 01:34:43 +0000200 $(TOP)/src/test1.c \
201 $(TOP)/src/test2.c \
202 $(TOP)/src/test3.c \
drha6064dc2003-12-19 02:52:05 +0000203 $(TOP)/src/test4.c \
danielk19774adee202004-05-08 08:23:19 +0000204 $(TOP)/src/test5.c \
drh9c06c952005-11-26 00:25:00 +0000205 $(TOP)/src/test6.c \
drh29c636b2006-01-09 23:40:25 +0000206 $(TOP)/src/test7.c \
drhb9bb7c12006-06-11 23:41:55 +0000207 $(TOP)/src/test8.c \
danielk1977a713f2c2007-03-29 12:19:11 +0000208 $(TOP)/src/test9.c \
drh1409be62006-08-23 20:07:20 +0000209 $(TOP)/src/test_autoext.c \
drh23669402006-01-09 17:29:52 +0000210 $(TOP)/src/test_async.c \
drh16a9b832007-05-05 18:39:25 +0000211 $(TOP)/src/test_btree.c \
drhc797d4d2007-05-08 01:08:49 +0000212 $(TOP)/src/test_config.c \
drh15926592007-04-06 15:02:13 +0000213 $(TOP)/src/test_hexio.c \
drh2f999a62007-08-15 19:16:43 +0000214 $(TOP)/src/test_malloc.c \
drh2d02a672006-01-25 15:55:37 +0000215 $(TOP)/src/test_md5.c \
danielk1977954ce992006-06-15 15:59:19 +0000216 $(TOP)/src/test_schema.c \
drh2d02a672006-01-25 15:55:37 +0000217 $(TOP)/src/test_server.c \
drh4be8b512006-06-13 23:51:34 +0000218 $(TOP)/src/test_tclvar.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000219
shess69c4ae22007-08-20 17:37:47 +0000220TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
221TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
drh71eb93e2001-09-28 01:34:43 +0000222
danielk1977e6a58a42007-08-31 17:42:48 +0000223TESTSRC2 = \
224 $(TOP)/src/attach.c $(TOP)/src/btree.c $(TOP)/src/build.c $(TOP)/src/date.c \
225 $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \
226 $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
227 $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
228 $(TOP)/src/printf.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
229 $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
230 $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c
231
drh71eb93e2001-09-28 01:34:43 +0000232# Header files used by all library source files.
233#
234HDR = \
drh71eb93e2001-09-28 01:34:43 +0000235 $(TOP)/src/btree.h \
drha3152892007-05-05 11:48:52 +0000236 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +0000237 $(TOP)/src/hash.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000238 keywordhash.h \
drh437b9012007-08-28 16:34:42 +0000239 $(TOP)/src/mutex.h \
drh8f619cc2002-09-08 00:04:50 +0000240 opcodes.h \
drh71eb93e2001-09-28 01:34:43 +0000241 $(TOP)/src/os.h \
drh014ac192004-06-01 01:45:11 +0000242 $(TOP)/src/os_common.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000243 $(TOP)/src/pager.h \
244 parse.h \
drh437b9012007-08-28 16:34:42 +0000245 sqlite3.h \
drh1e397f82006-06-08 15:28:43 +0000246 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000247 $(TOP)/src/sqliteInt.h \
drh437b9012007-08-28 16:34:42 +0000248 $(TOP)/src/sqliteLimit.h \
drh9a324642003-09-06 20:12:01 +0000249 $(TOP)/src/vdbe.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000250 $(TOP)/src/vdbeInt.h
drh71eb93e2001-09-28 01:34:43 +0000251
drh0c979402006-10-03 19:12:32 +0000252# Header files used by extensions
253#
drhde087bd2007-02-23 03:00:44 +0000254EXTHDR += \
drh0c979402006-10-03 19:12:32 +0000255 $(TOP)/ext/fts1/fts1.h \
256 $(TOP)/ext/fts1/fts1_hash.h \
257 $(TOP)/ext/fts1/fts1_tokenizer.h
drhde087bd2007-02-23 03:00:44 +0000258EXTHDR += \
259 $(TOP)/ext/fts2/fts2.h \
260 $(TOP)/ext/fts2/fts2_hash.h \
261 $(TOP)/ext/fts2/fts2_tokenizer.h
shess69c4ae22007-08-20 17:37:47 +0000262EXTHDR += \
263 $(TOP)/ext/fts3/fts3.h \
264 $(TOP)/ext/fts3/fts3_hash.h \
265 $(TOP)/ext/fts3/fts3_tokenizer.h
drh0c979402006-10-03 19:12:32 +0000266
drh71eb93e2001-09-28 01:34:43 +0000267# This is the default Makefile target. The objects listed here
268# are what get build when you type just "make" with no arguments.
269#
drh97903fe2005-05-24 20:19:57 +0000270all: sqlite3.h libsqlite3.a sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000271
272# Generate the file "last_change" which contains the date of change
273# of the most recently modified source code file
274#
275last_change: $(SRC)
drh0c07fb92006-06-27 20:05:23 +0000276 cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
drhf1878b42006-01-23 18:06:52 +0000277 | $(NAWK) '{print $$5,$$6}' >last_change
drh71eb93e2001-09-28 01:34:43 +0000278
drhd677b3d2007-08-20 22:48:41 +0000279libsqlite3.a: $(LIBOBJ)
280 $(AR) libsqlite3.a $(LIBOBJ)
drh1d482dd2004-05-31 18:23:07 +0000281 $(RANLIB) libsqlite3.a
drh71eb93e2001-09-28 01:34:43 +0000282
drh1d482dd2004-05-31 18:23:07 +0000283sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
danielk197777b03a22007-06-20 08:49:05 +0000284 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
danielk197708ada512007-06-26 10:56:40 +0000285 $(TOP)/src/shell.c \
drhf1878b42006-01-23 18:06:52 +0000286 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000287
danielk19774adee202004-05-08 08:23:19 +0000288objects: $(LIBOBJ_ORIG)
289
drh71eb93e2001-09-28 01:34:43 +0000290# This target creates a directory named "tsrc" and fills it with
291# copies of all of the C source code and header files needed to
292# build on the target system. Some of the C source code and header
293# files are automatically generated. This target takes care of
294# all that automatic generation.
295#
drhde087bd2007-02-23 03:00:44 +0000296target_source: $(SRC)
drh71eb93e2001-09-28 01:34:43 +0000297 rm -rf tsrc
298 mkdir tsrc
danielk1977e6a58a42007-08-31 17:42:48 +0000299 cp -f $(SRC) tsrc
drh71eb93e2001-09-28 01:34:43 +0000300 rm tsrc/sqlite.h.in tsrc/parse.y
drh71eb93e2001-09-28 01:34:43 +0000301
drh98495b42007-03-31 22:29:05 +0000302sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
303 tclsh $(TOP)/tool/mksqlite3c.tcl
drhbd08af42007-04-05 21:58:33 +0000304 cp sqlite3.c tclsqlite3.c
305 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
306 tclsh $(TOP)/tool/mksqlite3internalh.tcl
drh98495b42007-03-31 22:29:05 +0000307
drhd6e78a22007-07-20 13:42:26 +0000308fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
309 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
310
shess69c4ae22007-08-20 17:37:47 +0000311fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
312 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
313
drh71eb93e2001-09-28 01:34:43 +0000314# Rules to build the LEMON compiler generator
315#
316lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
317 $(BCC) -o lemon $(TOP)/tool/lemon.c
318 cp $(TOP)/tool/lempar.c .
319
danielk1977e6a58a42007-08-31 17:42:48 +0000320# Rules to build individual *.o files from files in the src directory.
drhbbd42a62004-05-22 17:41:58 +0000321#
danielk1977e6a58a42007-08-31 17:42:48 +0000322%.o: %.c $(HDR)
323 $(TCCX) -c $<
drhd0e4a6c2005-02-15 20:47:57 +0000324
danielk1977e6a58a42007-08-31 17:42:48 +0000325# Rules to build individual *.o files from generated *.c files. This
326# applies to:
327#
328# parse.o
329# opcodes.o
330#
331%.o: $(TOP)/src/%.c $(HDR)
332 $(TCCX) -c $<
drh9f18e8a2005-07-08 12:13:04 +0000333
danielk1977e6a58a42007-08-31 17:42:48 +0000334tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
335 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
drhbbd42a62004-05-22 17:41:58 +0000336
drhbbd42a62004-05-22 17:41:58 +0000337
drh900b31e2007-08-28 02:27:51 +0000338
danielk1977e6a58a42007-08-31 17:42:48 +0000339# Rules to build opcodes.c and opcodes.h
340#
drhb327f772004-10-06 15:03:57 +0000341opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
drh0c07fb92006-06-27 20:05:23 +0000342 sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
drhbbd42a62004-05-22 17:41:58 +0000343
drhf2bc0132004-10-04 13:19:23 +0000344opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
danielk1977e6a58a42007-08-31 17:42:48 +0000345 cat parse.h $(TOP)/src/vdbe.c |$(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
drhbbd42a62004-05-22 17:41:58 +0000346
drh054889e2005-11-30 03:20:31 +0000347
danielk1977e6a58a42007-08-31 17:42:48 +0000348# Rules to build parse.c and parse.h - the outputs of lemon.
349#
drhbbd42a62004-05-22 17:41:58 +0000350parse.h: parse.c
351
drhfa3b19e2005-11-24 22:22:29 +0000352parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
drhbbd42a62004-05-22 17:41:58 +0000353 cp $(TOP)/src/parse.y .
drh27d258a2004-10-30 20:23:09 +0000354 ./lemon $(OPTS) parse.y
drhfa3b19e2005-11-24 22:22:29 +0000355 mv parse.h parse.h.temp
356 awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
drh71eb93e2001-09-28 01:34:43 +0000357
drh1d482dd2004-05-31 18:23:07 +0000358sqlite3.h: $(TOP)/src/sqlite.h.in
drhbbd42a62004-05-22 17:41:58 +0000359 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
drhf1878b42006-01-23 18:06:52 +0000360 -e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' | $(NAWK) '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \
drh1d482dd2004-05-31 18:23:07 +0000361 $(TOP)/src/sqlite.h.in >sqlite3.h
drhbbd42a62004-05-22 17:41:58 +0000362
drh73b211a2005-01-18 04:00:42 +0000363keywordhash.h: $(TOP)/tool/mkkeywordhash.c
drh52fb6d72004-11-03 03:59:57 +0000364 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
drh73b211a2005-01-18 04:00:42 +0000365 ./mkkeywordhash >keywordhash.h
drh52fb6d72004-11-03 03:59:57 +0000366
drhbbd42a62004-05-22 17:41:58 +0000367
drhbbd42a62004-05-22 17:41:58 +0000368
danielk1977576d3db2007-06-25 14:28:48 +0000369# Rules to build the extension objects.
370#
371icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
372 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
373
374fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
375 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
376
377fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
378 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
379
380fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
381 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
382
383fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
384 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
385
386fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
387 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
388
389fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
390 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
391
shess69c4ae22007-08-20 17:37:47 +0000392fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
393 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
394
395fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
396 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
397
398fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
399 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
400
401fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
402 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
403
404fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
405 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
406
407fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
408 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
409
danielk1977576d3db2007-06-25 14:28:48 +0000410
drhbbd42a62004-05-22 17:41:58 +0000411# Rules for building test programs and for running tests
412#
drh1d482dd2004-05-31 18:23:07 +0000413tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
414 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
danielk1977bc6ada42004-06-30 08:20:16 +0000415 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000416
danielk1977e6a58a42007-08-31 17:42:48 +0000417
418# Rules to build the 'testfixture' application.
419#
420TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
421TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
422
423testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
424 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
425 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
426 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
427
428amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
429 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
430 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
431 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000432
drh9c06c952005-11-26 00:25:00 +0000433fulltest: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000434 ./testfixture$(EXE) $(TOP)/test/all.test
435
drh44548ec2007-06-18 12:22:43 +0000436soaktest: testfixture$(EXE) sqlite3$(EXE)
437 ./testfixture$(EXE) $(TOP)/test/all.test -soak 1
438
drh1d482dd2004-05-31 18:23:07 +0000439test: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000440 ./testfixture$(EXE) $(TOP)/test/quick.test
441
danielk1977e6a58a42007-08-31 17:42:48 +0000442sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
drh3e27c022004-07-23 00:01:38 +0000443 $(TOP)/tool/spaceanal.tcl
444 sed \
445 -e '/^#/d' \
446 -e 's,\\,\\\\,g' \
447 -e 's,",\\",g' \
448 -e 's,^,",' \
449 -e 's,$$,\\n",' \
450 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
danielk1977e6a58a42007-08-31 17:42:48 +0000451 $(TCCX) $(TCL_FLAGS) \
452 -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
453 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
454 -o sqlite3_analyzer$(EXE) \
455 $(LIBTCL) $(THREADLIB)
drh3e27c022004-07-23 00:01:38 +0000456
danielk197769e777f2006-06-14 10:38:02 +0000457TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
458$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
459 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
460
461extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
462 ./testfixture$(EXE) $(TOP)/test/loadext.test
463
danielk1977e6a58a42007-08-31 17:42:48 +0000464
drhbbd42a62004-05-22 17:41:58 +0000465# Rules used to build documentation
466#
danielk1977e6a58a42007-08-31 17:42:48 +0000467%.html: $(TOP)/www/%.tcl docdir last_change common.tcl
468 tclsh $< > $@
drh71eb93e2001-09-28 01:34:43 +0000469
danielk1977e6a58a42007-08-31 17:42:48 +0000470lang.html: $(TOP)/www/lang.tcl docdir
danielk1977cd45ab22004-11-19 11:59:23 +0000471 tclsh $(TOP)/www/lang.tcl doc >lang.html
drh71eb93e2001-09-28 01:34:43 +0000472
drh71eb93e2001-09-28 01:34:43 +0000473opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
474 tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
475
danielk1977e6a58a42007-08-31 17:42:48 +0000476capi3ref.html: $(TOP)/www/mkapidoc.tcl sqlite3.h
477 tclsh $(TOP)/www/mkapidoc.tcl <sqlite3.h >capi3ref.html
drhfbe43752002-08-14 00:08:12 +0000478
drh0e3c0832007-08-31 18:50:31 +0000479copyright-release.html: $(TOP)/www/copyright-release.html
480 cp $(TOP)/www/copyright-release.html .
481
danielk1977e6a58a42007-08-31 17:42:48 +0000482%: $(TOP)/www/%
483 cp $< $@
drh71eb93e2001-09-28 01:34:43 +0000484
485# Files to be published on the website.
486#
drh90ca9752001-09-28 17:47:14 +0000487DOC = \
drh71eb93e2001-09-28 01:34:43 +0000488 arch.html \
drhf8565822004-11-21 01:02:00 +0000489 autoinc.html \
drh71eb93e2001-09-28 01:34:43 +0000490 c_interface.html \
drh1d482dd2004-05-31 18:23:07 +0000491 capi3.html \
drh93db69e2004-06-01 01:22:37 +0000492 capi3ref.html \
drh1d482dd2004-05-31 18:23:07 +0000493 changes.html \
drhf8565822004-11-21 01:02:00 +0000494 compile.html \
drhd4acf192004-05-31 16:04:08 +0000495 copyright.html \
496 copyright-release.html \
497 copyright-release.pdf \
drh76800322002-08-13 20:45:39 +0000498 conflict.html \
drhc2774132002-08-15 13:45:17 +0000499 datatypes.html \
drh1d482dd2004-05-31 18:23:07 +0000500 datatype3.html \
drh9179fd92005-03-12 15:55:10 +0000501 different.html \
drhd4acf192004-05-31 16:04:08 +0000502 docs.html \
drhbbd42a62004-05-22 17:41:58 +0000503 download.html \
504 faq.html \
drh96f45312002-09-02 14:11:02 +0000505 fileformat.html \
drhbbd42a62004-05-22 17:41:58 +0000506 formatchng.html \
507 index.html \
drhb0e64f32007-06-09 09:53:51 +0000508 limits.html \
drhbbd42a62004-05-22 17:41:58 +0000509 lang.html \
drh52619df2004-06-11 17:48:02 +0000510 lockingv3.html \
drhbbd42a62004-05-22 17:41:58 +0000511 mingw.html \
512 nulls.html \
drh7b93ed32004-06-16 03:02:00 +0000513 oldnews.html \
drhbbd42a62004-05-22 17:41:58 +0000514 omitted.html \
515 opcode.html \
drh8897f6f2005-08-30 22:44:29 +0000516 optimizer.html \
drhf6ac6572005-08-31 01:49:59 +0000517 optoverview.html \
danielk19772a03c3a2004-11-10 05:48:57 +0000518 pragma.html \
drhbbd42a62004-05-22 17:41:58 +0000519 quickstart.html \
danielk1977da184232006-01-05 11:34:32 +0000520 sharedcache.html \
drhbbd42a62004-05-22 17:41:58 +0000521 speed.html \
522 sqlite.html \
drhd4acf192004-05-31 16:04:08 +0000523 support.html \
drhbbd42a62004-05-22 17:41:58 +0000524 tclsqlite.html \
drha2854222004-06-17 19:04:17 +0000525 vdbe.html \
drhe4254642005-01-21 18:19:27 +0000526 version3.html \
drh50d3f902007-08-27 21:10:36 +0000527 whentouse.html \
528 34to35.html
drh71eb93e2001-09-28 01:34:43 +0000529
danielk1977e6a58a42007-08-31 17:42:48 +0000530docdir:
drh90ca9752001-09-28 17:47:14 +0000531 mkdir -p doc
danielk1977e6a58a42007-08-31 17:42:48 +0000532
533doc: common.tcl $(DOC) docdir
drh90ca9752001-09-28 17:47:14 +0000534 mv $(DOC) doc
drh8897f6f2005-08-30 22:44:29 +0000535 cp $(TOP)/www/*.gif $(TOP)/art/*.gif doc
drh71eb93e2001-09-28 01:34:43 +0000536
drhbbd42a62004-05-22 17:41:58 +0000537# Standard install and cleanup targets
538#
drh1d482dd2004-05-31 18:23:07 +0000539install: sqlite3 libsqlite3.a sqlite3.h
540 mv sqlite3 /usr/bin
541 mv libsqlite3.a /usr/lib
542 mv sqlite3.h /usr/include
drh71eb93e2001-09-28 01:34:43 +0000543
544clean:
drh9c06c952005-11-26 00:25:00 +0000545 rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.*
drh73b211a2005-01-18 04:00:42 +0000546 rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
drh71eb93e2001-09-28 01:34:43 +0000547 rm -f $(PUBLISH)
548 rm -f *.da *.bb *.bbg gmon.out
549 rm -rf tsrc
drhf80ad492006-09-02 22:14:59 +0000550 rm -f testloadext.dll libtestloadext.so