blob: cad25184e4fa6d45e5a075463057bd5a721fa576 [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 \
drh9c7a60d2007-10-19 17:47:24 +000054 main.o malloc.o mem1.o mem2.o mem3.o mutex.o mutex_os2.o \
drh437b9012007-08-28 16:34:42 +000055 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 \
chw65d3c132007-11-12 21:09:10 +000058 select.o table.o $(TCLOBJ) tokenize.o trigger.o \
drh38f82712004-06-18 17:10:16 +000059 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 \
drh9c7a60d2007-10-19 17:47:24 +0000109 $(TOP)/src/mem3.c \
drh90f6a5b2007-08-15 13:04:54 +0000110 $(TOP)/src/mutex.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000111 $(TOP)/src/mutex.h \
drh437b9012007-08-28 16:34:42 +0000112 $(TOP)/src/mutex_os2.c \
113 $(TOP)/src/mutex_unix.c \
114 $(TOP)/src/mutex_w32.c \
drh054889e2005-11-30 03:20:31 +0000115 $(TOP)/src/os.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000116 $(TOP)/src/os.h \
117 $(TOP)/src/os_common.h \
drh60a1e4b2006-06-03 18:02:15 +0000118 $(TOP)/src/os_os2.c \
drhbbd42a62004-05-22 17:41:58 +0000119 $(TOP)/src/os_unix.c \
120 $(TOP)/src/os_win.c \
drh71eb93e2001-09-28 01:34:43 +0000121 $(TOP)/src/pager.c \
122 $(TOP)/src/pager.h \
123 $(TOP)/src/parse.y \
drhc11d4f92003-04-06 21:08:24 +0000124 $(TOP)/src/pragma.c \
danielk1977fa256a32005-05-25 04:11:56 +0000125 $(TOP)/src/prepare.c \
drh71eb93e2001-09-28 01:34:43 +0000126 $(TOP)/src/printf.c \
127 $(TOP)/src/random.c \
128 $(TOP)/src/select.c \
129 $(TOP)/src/shell.c \
130 $(TOP)/src/sqlite.h.in \
drhde087bd2007-02-23 03:00:44 +0000131 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000132 $(TOP)/src/sqliteInt.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000133 $(TOP)/src/sqliteLimit.h \
drh71eb93e2001-09-28 01:34:43 +0000134 $(TOP)/src/table.c \
135 $(TOP)/src/tclsqlite.c \
136 $(TOP)/src/tokenize.c \
drhdc379452002-05-15 12:45:43 +0000137 $(TOP)/src/trigger.c \
drh1bbf5ee2004-05-11 01:18:24 +0000138 $(TOP)/src/utf.c \
drh71eb93e2001-09-28 01:34:43 +0000139 $(TOP)/src/update.c \
140 $(TOP)/src/util.c \
drhe1051c62003-04-06 20:52:32 +0000141 $(TOP)/src/vacuum.c \
drh71eb93e2001-09-28 01:34:43 +0000142 $(TOP)/src/vdbe.c \
143 $(TOP)/src/vdbe.h \
drheb2e1762004-05-27 01:53:56 +0000144 $(TOP)/src/vdbeapi.c \
drh9a324642003-09-06 20:12:01 +0000145 $(TOP)/src/vdbeaux.c \
danielk1977b4e9af92007-05-01 17:49:49 +0000146 $(TOP)/src/vdbeblob.c \
drha01f79d2005-07-08 13:07:59 +0000147 $(TOP)/src/vdbefifo.c \
drheb2e1762004-05-27 01:53:56 +0000148 $(TOP)/src/vdbemem.c \
drh9a324642003-09-06 20:12:01 +0000149 $(TOP)/src/vdbeInt.h \
drhb9bb7c12006-06-11 23:41:55 +0000150 $(TOP)/src/vtab.c \
drh71eb93e2001-09-28 01:34:43 +0000151 $(TOP)/src/where.c
152
drh0c979402006-10-03 19:12:32 +0000153# Source code for extensions
154#
155SRC += \
156 $(TOP)/ext/fts1/fts1.c \
157 $(TOP)/ext/fts1/fts1.h \
158 $(TOP)/ext/fts1/fts1_hash.c \
159 $(TOP)/ext/fts1/fts1_hash.h \
160 $(TOP)/ext/fts1/fts1_porter.c \
161 $(TOP)/ext/fts1/fts1_tokenizer.h \
162 $(TOP)/ext/fts1/fts1_tokenizer1.c
drhde087bd2007-02-23 03:00:44 +0000163SRC += \
164 $(TOP)/ext/fts2/fts2.c \
165 $(TOP)/ext/fts2/fts2.h \
166 $(TOP)/ext/fts2/fts2_hash.c \
167 $(TOP)/ext/fts2/fts2_hash.h \
drhd6e78a22007-07-20 13:42:26 +0000168 $(TOP)/ext/fts2/fts2_icu.c \
drhde087bd2007-02-23 03:00:44 +0000169 $(TOP)/ext/fts2/fts2_porter.c \
170 $(TOP)/ext/fts2/fts2_tokenizer.h \
drhd6e78a22007-07-20 13:42:26 +0000171 $(TOP)/ext/fts2/fts2_tokenizer.c \
drhde087bd2007-02-23 03:00:44 +0000172 $(TOP)/ext/fts2/fts2_tokenizer1.c
danielk197708ada512007-06-26 10:56:40 +0000173SRC += \
shess69c4ae22007-08-20 17:37:47 +0000174 $(TOP)/ext/fts3/fts3.c \
175 $(TOP)/ext/fts3/fts3.h \
176 $(TOP)/ext/fts3/fts3_hash.c \
177 $(TOP)/ext/fts3/fts3_hash.h \
178 $(TOP)/ext/fts3/fts3_icu.c \
179 $(TOP)/ext/fts3/fts3_porter.c \
180 $(TOP)/ext/fts3/fts3_tokenizer.h \
181 $(TOP)/ext/fts3/fts3_tokenizer.c \
182 $(TOP)/ext/fts3/fts3_tokenizer1.c
183SRC += \
danielk197708ada512007-06-26 10:56:40 +0000184 $(TOP)/ext/icu/icu.c
drhde087bd2007-02-23 03:00:44 +0000185
danielk197777b03a22007-06-20 08:49:05 +0000186
drhde087bd2007-02-23 03:00:44 +0000187# Generated source code files
188#
189SRC += \
190 keywordhash.h \
191 opcodes.c \
192 opcodes.h \
193 parse.c \
194 parse.h \
195 sqlite3.h
drh0c979402006-10-03 19:12:32 +0000196
197
drh71eb93e2001-09-28 01:34:43 +0000198# Source code to the test files.
199#
drhb6f41482004-05-14 01:58:11 +0000200TESTSRC = \
drh71eb93e2001-09-28 01:34:43 +0000201 $(TOP)/src/test1.c \
202 $(TOP)/src/test2.c \
203 $(TOP)/src/test3.c \
drha6064dc2003-12-19 02:52:05 +0000204 $(TOP)/src/test4.c \
danielk19774adee202004-05-08 08:23:19 +0000205 $(TOP)/src/test5.c \
drh9c06c952005-11-26 00:25:00 +0000206 $(TOP)/src/test6.c \
drh29c636b2006-01-09 23:40:25 +0000207 $(TOP)/src/test7.c \
drhb9bb7c12006-06-11 23:41:55 +0000208 $(TOP)/src/test8.c \
danielk1977a713f2c2007-03-29 12:19:11 +0000209 $(TOP)/src/test9.c \
drh1409be62006-08-23 20:07:20 +0000210 $(TOP)/src/test_autoext.c \
drh23669402006-01-09 17:29:52 +0000211 $(TOP)/src/test_async.c \
drh16a9b832007-05-05 18:39:25 +0000212 $(TOP)/src/test_btree.c \
drhc797d4d2007-05-08 01:08:49 +0000213 $(TOP)/src/test_config.c \
drh15926592007-04-06 15:02:13 +0000214 $(TOP)/src/test_hexio.c \
drh2f999a62007-08-15 19:16:43 +0000215 $(TOP)/src/test_malloc.c \
drh2d02a672006-01-25 15:55:37 +0000216 $(TOP)/src/test_md5.c \
danielk1977b61c16d2007-09-14 16:19:27 +0000217 $(TOP)/src/test_onefile.c \
danielk1977954ce992006-06-15 15:59:19 +0000218 $(TOP)/src/test_schema.c \
drh2d02a672006-01-25 15:55:37 +0000219 $(TOP)/src/test_server.c \
drh4be8b512006-06-13 23:51:34 +0000220 $(TOP)/src/test_tclvar.c \
danielk197744918fa2007-09-07 11:29:25 +0000221 $(TOP)/src/test_thread.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000222
shess69c4ae22007-08-20 17:37:47 +0000223TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
224TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
drh71eb93e2001-09-28 01:34:43 +0000225
danielk1977e6a58a42007-08-31 17:42:48 +0000226TESTSRC2 = \
227 $(TOP)/src/attach.c $(TOP)/src/btree.c $(TOP)/src/build.c $(TOP)/src/date.c \
228 $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \
229 $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
230 $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
231 $(TOP)/src/printf.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
232 $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
233 $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c
234
drh71eb93e2001-09-28 01:34:43 +0000235# Header files used by all library source files.
236#
237HDR = \
drh71eb93e2001-09-28 01:34:43 +0000238 $(TOP)/src/btree.h \
drha3152892007-05-05 11:48:52 +0000239 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +0000240 $(TOP)/src/hash.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000241 keywordhash.h \
drh437b9012007-08-28 16:34:42 +0000242 $(TOP)/src/mutex.h \
drh8f619cc2002-09-08 00:04:50 +0000243 opcodes.h \
drh71eb93e2001-09-28 01:34:43 +0000244 $(TOP)/src/os.h \
drh014ac192004-06-01 01:45:11 +0000245 $(TOP)/src/os_common.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000246 $(TOP)/src/pager.h \
247 parse.h \
drh437b9012007-08-28 16:34:42 +0000248 sqlite3.h \
drh1e397f82006-06-08 15:28:43 +0000249 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000250 $(TOP)/src/sqliteInt.h \
drh437b9012007-08-28 16:34:42 +0000251 $(TOP)/src/sqliteLimit.h \
drh9a324642003-09-06 20:12:01 +0000252 $(TOP)/src/vdbe.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000253 $(TOP)/src/vdbeInt.h
drh71eb93e2001-09-28 01:34:43 +0000254
drh0c979402006-10-03 19:12:32 +0000255# Header files used by extensions
256#
drhde087bd2007-02-23 03:00:44 +0000257EXTHDR += \
drh0c979402006-10-03 19:12:32 +0000258 $(TOP)/ext/fts1/fts1.h \
259 $(TOP)/ext/fts1/fts1_hash.h \
260 $(TOP)/ext/fts1/fts1_tokenizer.h
drhde087bd2007-02-23 03:00:44 +0000261EXTHDR += \
262 $(TOP)/ext/fts2/fts2.h \
263 $(TOP)/ext/fts2/fts2_hash.h \
264 $(TOP)/ext/fts2/fts2_tokenizer.h
shess69c4ae22007-08-20 17:37:47 +0000265EXTHDR += \
266 $(TOP)/ext/fts3/fts3.h \
267 $(TOP)/ext/fts3/fts3_hash.h \
268 $(TOP)/ext/fts3/fts3_tokenizer.h
drh0c979402006-10-03 19:12:32 +0000269
drh71eb93e2001-09-28 01:34:43 +0000270# This is the default Makefile target. The objects listed here
271# are what get build when you type just "make" with no arguments.
272#
drh97903fe2005-05-24 20:19:57 +0000273all: sqlite3.h libsqlite3.a sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000274
275# Generate the file "last_change" which contains the date of change
276# of the most recently modified source code file
277#
278last_change: $(SRC)
drh0c07fb92006-06-27 20:05:23 +0000279 cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
drhf1878b42006-01-23 18:06:52 +0000280 | $(NAWK) '{print $$5,$$6}' >last_change
drh71eb93e2001-09-28 01:34:43 +0000281
drhd677b3d2007-08-20 22:48:41 +0000282libsqlite3.a: $(LIBOBJ)
283 $(AR) libsqlite3.a $(LIBOBJ)
drh1d482dd2004-05-31 18:23:07 +0000284 $(RANLIB) libsqlite3.a
drh71eb93e2001-09-28 01:34:43 +0000285
drh1d482dd2004-05-31 18:23:07 +0000286sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
danielk197777b03a22007-06-20 08:49:05 +0000287 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
danielk197708ada512007-06-26 10:56:40 +0000288 $(TOP)/src/shell.c \
drhf1878b42006-01-23 18:06:52 +0000289 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000290
danielk19774adee202004-05-08 08:23:19 +0000291objects: $(LIBOBJ_ORIG)
292
drh71eb93e2001-09-28 01:34:43 +0000293# This target creates a directory named "tsrc" and fills it with
294# copies of all of the C source code and header files needed to
295# build on the target system. Some of the C source code and header
296# files are automatically generated. This target takes care of
297# all that automatic generation.
298#
drhde087bd2007-02-23 03:00:44 +0000299target_source: $(SRC)
drh71eb93e2001-09-28 01:34:43 +0000300 rm -rf tsrc
301 mkdir tsrc
danielk1977e6a58a42007-08-31 17:42:48 +0000302 cp -f $(SRC) tsrc
drh71eb93e2001-09-28 01:34:43 +0000303 rm tsrc/sqlite.h.in tsrc/parse.y
drh71eb93e2001-09-28 01:34:43 +0000304
drh98495b42007-03-31 22:29:05 +0000305sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
306 tclsh $(TOP)/tool/mksqlite3c.tcl
drhbd08af42007-04-05 21:58:33 +0000307 cp sqlite3.c tclsqlite3.c
308 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
drh98495b42007-03-31 22:29:05 +0000309
drhd6e78a22007-07-20 13:42:26 +0000310fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
311 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
312
shess69c4ae22007-08-20 17:37:47 +0000313fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
314 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
315
drh71eb93e2001-09-28 01:34:43 +0000316# Rules to build the LEMON compiler generator
317#
318lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
319 $(BCC) -o lemon $(TOP)/tool/lemon.c
320 cp $(TOP)/tool/lempar.c .
321
danielk1977e6a58a42007-08-31 17:42:48 +0000322# Rules to build individual *.o files from files in the src directory.
drhbbd42a62004-05-22 17:41:58 +0000323#
danielk1977e6a58a42007-08-31 17:42:48 +0000324%.o: %.c $(HDR)
325 $(TCCX) -c $<
drhd0e4a6c2005-02-15 20:47:57 +0000326
danielk1977e6a58a42007-08-31 17:42:48 +0000327# Rules to build individual *.o files from generated *.c files. This
328# applies to:
329#
330# parse.o
331# opcodes.o
332#
333%.o: $(TOP)/src/%.c $(HDR)
334 $(TCCX) -c $<
drh9f18e8a2005-07-08 12:13:04 +0000335
danielk1977e6a58a42007-08-31 17:42:48 +0000336tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
337 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
drhbbd42a62004-05-22 17:41:58 +0000338
drhbbd42a62004-05-22 17:41:58 +0000339
drh900b31e2007-08-28 02:27:51 +0000340
danielk1977e6a58a42007-08-31 17:42:48 +0000341# Rules to build opcodes.c and opcodes.h
342#
drhb327f772004-10-06 15:03:57 +0000343opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
drh0c07fb92006-06-27 20:05:23 +0000344 sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
drhbbd42a62004-05-22 17:41:58 +0000345
drhf2bc0132004-10-04 13:19:23 +0000346opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
danielk1977e6a58a42007-08-31 17:42:48 +0000347 cat parse.h $(TOP)/src/vdbe.c |$(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
drhbbd42a62004-05-22 17:41:58 +0000348
drh054889e2005-11-30 03:20:31 +0000349
danielk1977e6a58a42007-08-31 17:42:48 +0000350# Rules to build parse.c and parse.h - the outputs of lemon.
351#
drhbbd42a62004-05-22 17:41:58 +0000352parse.h: parse.c
353
drhfa3b19e2005-11-24 22:22:29 +0000354parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
drhbbd42a62004-05-22 17:41:58 +0000355 cp $(TOP)/src/parse.y .
drh36bc4022007-10-12 00:23:44 +0000356 rm -f parse.h
drh27d258a2004-10-30 20:23:09 +0000357 ./lemon $(OPTS) parse.y
drhfa3b19e2005-11-24 22:22:29 +0000358 mv parse.h parse.h.temp
359 awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
drh71eb93e2001-09-28 01:34:43 +0000360
drh1d482dd2004-05-31 18:23:07 +0000361sqlite3.h: $(TOP)/src/sqlite.h.in
drhbbd42a62004-05-22 17:41:58 +0000362 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
drhf1878b42006-01-23 18:06:52 +0000363 -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 +0000364 $(TOP)/src/sqlite.h.in >sqlite3.h
drhbbd42a62004-05-22 17:41:58 +0000365
drh73b211a2005-01-18 04:00:42 +0000366keywordhash.h: $(TOP)/tool/mkkeywordhash.c
drh52fb6d72004-11-03 03:59:57 +0000367 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
drh73b211a2005-01-18 04:00:42 +0000368 ./mkkeywordhash >keywordhash.h
drh52fb6d72004-11-03 03:59:57 +0000369
drhbbd42a62004-05-22 17:41:58 +0000370
drhbbd42a62004-05-22 17:41:58 +0000371
danielk1977576d3db2007-06-25 14:28:48 +0000372# Rules to build the extension objects.
373#
374icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
375 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
376
377fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
378 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
379
380fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
381 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
382
383fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
384 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
385
386fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
387 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
388
389fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
390 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
391
392fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
393 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
394
shess69c4ae22007-08-20 17:37:47 +0000395fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
396 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
397
398fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
399 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
400
401fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
402 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
403
404fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
405 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
406
407fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
408 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
409
410fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
411 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
412
danielk1977576d3db2007-06-25 14:28:48 +0000413
drhbbd42a62004-05-22 17:41:58 +0000414# Rules for building test programs and for running tests
415#
drh1d482dd2004-05-31 18:23:07 +0000416tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
417 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
danielk1977bc6ada42004-06-30 08:20:16 +0000418 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000419
danielk1977e6a58a42007-08-31 17:42:48 +0000420
421# Rules to build the 'testfixture' application.
422#
423TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
424TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
425
426testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
427 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
428 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
429 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
430
431amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
432 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
433 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
434 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000435
drh9c06c952005-11-26 00:25:00 +0000436fulltest: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000437 ./testfixture$(EXE) $(TOP)/test/all.test
438
drh44548ec2007-06-18 12:22:43 +0000439soaktest: testfixture$(EXE) sqlite3$(EXE)
440 ./testfixture$(EXE) $(TOP)/test/all.test -soak 1
441
drh1d482dd2004-05-31 18:23:07 +0000442test: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000443 ./testfixture$(EXE) $(TOP)/test/quick.test
444
danielk1977e6a58a42007-08-31 17:42:48 +0000445sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
drh3e27c022004-07-23 00:01:38 +0000446 $(TOP)/tool/spaceanal.tcl
447 sed \
448 -e '/^#/d' \
449 -e 's,\\,\\\\,g' \
450 -e 's,",\\",g' \
451 -e 's,^,",' \
452 -e 's,$$,\\n",' \
453 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
drh7b12d462007-11-02 12:52:39 +0000454 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
danielk1977e6a58a42007-08-31 17:42:48 +0000455 -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
456 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
457 -o sqlite3_analyzer$(EXE) \
458 $(LIBTCL) $(THREADLIB)
drh3e27c022004-07-23 00:01:38 +0000459
danielk197769e777f2006-06-14 10:38:02 +0000460TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
461$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
462 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
463
464extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
465 ./testfixture$(EXE) $(TOP)/test/loadext.test
466
danielk1977e6a58a42007-08-31 17:42:48 +0000467
drhbbd42a62004-05-22 17:41:58 +0000468# Standard install and cleanup targets
469#
drh1d482dd2004-05-31 18:23:07 +0000470install: sqlite3 libsqlite3.a sqlite3.h
471 mv sqlite3 /usr/bin
472 mv libsqlite3.a /usr/lib
473 mv sqlite3.h /usr/include
drh71eb93e2001-09-28 01:34:43 +0000474
475clean:
drh9c06c952005-11-26 00:25:00 +0000476 rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.*
drh73b211a2005-01-18 04:00:42 +0000477 rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
drh71eb93e2001-09-28 01:34:43 +0000478 rm -f $(PUBLISH)
479 rm -f *.da *.bb *.bbg gmon.out
480 rm -rf tsrc
drhf80ad492006-09-02 22:14:59 +0000481 rm -f testloadext.dll libtestloadext.so