blob: 7c3435ae7d0c2d7a3caa25d5d3a5622b47c2fe7a [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#
12# USLEEP If the target operating system supports the "usleep()" system
13# call, then define the HAVE_USLEEP macro for all C modules.
14#
15# THREADSAFE If you want the SQLite library to be safe for use within a
16# multi-threaded program, then define the following macro
17# appropriately:
18#
19# THREADLIB Specify any extra linker options needed to make the library
20# thread safe
21#
22# OPTS Extra compiler command-line options.
23#
24# EXE The suffix to add to executable files. ".exe" for windows
25# and "" for Unix.
26#
27# TCC C Compiler and options for use in building executables that
28# will run on the target platform. This is usually the same
29# as BCC, unless you are cross-compiling.
30#
31# AR Tools used to build a static library.
32# RANLIB
33#
34# TCL_FLAGS Extra compiler options needed for programs that use the
35# TCL library.
36#
37# LIBTCL Linker options needed to link against the TCL library.
38#
39# READLINE_FLAGS Compiler options needed for programs that use the
40# readline() library.
41#
42# LIBREADLINE Linker options needed by programs using readline() must
43# link against.
44#
drhf1878b42006-01-23 18:06:52 +000045# NAWK Nawk compatible awk program. Older (obsolete?) solaris
46# systems need this to avoid using the original AT&T AWK.
drh76800322002-08-13 20:45:39 +000047#
48# Once the macros above are defined, the rest of this make script will
49# build the SQLite library and testing tools.
50################################################################################
drh71eb93e2001-09-28 01:34:43 +000051
52# This is how we compile
53#
drha297b5c2002-01-15 18:39:43 +000054TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
drh71eb93e2001-09-28 01:34:43 +000055
56# Object files for the SQLite library.
57#
drh900b31e2007-08-28 02:27:51 +000058LIBOBJ+= alter.o analyze.o attach.o auth.o btmutex.o btree.o build.o \
drha2b902d2005-08-14 17:53:20 +000059 callback.o complete.o date.o delete.o \
danielk1977c7b60172007-08-22 11:22:03 +000060 expr.o func.o hash.o insert.o journal.o loadext.o \
drh437b9012007-08-28 16:34:42 +000061 main.o malloc.o mem1.o mem2.o mutex.o mutex_os2.o \
62 mutex_unix.o mutex_w32.o \
drh90f6a5b2007-08-15 13:04:54 +000063 opcodes.o os.o os_os2.o os_unix.o os_win.o \
danielk1977fa256a32005-05-25 04:11:56 +000064 pager.o parse.o pragma.o prepare.o printf.o random.o \
drh38f82712004-06-18 17:10:16 +000065 select.o table.o tclsqlite.o tokenize.o trigger.o \
66 update.o util.o vacuum.o \
danielk1977b4e9af92007-05-01 17:49:49 +000067 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbefifo.o vdbemem.o \
drhb9bb7c12006-06-11 23:41:55 +000068 where.o utf.o legacy.o vtab.o
drh71eb93e2001-09-28 01:34:43 +000069
shess69c4ae22007-08-20 17:37:47 +000070EXTOBJ = icu.o
71EXTOBJ += fts1.o \
72 fts1_hash.o \
73 fts1_tokenizer1.o \
74 fts1_porter.o
75EXTOBJ += fts2.o \
76 fts2_hash.o \
77 fts2_icu.o \
78 fts2_porter.o \
79 fts2_tokenizer.o \
80 fts2_tokenizer1.o
81EXTOBJ += fts3.o \
82 fts3_hash.o \
83 fts3_icu.o \
84 fts3_porter.o \
85 fts3_tokenizer.o \
86 fts3_tokenizer1.o
danielk1977576d3db2007-06-25 14:28:48 +000087
drh71eb93e2001-09-28 01:34:43 +000088# All of the source code files.
89#
90SRC = \
drhd0e4a6c2005-02-15 20:47:57 +000091 $(TOP)/src/alter.c \
drh9f18e8a2005-07-08 12:13:04 +000092 $(TOP)/src/analyze.c \
drhc11d4f92003-04-06 21:08:24 +000093 $(TOP)/src/attach.c \
drhed6c8672003-01-12 18:02:16 +000094 $(TOP)/src/auth.c \
drh900b31e2007-08-28 02:27:51 +000095 $(TOP)/src/btmutex.c \
drh71eb93e2001-09-28 01:34:43 +000096 $(TOP)/src/btree.c \
97 $(TOP)/src/btree.h \
danielk1977e6a58a42007-08-31 17:42:48 +000098 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +000099 $(TOP)/src/build.c \
danielk1977fd9a0a42005-05-24 12:01:00 +0000100 $(TOP)/src/callback.c \
drha2b902d2005-08-14 17:53:20 +0000101 $(TOP)/src/complete.c \
drh7014aff2003-11-01 01:53:53 +0000102 $(TOP)/src/date.c \
drh71eb93e2001-09-28 01:34:43 +0000103 $(TOP)/src/delete.c \
104 $(TOP)/src/expr.c \
drhdc04c582002-02-24 01:55:15 +0000105 $(TOP)/src/func.c \
drh71eb93e2001-09-28 01:34:43 +0000106 $(TOP)/src/hash.c \
107 $(TOP)/src/hash.h \
108 $(TOP)/src/insert.c \
danielk1977c7b60172007-08-22 11:22:03 +0000109 $(TOP)/src/journal.c \
drh014ac192004-06-01 01:45:11 +0000110 $(TOP)/src/legacy.c \
drh1e397f82006-06-08 15:28:43 +0000111 $(TOP)/src/loadext.c \
drh71eb93e2001-09-28 01:34:43 +0000112 $(TOP)/src/main.c \
drha3152892007-05-05 11:48:52 +0000113 $(TOP)/src/malloc.c \
drh4c3645c2007-08-15 17:07:57 +0000114 $(TOP)/src/mem1.c \
115 $(TOP)/src/mem2.c \
drh90f6a5b2007-08-15 13:04:54 +0000116 $(TOP)/src/mutex.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000117 $(TOP)/src/mutex.h \
drh437b9012007-08-28 16:34:42 +0000118 $(TOP)/src/mutex_os2.c \
119 $(TOP)/src/mutex_unix.c \
120 $(TOP)/src/mutex_w32.c \
drh054889e2005-11-30 03:20:31 +0000121 $(TOP)/src/os.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000122 $(TOP)/src/os.h \
123 $(TOP)/src/os_common.h \
drh60a1e4b2006-06-03 18:02:15 +0000124 $(TOP)/src/os_os2.c \
drhbbd42a62004-05-22 17:41:58 +0000125 $(TOP)/src/os_unix.c \
126 $(TOP)/src/os_win.c \
drh71eb93e2001-09-28 01:34:43 +0000127 $(TOP)/src/pager.c \
128 $(TOP)/src/pager.h \
129 $(TOP)/src/parse.y \
drhc11d4f92003-04-06 21:08:24 +0000130 $(TOP)/src/pragma.c \
danielk1977fa256a32005-05-25 04:11:56 +0000131 $(TOP)/src/prepare.c \
drh71eb93e2001-09-28 01:34:43 +0000132 $(TOP)/src/printf.c \
133 $(TOP)/src/random.c \
134 $(TOP)/src/select.c \
135 $(TOP)/src/shell.c \
136 $(TOP)/src/sqlite.h.in \
drhde087bd2007-02-23 03:00:44 +0000137 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000138 $(TOP)/src/sqliteInt.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000139 $(TOP)/src/sqliteLimit.h \
drh71eb93e2001-09-28 01:34:43 +0000140 $(TOP)/src/table.c \
141 $(TOP)/src/tclsqlite.c \
142 $(TOP)/src/tokenize.c \
drhdc379452002-05-15 12:45:43 +0000143 $(TOP)/src/trigger.c \
drh1bbf5ee2004-05-11 01:18:24 +0000144 $(TOP)/src/utf.c \
drh71eb93e2001-09-28 01:34:43 +0000145 $(TOP)/src/update.c \
146 $(TOP)/src/util.c \
drhe1051c62003-04-06 20:52:32 +0000147 $(TOP)/src/vacuum.c \
drh71eb93e2001-09-28 01:34:43 +0000148 $(TOP)/src/vdbe.c \
149 $(TOP)/src/vdbe.h \
drheb2e1762004-05-27 01:53:56 +0000150 $(TOP)/src/vdbeapi.c \
drh9a324642003-09-06 20:12:01 +0000151 $(TOP)/src/vdbeaux.c \
danielk1977b4e9af92007-05-01 17:49:49 +0000152 $(TOP)/src/vdbeblob.c \
drha01f79d2005-07-08 13:07:59 +0000153 $(TOP)/src/vdbefifo.c \
drheb2e1762004-05-27 01:53:56 +0000154 $(TOP)/src/vdbemem.c \
drh9a324642003-09-06 20:12:01 +0000155 $(TOP)/src/vdbeInt.h \
drhb9bb7c12006-06-11 23:41:55 +0000156 $(TOP)/src/vtab.c \
drh71eb93e2001-09-28 01:34:43 +0000157 $(TOP)/src/where.c
158
drh0c979402006-10-03 19:12:32 +0000159# Source code for extensions
160#
161SRC += \
162 $(TOP)/ext/fts1/fts1.c \
163 $(TOP)/ext/fts1/fts1.h \
164 $(TOP)/ext/fts1/fts1_hash.c \
165 $(TOP)/ext/fts1/fts1_hash.h \
166 $(TOP)/ext/fts1/fts1_porter.c \
167 $(TOP)/ext/fts1/fts1_tokenizer.h \
168 $(TOP)/ext/fts1/fts1_tokenizer1.c
drhde087bd2007-02-23 03:00:44 +0000169SRC += \
170 $(TOP)/ext/fts2/fts2.c \
171 $(TOP)/ext/fts2/fts2.h \
172 $(TOP)/ext/fts2/fts2_hash.c \
173 $(TOP)/ext/fts2/fts2_hash.h \
drhd6e78a22007-07-20 13:42:26 +0000174 $(TOP)/ext/fts2/fts2_icu.c \
drhde087bd2007-02-23 03:00:44 +0000175 $(TOP)/ext/fts2/fts2_porter.c \
176 $(TOP)/ext/fts2/fts2_tokenizer.h \
drhd6e78a22007-07-20 13:42:26 +0000177 $(TOP)/ext/fts2/fts2_tokenizer.c \
drhde087bd2007-02-23 03:00:44 +0000178 $(TOP)/ext/fts2/fts2_tokenizer1.c
danielk197708ada512007-06-26 10:56:40 +0000179SRC += \
shess69c4ae22007-08-20 17:37:47 +0000180 $(TOP)/ext/fts3/fts3.c \
181 $(TOP)/ext/fts3/fts3.h \
182 $(TOP)/ext/fts3/fts3_hash.c \
183 $(TOP)/ext/fts3/fts3_hash.h \
184 $(TOP)/ext/fts3/fts3_icu.c \
185 $(TOP)/ext/fts3/fts3_porter.c \
186 $(TOP)/ext/fts3/fts3_tokenizer.h \
187 $(TOP)/ext/fts3/fts3_tokenizer.c \
188 $(TOP)/ext/fts3/fts3_tokenizer1.c
189SRC += \
danielk197708ada512007-06-26 10:56:40 +0000190 $(TOP)/ext/icu/icu.c
drhde087bd2007-02-23 03:00:44 +0000191
danielk197777b03a22007-06-20 08:49:05 +0000192
drhde087bd2007-02-23 03:00:44 +0000193# Generated source code files
194#
195SRC += \
196 keywordhash.h \
197 opcodes.c \
198 opcodes.h \
199 parse.c \
200 parse.h \
201 sqlite3.h
drh0c979402006-10-03 19:12:32 +0000202
203
drh71eb93e2001-09-28 01:34:43 +0000204# Source code to the test files.
205#
drhb6f41482004-05-14 01:58:11 +0000206TESTSRC = \
drh71eb93e2001-09-28 01:34:43 +0000207 $(TOP)/src/test1.c \
208 $(TOP)/src/test2.c \
209 $(TOP)/src/test3.c \
drha6064dc2003-12-19 02:52:05 +0000210 $(TOP)/src/test4.c \
danielk19774adee202004-05-08 08:23:19 +0000211 $(TOP)/src/test5.c \
drh9c06c952005-11-26 00:25:00 +0000212 $(TOP)/src/test6.c \
drh29c636b2006-01-09 23:40:25 +0000213 $(TOP)/src/test7.c \
drhb9bb7c12006-06-11 23:41:55 +0000214 $(TOP)/src/test8.c \
danielk1977a713f2c2007-03-29 12:19:11 +0000215 $(TOP)/src/test9.c \
drh1409be62006-08-23 20:07:20 +0000216 $(TOP)/src/test_autoext.c \
drh23669402006-01-09 17:29:52 +0000217 $(TOP)/src/test_async.c \
drh16a9b832007-05-05 18:39:25 +0000218 $(TOP)/src/test_btree.c \
drhc797d4d2007-05-08 01:08:49 +0000219 $(TOP)/src/test_config.c \
drh15926592007-04-06 15:02:13 +0000220 $(TOP)/src/test_hexio.c \
drh2f999a62007-08-15 19:16:43 +0000221 $(TOP)/src/test_malloc.c \
drh2d02a672006-01-25 15:55:37 +0000222 $(TOP)/src/test_md5.c \
danielk1977954ce992006-06-15 15:59:19 +0000223 $(TOP)/src/test_schema.c \
drh2d02a672006-01-25 15:55:37 +0000224 $(TOP)/src/test_server.c \
drh4be8b512006-06-13 23:51:34 +0000225 $(TOP)/src/test_tclvar.c \
danielk1977e6a58a42007-08-31 17:42:48 +0000226
shess69c4ae22007-08-20 17:37:47 +0000227TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
228TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
drh71eb93e2001-09-28 01:34:43 +0000229
danielk1977e6a58a42007-08-31 17:42:48 +0000230TESTSRC2 = \
231 $(TOP)/src/attach.c $(TOP)/src/btree.c $(TOP)/src/build.c $(TOP)/src/date.c \
232 $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \
233 $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
234 $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
235 $(TOP)/src/printf.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
236 $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
237 $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c
238
drh71eb93e2001-09-28 01:34:43 +0000239# Header files used by all library source files.
240#
241HDR = \
drh71eb93e2001-09-28 01:34:43 +0000242 $(TOP)/src/btree.h \
drha3152892007-05-05 11:48:52 +0000243 $(TOP)/src/btreeInt.h \
drh71eb93e2001-09-28 01:34:43 +0000244 $(TOP)/src/hash.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000245 keywordhash.h \
drh437b9012007-08-28 16:34:42 +0000246 $(TOP)/src/mutex.h \
drh8f619cc2002-09-08 00:04:50 +0000247 opcodes.h \
drh71eb93e2001-09-28 01:34:43 +0000248 $(TOP)/src/os.h \
drh014ac192004-06-01 01:45:11 +0000249 $(TOP)/src/os_common.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000250 $(TOP)/src/pager.h \
251 parse.h \
drh437b9012007-08-28 16:34:42 +0000252 sqlite3.h \
drh1e397f82006-06-08 15:28:43 +0000253 $(TOP)/src/sqlite3ext.h \
drh71eb93e2001-09-28 01:34:43 +0000254 $(TOP)/src/sqliteInt.h \
drh437b9012007-08-28 16:34:42 +0000255 $(TOP)/src/sqliteLimit.h \
drh9a324642003-09-06 20:12:01 +0000256 $(TOP)/src/vdbe.h \
danielk1977e6a58a42007-08-31 17:42:48 +0000257 $(TOP)/src/vdbeInt.h
drh71eb93e2001-09-28 01:34:43 +0000258
drh0c979402006-10-03 19:12:32 +0000259# Header files used by extensions
260#
drhde087bd2007-02-23 03:00:44 +0000261EXTHDR += \
drh0c979402006-10-03 19:12:32 +0000262 $(TOP)/ext/fts1/fts1.h \
263 $(TOP)/ext/fts1/fts1_hash.h \
264 $(TOP)/ext/fts1/fts1_tokenizer.h
drhde087bd2007-02-23 03:00:44 +0000265EXTHDR += \
266 $(TOP)/ext/fts2/fts2.h \
267 $(TOP)/ext/fts2/fts2_hash.h \
268 $(TOP)/ext/fts2/fts2_tokenizer.h
shess69c4ae22007-08-20 17:37:47 +0000269EXTHDR += \
270 $(TOP)/ext/fts3/fts3.h \
271 $(TOP)/ext/fts3/fts3_hash.h \
272 $(TOP)/ext/fts3/fts3_tokenizer.h
drh0c979402006-10-03 19:12:32 +0000273
drh71eb93e2001-09-28 01:34:43 +0000274# This is the default Makefile target. The objects listed here
275# are what get build when you type just "make" with no arguments.
276#
drh97903fe2005-05-24 20:19:57 +0000277all: sqlite3.h libsqlite3.a sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000278
279# Generate the file "last_change" which contains the date of change
280# of the most recently modified source code file
281#
282last_change: $(SRC)
drh0c07fb92006-06-27 20:05:23 +0000283 cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
drhf1878b42006-01-23 18:06:52 +0000284 | $(NAWK) '{print $$5,$$6}' >last_change
drh71eb93e2001-09-28 01:34:43 +0000285
drhd677b3d2007-08-20 22:48:41 +0000286libsqlite3.a: $(LIBOBJ)
287 $(AR) libsqlite3.a $(LIBOBJ)
drh1d482dd2004-05-31 18:23:07 +0000288 $(RANLIB) libsqlite3.a
drh71eb93e2001-09-28 01:34:43 +0000289
drh1d482dd2004-05-31 18:23:07 +0000290sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
danielk197777b03a22007-06-20 08:49:05 +0000291 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
danielk197708ada512007-06-26 10:56:40 +0000292 $(TOP)/src/shell.c \
drhf1878b42006-01-23 18:06:52 +0000293 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000294
danielk19774adee202004-05-08 08:23:19 +0000295objects: $(LIBOBJ_ORIG)
296
drh71eb93e2001-09-28 01:34:43 +0000297# This target creates a directory named "tsrc" and fills it with
298# copies of all of the C source code and header files needed to
299# build on the target system. Some of the C source code and header
300# files are automatically generated. This target takes care of
301# all that automatic generation.
302#
drhde087bd2007-02-23 03:00:44 +0000303target_source: $(SRC)
danielk1977e6a58a42007-08-31 17:42:48 +0000304 @echo $(SRC)
drh71eb93e2001-09-28 01:34:43 +0000305 rm -rf tsrc
306 mkdir tsrc
danielk1977e6a58a42007-08-31 17:42:48 +0000307 cp -f $(SRC) tsrc
drh71eb93e2001-09-28 01:34:43 +0000308 rm tsrc/sqlite.h.in tsrc/parse.y
drh71eb93e2001-09-28 01:34:43 +0000309
drh98495b42007-03-31 22:29:05 +0000310sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
311 tclsh $(TOP)/tool/mksqlite3c.tcl
drhbd08af42007-04-05 21:58:33 +0000312 cp sqlite3.c tclsqlite3.c
313 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
314 tclsh $(TOP)/tool/mksqlite3internalh.tcl
drh98495b42007-03-31 22:29:05 +0000315
drhd6e78a22007-07-20 13:42:26 +0000316fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
317 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
318
shess69c4ae22007-08-20 17:37:47 +0000319fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
320 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
321
drh71eb93e2001-09-28 01:34:43 +0000322# Rules to build the LEMON compiler generator
323#
324lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
325 $(BCC) -o lemon $(TOP)/tool/lemon.c
326 cp $(TOP)/tool/lempar.c .
327
danielk1977e6a58a42007-08-31 17:42:48 +0000328# Rules to build individual *.o files from files in the src directory.
drhbbd42a62004-05-22 17:41:58 +0000329#
danielk1977e6a58a42007-08-31 17:42:48 +0000330%.o: %.c $(HDR)
331 $(TCCX) -c $<
drhd0e4a6c2005-02-15 20:47:57 +0000332
danielk1977e6a58a42007-08-31 17:42:48 +0000333# Rules to build individual *.o files from generated *.c files. This
334# applies to:
335#
336# parse.o
337# opcodes.o
338#
339%.o: $(TOP)/src/%.c $(HDR)
340 $(TCCX) -c $<
drh9f18e8a2005-07-08 12:13:04 +0000341
danielk1977e6a58a42007-08-31 17:42:48 +0000342tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
343 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
drhbbd42a62004-05-22 17:41:58 +0000344
drhbbd42a62004-05-22 17:41:58 +0000345
drh900b31e2007-08-28 02:27:51 +0000346
danielk1977e6a58a42007-08-31 17:42:48 +0000347# Rules to build opcodes.c and opcodes.h
348#
drhb327f772004-10-06 15:03:57 +0000349opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
drh0c07fb92006-06-27 20:05:23 +0000350 sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
drhbbd42a62004-05-22 17:41:58 +0000351
drhf2bc0132004-10-04 13:19:23 +0000352opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
danielk1977e6a58a42007-08-31 17:42:48 +0000353 cat parse.h $(TOP)/src/vdbe.c |$(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
drhbbd42a62004-05-22 17:41:58 +0000354
drh054889e2005-11-30 03:20:31 +0000355
danielk1977e6a58a42007-08-31 17:42:48 +0000356# Rules to build parse.c and parse.h - the outputs of lemon.
357#
drhbbd42a62004-05-22 17:41:58 +0000358parse.h: parse.c
359
drhfa3b19e2005-11-24 22:22:29 +0000360parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
drhbbd42a62004-05-22 17:41:58 +0000361 cp $(TOP)/src/parse.y .
drh27d258a2004-10-30 20:23:09 +0000362 ./lemon $(OPTS) parse.y
drhfa3b19e2005-11-24 22:22:29 +0000363 mv parse.h parse.h.temp
364 awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
drh71eb93e2001-09-28 01:34:43 +0000365
drh1d482dd2004-05-31 18:23:07 +0000366sqlite3.h: $(TOP)/src/sqlite.h.in
drhbbd42a62004-05-22 17:41:58 +0000367 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
drhf1878b42006-01-23 18:06:52 +0000368 -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 +0000369 $(TOP)/src/sqlite.h.in >sqlite3.h
drhbbd42a62004-05-22 17:41:58 +0000370
drh73b211a2005-01-18 04:00:42 +0000371keywordhash.h: $(TOP)/tool/mkkeywordhash.c
drh52fb6d72004-11-03 03:59:57 +0000372 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
drh73b211a2005-01-18 04:00:42 +0000373 ./mkkeywordhash >keywordhash.h
drh52fb6d72004-11-03 03:59:57 +0000374
drhbbd42a62004-05-22 17:41:58 +0000375
drhbbd42a62004-05-22 17:41:58 +0000376
danielk1977576d3db2007-06-25 14:28:48 +0000377# Rules to build the extension objects.
378#
379icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
380 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
381
382fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
383 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
384
385fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
386 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
387
388fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
389 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
390
391fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
392 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
393
394fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
395 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
396
397fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
398 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
399
shess69c4ae22007-08-20 17:37:47 +0000400fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
401 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
402
403fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
404 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
405
406fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
407 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
408
409fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
410 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
411
412fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
413 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
414
415fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
416 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
417
danielk1977576d3db2007-06-25 14:28:48 +0000418
drhbbd42a62004-05-22 17:41:58 +0000419# Rules for building test programs and for running tests
420#
drh1d482dd2004-05-31 18:23:07 +0000421tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
422 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
danielk1977bc6ada42004-06-30 08:20:16 +0000423 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000424
danielk1977e6a58a42007-08-31 17:42:48 +0000425
426# Rules to build the 'testfixture' application.
427#
428TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
429TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
430
431testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
432 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
433 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
434 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
435
436amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
437 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
438 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
439 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
drh71eb93e2001-09-28 01:34:43 +0000440
drh9c06c952005-11-26 00:25:00 +0000441fulltest: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000442 ./testfixture$(EXE) $(TOP)/test/all.test
443
drh44548ec2007-06-18 12:22:43 +0000444soaktest: testfixture$(EXE) sqlite3$(EXE)
445 ./testfixture$(EXE) $(TOP)/test/all.test -soak 1
446
drh1d482dd2004-05-31 18:23:07 +0000447test: testfixture$(EXE) sqlite3$(EXE)
drh71eb93e2001-09-28 01:34:43 +0000448 ./testfixture$(EXE) $(TOP)/test/quick.test
449
danielk1977e6a58a42007-08-31 17:42:48 +0000450sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
drh3e27c022004-07-23 00:01:38 +0000451 $(TOP)/tool/spaceanal.tcl
452 sed \
453 -e '/^#/d' \
454 -e 's,\\,\\\\,g' \
455 -e 's,",\\",g' \
456 -e 's,^,",' \
457 -e 's,$$,\\n",' \
458 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
danielk1977e6a58a42007-08-31 17:42:48 +0000459 $(TCCX) $(TCL_FLAGS) \
460 -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
461 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
462 -o sqlite3_analyzer$(EXE) \
463 $(LIBTCL) $(THREADLIB)
drh3e27c022004-07-23 00:01:38 +0000464
danielk197769e777f2006-06-14 10:38:02 +0000465TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
466$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
467 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
468
469extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
470 ./testfixture$(EXE) $(TOP)/test/loadext.test
471
danielk1977e6a58a42007-08-31 17:42:48 +0000472
drhbbd42a62004-05-22 17:41:58 +0000473# Rules used to build documentation
474#
danielk1977e6a58a42007-08-31 17:42:48 +0000475%.html: $(TOP)/www/%.tcl docdir last_change common.tcl
476 tclsh $< > $@
drh71eb93e2001-09-28 01:34:43 +0000477
danielk1977e6a58a42007-08-31 17:42:48 +0000478lang.html: $(TOP)/www/lang.tcl docdir
danielk1977cd45ab22004-11-19 11:59:23 +0000479 tclsh $(TOP)/www/lang.tcl doc >lang.html
drh71eb93e2001-09-28 01:34:43 +0000480
drh71eb93e2001-09-28 01:34:43 +0000481opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
482 tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
483
danielk1977e6a58a42007-08-31 17:42:48 +0000484capi3ref.html: $(TOP)/www/mkapidoc.tcl sqlite3.h
485 tclsh $(TOP)/www/mkapidoc.tcl <sqlite3.h >capi3ref.html
drhfbe43752002-08-14 00:08:12 +0000486
drh0e3c0832007-08-31 18:50:31 +0000487copyright-release.html: $(TOP)/www/copyright-release.html
488 cp $(TOP)/www/copyright-release.html .
489
danielk1977e6a58a42007-08-31 17:42:48 +0000490%: $(TOP)/www/%
491 cp $< $@
drh71eb93e2001-09-28 01:34:43 +0000492
493# Files to be published on the website.
494#
drh90ca9752001-09-28 17:47:14 +0000495DOC = \
drh71eb93e2001-09-28 01:34:43 +0000496 arch.html \
drhf8565822004-11-21 01:02:00 +0000497 autoinc.html \
drh71eb93e2001-09-28 01:34:43 +0000498 c_interface.html \
drh1d482dd2004-05-31 18:23:07 +0000499 capi3.html \
drh93db69e2004-06-01 01:22:37 +0000500 capi3ref.html \
drh1d482dd2004-05-31 18:23:07 +0000501 changes.html \
drhf8565822004-11-21 01:02:00 +0000502 compile.html \
drhd4acf192004-05-31 16:04:08 +0000503 copyright.html \
504 copyright-release.html \
505 copyright-release.pdf \
drh76800322002-08-13 20:45:39 +0000506 conflict.html \
drhc2774132002-08-15 13:45:17 +0000507 datatypes.html \
drh1d482dd2004-05-31 18:23:07 +0000508 datatype3.html \
drh9179fd92005-03-12 15:55:10 +0000509 different.html \
drhd4acf192004-05-31 16:04:08 +0000510 docs.html \
drhbbd42a62004-05-22 17:41:58 +0000511 download.html \
512 faq.html \
drh96f45312002-09-02 14:11:02 +0000513 fileformat.html \
drhbbd42a62004-05-22 17:41:58 +0000514 formatchng.html \
515 index.html \
drhb0e64f32007-06-09 09:53:51 +0000516 limits.html \
drhbbd42a62004-05-22 17:41:58 +0000517 lang.html \
drh52619df2004-06-11 17:48:02 +0000518 lockingv3.html \
drhbbd42a62004-05-22 17:41:58 +0000519 mingw.html \
520 nulls.html \
drh7b93ed32004-06-16 03:02:00 +0000521 oldnews.html \
drhbbd42a62004-05-22 17:41:58 +0000522 omitted.html \
523 opcode.html \
drh8897f6f2005-08-30 22:44:29 +0000524 optimizer.html \
drhf6ac6572005-08-31 01:49:59 +0000525 optoverview.html \
danielk19772a03c3a2004-11-10 05:48:57 +0000526 pragma.html \
drhbbd42a62004-05-22 17:41:58 +0000527 quickstart.html \
danielk1977da184232006-01-05 11:34:32 +0000528 sharedcache.html \
drhbbd42a62004-05-22 17:41:58 +0000529 speed.html \
530 sqlite.html \
drhd4acf192004-05-31 16:04:08 +0000531 support.html \
drhbbd42a62004-05-22 17:41:58 +0000532 tclsqlite.html \
drha2854222004-06-17 19:04:17 +0000533 vdbe.html \
drhe4254642005-01-21 18:19:27 +0000534 version3.html \
drh50d3f902007-08-27 21:10:36 +0000535 whentouse.html \
536 34to35.html
drh71eb93e2001-09-28 01:34:43 +0000537
danielk1977e6a58a42007-08-31 17:42:48 +0000538docdir:
drh90ca9752001-09-28 17:47:14 +0000539 mkdir -p doc
danielk1977e6a58a42007-08-31 17:42:48 +0000540
541doc: common.tcl $(DOC) docdir
drh90ca9752001-09-28 17:47:14 +0000542 mv $(DOC) doc
drh8897f6f2005-08-30 22:44:29 +0000543 cp $(TOP)/www/*.gif $(TOP)/art/*.gif doc
drh71eb93e2001-09-28 01:34:43 +0000544
drhbbd42a62004-05-22 17:41:58 +0000545# Standard install and cleanup targets
546#
drh1d482dd2004-05-31 18:23:07 +0000547install: sqlite3 libsqlite3.a sqlite3.h
548 mv sqlite3 /usr/bin
549 mv libsqlite3.a /usr/lib
550 mv sqlite3.h /usr/include
drh71eb93e2001-09-28 01:34:43 +0000551
552clean:
drh9c06c952005-11-26 00:25:00 +0000553 rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.*
drh73b211a2005-01-18 04:00:42 +0000554 rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
drh71eb93e2001-09-28 01:34:43 +0000555 rm -f $(PUBLISH)
556 rm -f *.da *.bb *.bbg gmon.out
557 rm -rf tsrc
drhf80ad492006-09-02 22:14:59 +0000558 rm -f testloadext.dll libtestloadext.so