blob: a2b23ff94b75ce99492712d5f7120c18c784c090 [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 \
danielk1977b61c16d2007-09-14 16:19:27 +0000216 $(TOP)/src/test_onefile.c \
danielk1977954ce992006-06-15 15:59:19 +0000217 $(TOP)/src/test_schema.c \
drh2d02a672006-01-25 15:55:37 +0000218 $(TOP)/src/test_server.c \
drh4be8b512006-06-13 23:51:34 +0000219 $(TOP)/src/test_tclvar.c \
danielk197744918fa2007-09-07 11:29:25 +0000220 $(TOP)/src/test_thread.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000221
shess69c4ae22007-08-20 17:37:47 +0000222TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
223TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
drh71eb93e2001-09-28 01:34:43 +0000224
danielk1977e6a58a42007-08-31 17:42:48 +0000225TESTSRC2 = \
226 $(TOP)/src/attach.c $(TOP)/src/btree.c $(TOP)/src/build.c $(TOP)/src/date.c \
227 $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \
228 $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
229 $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
230 $(TOP)/src/printf.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
231 $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
232 $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c
233
drh71eb93e2001-09-28 01:34:43 +0000234# Header files used by all library source files.
235#
236HDR = \
drh71eb93e2001-09-28 01:34:43 +0000237 $(TOP)/src/btree.h \
drha3152892007-05-05 11:48:52 +0000238 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +0000239 $(TOP)/src/hash.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000240 keywordhash.h \
drh437b9012007-08-28 16:34:42 +0000241 $(TOP)/src/mutex.h \
drh8f619cc2002-09-08 00:04:50 +0000242 opcodes.h \
drh71eb93e2001-09-28 01:34:43 +0000243 $(TOP)/src/os.h \
drh014ac192004-06-01 01:45:11 +0000244 $(TOP)/src/os_common.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000245 $(TOP)/src/pager.h \
246 parse.h \
drh437b9012007-08-28 16:34:42 +0000247 sqlite3.h \
drh1e397f82006-06-08 15:28:43 +0000248 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000249 $(TOP)/src/sqliteInt.h \
drh437b9012007-08-28 16:34:42 +0000250 $(TOP)/src/sqliteLimit.h \
drh9a324642003-09-06 20:12:01 +0000251 $(TOP)/src/vdbe.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000252 $(TOP)/src/vdbeInt.h
drh71eb93e2001-09-28 01:34:43 +0000253
drh0c979402006-10-03 19:12:32 +0000254# Header files used by extensions
255#
drhde087bd2007-02-23 03:00:44 +0000256EXTHDR += \
drh0c979402006-10-03 19:12:32 +0000257 $(TOP)/ext/fts1/fts1.h \
258 $(TOP)/ext/fts1/fts1_hash.h \
259 $(TOP)/ext/fts1/fts1_tokenizer.h
drhde087bd2007-02-23 03:00:44 +0000260EXTHDR += \
261 $(TOP)/ext/fts2/fts2.h \
262 $(TOP)/ext/fts2/fts2_hash.h \
263 $(TOP)/ext/fts2/fts2_tokenizer.h
shess69c4ae22007-08-20 17:37:47 +0000264EXTHDR += \
265 $(TOP)/ext/fts3/fts3.h \
266 $(TOP)/ext/fts3/fts3_hash.h \
267 $(TOP)/ext/fts3/fts3_tokenizer.h
drh0c979402006-10-03 19:12:32 +0000268
drh71eb93e2001-09-28 01:34:43 +0000269# This is the default Makefile target. The objects listed here
270# are what get build when you type just "make" with no arguments.
271#
drh97903fe2005-05-24 20:19:57 +0000272all: sqlite3.h libsqlite3.a sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000273
274# Generate the file "last_change" which contains the date of change
275# of the most recently modified source code file
276#
277last_change: $(SRC)
drh0c07fb92006-06-27 20:05:23 +0000278 cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
drhf1878b42006-01-23 18:06:52 +0000279 | $(NAWK) '{print $$5,$$6}' >last_change
drh71eb93e2001-09-28 01:34:43 +0000280
drhd677b3d2007-08-20 22:48:41 +0000281libsqlite3.a: $(LIBOBJ)
282 $(AR) libsqlite3.a $(LIBOBJ)
drh1d482dd2004-05-31 18:23:07 +0000283 $(RANLIB) libsqlite3.a
drh71eb93e2001-09-28 01:34:43 +0000284
drh1d482dd2004-05-31 18:23:07 +0000285sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
danielk197777b03a22007-06-20 08:49:05 +0000286 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
danielk197708ada512007-06-26 10:56:40 +0000287 $(TOP)/src/shell.c \
drhf1878b42006-01-23 18:06:52 +0000288 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000289
danielk19774adee202004-05-08 08:23:19 +0000290objects: $(LIBOBJ_ORIG)
291
drh71eb93e2001-09-28 01:34:43 +0000292# This target creates a directory named "tsrc" and fills it with
293# copies of all of the C source code and header files needed to
294# build on the target system. Some of the C source code and header
295# files are automatically generated. This target takes care of
296# all that automatic generation.
297#
drhde087bd2007-02-23 03:00:44 +0000298target_source: $(SRC)
drh71eb93e2001-09-28 01:34:43 +0000299 rm -rf tsrc
300 mkdir tsrc
danielk1977e6a58a42007-08-31 17:42:48 +0000301 cp -f $(SRC) tsrc
drh71eb93e2001-09-28 01:34:43 +0000302 rm tsrc/sqlite.h.in tsrc/parse.y
drh71eb93e2001-09-28 01:34:43 +0000303
drh98495b42007-03-31 22:29:05 +0000304sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
305 tclsh $(TOP)/tool/mksqlite3c.tcl
drhbd08af42007-04-05 21:58:33 +0000306 cp sqlite3.c tclsqlite3.c
307 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
drh98495b42007-03-31 22:29:05 +0000308
drhd6e78a22007-07-20 13:42:26 +0000309fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
310 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
311
shess69c4ae22007-08-20 17:37:47 +0000312fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
313 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
314
drh71eb93e2001-09-28 01:34:43 +0000315# Rules to build the LEMON compiler generator
316#
317lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
318 $(BCC) -o lemon $(TOP)/tool/lemon.c
319 cp $(TOP)/tool/lempar.c .
320
danielk1977e6a58a42007-08-31 17:42:48 +0000321# Rules to build individual *.o files from files in the src directory.
drhbbd42a62004-05-22 17:41:58 +0000322#
danielk1977e6a58a42007-08-31 17:42:48 +0000323%.o: %.c $(HDR)
324 $(TCCX) -c $<
drhd0e4a6c2005-02-15 20:47:57 +0000325
danielk1977e6a58a42007-08-31 17:42:48 +0000326# Rules to build individual *.o files from generated *.c files. This
327# applies to:
328#
329# parse.o
330# opcodes.o
331#
332%.o: $(TOP)/src/%.c $(HDR)
333 $(TCCX) -c $<
drh9f18e8a2005-07-08 12:13:04 +0000334
danielk1977e6a58a42007-08-31 17:42:48 +0000335tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
336 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
drhbbd42a62004-05-22 17:41:58 +0000337
drhbbd42a62004-05-22 17:41:58 +0000338
drh900b31e2007-08-28 02:27:51 +0000339
danielk1977e6a58a42007-08-31 17:42:48 +0000340# Rules to build opcodes.c and opcodes.h
341#
drhb327f772004-10-06 15:03:57 +0000342opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
drh0c07fb92006-06-27 20:05:23 +0000343 sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
drhbbd42a62004-05-22 17:41:58 +0000344
drhf2bc0132004-10-04 13:19:23 +0000345opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
danielk1977e6a58a42007-08-31 17:42:48 +0000346 cat parse.h $(TOP)/src/vdbe.c |$(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
drhbbd42a62004-05-22 17:41:58 +0000347
drh054889e2005-11-30 03:20:31 +0000348
danielk1977e6a58a42007-08-31 17:42:48 +0000349# Rules to build parse.c and parse.h - the outputs of lemon.
350#
drhbbd42a62004-05-22 17:41:58 +0000351parse.h: parse.c
352
drhfa3b19e2005-11-24 22:22:29 +0000353parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
drhbbd42a62004-05-22 17:41:58 +0000354 cp $(TOP)/src/parse.y .
drh27d258a2004-10-30 20:23:09 +0000355 ./lemon $(OPTS) parse.y
drhfa3b19e2005-11-24 22:22:29 +0000356 mv parse.h parse.h.temp
357 awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
drh71eb93e2001-09-28 01:34:43 +0000358
drh1d482dd2004-05-31 18:23:07 +0000359sqlite3.h: $(TOP)/src/sqlite.h.in
drhbbd42a62004-05-22 17:41:58 +0000360 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
drhf1878b42006-01-23 18:06:52 +0000361 -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 +0000362 $(TOP)/src/sqlite.h.in >sqlite3.h
drhbbd42a62004-05-22 17:41:58 +0000363
drh73b211a2005-01-18 04:00:42 +0000364keywordhash.h: $(TOP)/tool/mkkeywordhash.c
drh52fb6d72004-11-03 03:59:57 +0000365 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
drh73b211a2005-01-18 04:00:42 +0000366 ./mkkeywordhash >keywordhash.h
drh52fb6d72004-11-03 03:59:57 +0000367
drhbbd42a62004-05-22 17:41:58 +0000368
drhbbd42a62004-05-22 17:41:58 +0000369
danielk1977576d3db2007-06-25 14:28:48 +0000370# Rules to build the extension objects.
371#
372icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
373 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
374
375fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
376 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
377
378fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
379 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
380
381fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
382 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
383
384fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
385 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
386
387fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
388 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
389
390fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
391 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
392
shess69c4ae22007-08-20 17:37:47 +0000393fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
394 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
395
396fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
397 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
398
399fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
400 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
401
402fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
403 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
404
405fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
406 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
407
408fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
409 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
410
danielk1977576d3db2007-06-25 14:28:48 +0000411
drhbbd42a62004-05-22 17:41:58 +0000412# Rules for building test programs and for running tests
413#
drh1d482dd2004-05-31 18:23:07 +0000414tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
415 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
danielk1977bc6ada42004-06-30 08:20:16 +0000416 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000417
danielk1977e6a58a42007-08-31 17:42:48 +0000418
419# Rules to build the 'testfixture' application.
420#
421TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
422TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
423
424testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
425 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
426 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
427 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
428
429amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
430 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
431 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
432 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000433
drh9c06c952005-11-26 00:25:00 +0000434fulltest: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000435 ./testfixture$(EXE) $(TOP)/test/all.test
436
drh44548ec2007-06-18 12:22:43 +0000437soaktest: testfixture$(EXE) sqlite3$(EXE)
438 ./testfixture$(EXE) $(TOP)/test/all.test -soak 1
439
drh1d482dd2004-05-31 18:23:07 +0000440test: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000441 ./testfixture$(EXE) $(TOP)/test/quick.test
442
danielk1977e6a58a42007-08-31 17:42:48 +0000443sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
drh3e27c022004-07-23 00:01:38 +0000444 $(TOP)/tool/spaceanal.tcl
445 sed \
446 -e '/^#/d' \
447 -e 's,\\,\\\\,g' \
448 -e 's,",\\",g' \
449 -e 's,^,",' \
450 -e 's,$$,\\n",' \
451 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
danielk1977e6a58a42007-08-31 17:42:48 +0000452 $(TCCX) $(TCL_FLAGS) \
453 -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
454 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
455 -o sqlite3_analyzer$(EXE) \
456 $(LIBTCL) $(THREADLIB)
drh3e27c022004-07-23 00:01:38 +0000457
danielk197769e777f2006-06-14 10:38:02 +0000458TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
459$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
460 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
461
462extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
463 ./testfixture$(EXE) $(TOP)/test/loadext.test
464
danielk1977e6a58a42007-08-31 17:42:48 +0000465
drhbbd42a62004-05-22 17:41:58 +0000466# Rules used to build documentation
467#
danielk1977e6a58a42007-08-31 17:42:48 +0000468%.html: $(TOP)/www/%.tcl docdir last_change common.tcl
469 tclsh $< > $@
drh71eb93e2001-09-28 01:34:43 +0000470
danielk1977e6a58a42007-08-31 17:42:48 +0000471lang.html: $(TOP)/www/lang.tcl docdir
danielk1977cd45ab22004-11-19 11:59:23 +0000472 tclsh $(TOP)/www/lang.tcl doc >lang.html
drh71eb93e2001-09-28 01:34:43 +0000473
drh71eb93e2001-09-28 01:34:43 +0000474opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
475 tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
476
danielk1977e6a58a42007-08-31 17:42:48 +0000477capi3ref.html: $(TOP)/www/mkapidoc.tcl sqlite3.h
478 tclsh $(TOP)/www/mkapidoc.tcl <sqlite3.h >capi3ref.html
drhfbe43752002-08-14 00:08:12 +0000479
drh0e3c0832007-08-31 18:50:31 +0000480copyright-release.html: $(TOP)/www/copyright-release.html
481 cp $(TOP)/www/copyright-release.html .
482
danielk1977e6a58a42007-08-31 17:42:48 +0000483%: $(TOP)/www/%
484 cp $< $@
drh71eb93e2001-09-28 01:34:43 +0000485
486# Files to be published on the website.
487#
drh90ca9752001-09-28 17:47:14 +0000488DOC = \
drh71eb93e2001-09-28 01:34:43 +0000489 arch.html \
drhf8565822004-11-21 01:02:00 +0000490 autoinc.html \
drh71eb93e2001-09-28 01:34:43 +0000491 c_interface.html \
drh1d482dd2004-05-31 18:23:07 +0000492 capi3.html \
drh93db69e2004-06-01 01:22:37 +0000493 capi3ref.html \
drh1d482dd2004-05-31 18:23:07 +0000494 changes.html \
drhf8565822004-11-21 01:02:00 +0000495 compile.html \
drhd4acf192004-05-31 16:04:08 +0000496 copyright.html \
497 copyright-release.html \
498 copyright-release.pdf \
drh76800322002-08-13 20:45:39 +0000499 conflict.html \
drhc2774132002-08-15 13:45:17 +0000500 datatypes.html \
drh1d482dd2004-05-31 18:23:07 +0000501 datatype3.html \
drh9179fd92005-03-12 15:55:10 +0000502 different.html \
drhd4acf192004-05-31 16:04:08 +0000503 docs.html \
drhbbd42a62004-05-22 17:41:58 +0000504 download.html \
505 faq.html \
drh96f45312002-09-02 14:11:02 +0000506 fileformat.html \
drhbbd42a62004-05-22 17:41:58 +0000507 formatchng.html \
508 index.html \
drhb0e64f32007-06-09 09:53:51 +0000509 limits.html \
drhbbd42a62004-05-22 17:41:58 +0000510 lang.html \
drh52619df2004-06-11 17:48:02 +0000511 lockingv3.html \
drhbbd42a62004-05-22 17:41:58 +0000512 mingw.html \
513 nulls.html \
drh7b93ed32004-06-16 03:02:00 +0000514 oldnews.html \
drhbbd42a62004-05-22 17:41:58 +0000515 omitted.html \
516 opcode.html \
drh8897f6f2005-08-30 22:44:29 +0000517 optimizer.html \
drhf6ac6572005-08-31 01:49:59 +0000518 optoverview.html \
danielk19772a03c3a2004-11-10 05:48:57 +0000519 pragma.html \
drhbbd42a62004-05-22 17:41:58 +0000520 quickstart.html \
danielk1977da184232006-01-05 11:34:32 +0000521 sharedcache.html \
drhbbd42a62004-05-22 17:41:58 +0000522 speed.html \
523 sqlite.html \
drhd4acf192004-05-31 16:04:08 +0000524 support.html \
drhbbd42a62004-05-22 17:41:58 +0000525 tclsqlite.html \
drha2854222004-06-17 19:04:17 +0000526 vdbe.html \
drhe4254642005-01-21 18:19:27 +0000527 version3.html \
drh50d3f902007-08-27 21:10:36 +0000528 whentouse.html \
529 34to35.html
drh71eb93e2001-09-28 01:34:43 +0000530
danielk1977e6a58a42007-08-31 17:42:48 +0000531docdir:
drh90ca9752001-09-28 17:47:14 +0000532 mkdir -p doc
danielk1977e6a58a42007-08-31 17:42:48 +0000533
534doc: common.tcl $(DOC) docdir
drh90ca9752001-09-28 17:47:14 +0000535 mv $(DOC) doc
drh8897f6f2005-08-30 22:44:29 +0000536 cp $(TOP)/www/*.gif $(TOP)/art/*.gif doc
drh71eb93e2001-09-28 01:34:43 +0000537
drhbbd42a62004-05-22 17:41:58 +0000538# Standard install and cleanup targets
539#
drh1d482dd2004-05-31 18:23:07 +0000540install: sqlite3 libsqlite3.a sqlite3.h
541 mv sqlite3 /usr/bin
542 mv libsqlite3.a /usr/lib
543 mv sqlite3.h /usr/include
drh71eb93e2001-09-28 01:34:43 +0000544
545clean:
drh9c06c952005-11-26 00:25:00 +0000546 rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.*
drh73b211a2005-01-18 04:00:42 +0000547 rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
drh71eb93e2001-09-28 01:34:43 +0000548 rm -f $(PUBLISH)
549 rm -f *.da *.bb *.bbg gmon.out
550 rm -rf tsrc
drhf80ad492006-09-02 22:14:59 +0000551 rm -f testloadext.dll libtestloadext.so