blob: c9058da3e52390668526be9217dcd8fa65295116 [file] [log] [blame]
chw97185482008-11-17 08:05:31 +00001#!/usr/make
2#
3# Makefile for SQLITE on VxWorks
4
5ifeq ($(FORCPU),)
6 FORCPU = SH32gnule
7endif
8
9TOOL_FAMILY = gnu
10
11include $(WIND_USR)/tool/gnu/make.$(FORCPU)
12
13#### The toplevel directory of the source tree. This is the directory
14# that contains this "Makefile.in" and the "configure.in" script.
15#
chw6de061a2009-04-13 08:14:03 +000016TOP = .
chw97185482008-11-17 08:05:31 +000017
18#### C Compiler and options for use in building executables that
19# will run on the platform that is doing the build.
20#
21BCC = gcc -g -O2
22#BCC = /opt/ancic/bin/c89 -0
23
24#### If the target operating system supports the "usleep()" system
25# call, then define the HAVE_USLEEP macro for all C modules.
26#
27USLEEP =
28#USLEEP = -DHAVE_USLEEP=1
29
30#### If you want the SQLite library to be safe for use within a
31# multi-threaded program, then define the following macro
32# appropriately:
33#
34THREADSAFE = -DSQLITE_THREADSAFE=1
35#THREADSAFE = -DSQLITE_THREADSAFE=0
36
37#### Specify any extra linker options needed to make the library
38# thread safe
39#
40#THREADLIB = -lpthread
41THREADLIB =
42
43#### Specify any extra libraries needed to access required functions.
44#
chw6de061a2009-04-13 08:14:03 +000045ifeq ($(CPU),SH32)
46 # for SH4 shared library
47 TLIBS_SHARED += -L$(WIND_USR)/lib/sh/SH32/commonle/PIC
48else
49 # for all other CPUs shared library
50 TLIBS_SHARED += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS)
51endif
52# for static library
chw97185482008-11-17 08:05:31 +000053TLIBS += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS)
54
55#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
56# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
57# malloc()s and free()s in order to track down memory leaks.
58#
59# SQLite uses some expensive assert() statements in the inner loop.
60# You can make the library go almost twice as fast if you compile
61# with -DNDEBUG=1
62#
63#OPTS = -DSQLITE_DEBUG=2
64#OPTS = -DSQLITE_DEBUG=1
65#OPTS =
66OPTS = -DNDEBUG=1 -DSQLITE_OS_UNIX=1 $(THREADSAFE)
67OPTS += -DSQLITE_OMIT_LOAD_EXTENSION=1
68OPTS += -DSQLITE_ENABLE_LOCKING_STYLE=1
69OPTS += -DSQLITE_THREAD_OVERRIDE_LOCK=0
70OPTS += -DSQLITE_ENABLE_COLUMN_METADATA=1
71OPTS += -DHAVE_FDATASYNC=1
72
73#### The suffix to add to executable files. ".exe" for windows.
74# Nothing for unix.
75#
76EXE = .vxe
77#EXE =
78
79#### C Compile and options for use in building executables that
80# will run on the target platform. This is usually the same
81# as BCC, unless you are cross-compiling.
82#
83#TCC = gcc -O6
84#TCC = gcc -g -O0 -Wall
85#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
86#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
87TCC = $(CC) $(DEFINE_CC) -O2 -g -mrtp $(CC_ARCH_SPEC) -D_REENTRANT=1 -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL)
88TCC += -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip
89#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive
90
91#TCC_SHARED = $(TCC) -fPIC
92TCC_SHARED = $(TCC)
93
94#### Tools used to build a static library.
95#
96#ARX = ar cr
97#ARX = /opt/mingw/bin/i386-mingw32-ar cr
98AR += cr
99#RANLIB = ranlib
100#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib
101
102#MKSHLIB = gcc -shared
103#SO = so
104#SHPREFIX = lib
105MKSHLIB = $(CC) $(DEFINE_CC) -mrtp -shared $(CC_ARCH_SPEC) -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL)
106SO = so
107SHPREFIX = lib
108
109#### Extra compiler options needed for programs that use the TCL library.
110#
111#TCL_FLAGS =
112#TCL_FLAGS = -DSTATIC_BUILD=1
drhd7ceb372010-07-27 16:42:22 +0000113TCL_FLAGS = -I/home/drh/tcltk/8.5linux
114#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1
chw97185482008-11-17 08:05:31 +0000115#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
116
117#### Linker options needed to link against the TCL library.
118#
119#LIBTCL = -ltcl -lm -ldl
drhd7ceb372010-07-27 16:42:22 +0000120LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
121#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt
chw97185482008-11-17 08:05:31 +0000122#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
123
124#### Additional objects for SQLite library when TCL support is enabled.
125TCLOBJ =
126#TCLOBJ = tclsqlite.o
127
128#### Compiler options needed for programs that use the readline() library.
129#
130READLINE_FLAGS =
131#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline
132
133#### Linker options needed by programs using readline() must link against.
134#
135LIBREADLINE =
136#LIBREADLINE = -static -lreadline -ltermcap
137
138#### Which "awk" program provides nawk compatibilty
139#
140# NAWK = nawk
141NAWK = awk
142
143
144#### Pasted and adapted main.mk file
145###############################################################################
146# The following macros should be defined before this script is
147# invoked:
148#
149# TOP The toplevel directory of the source tree. This is the
150# directory that contains this "Makefile.in" and the
151# "configure.in" script.
152#
153# BCC C Compiler and options for use in building executables that
154# will run on the platform that is doing the build.
155#
156# THREADLIB Specify any extra linker options needed to make the library
157# thread safe
158#
159# OPTS Extra compiler command-line options.
160#
161# EXE The suffix to add to executable files. ".exe" for windows
162# and "" for Unix.
163#
164# TCC C Compiler and options for use in building executables that
165# will run on the target platform. This is usually the same
166# as BCC, unless you are cross-compiling.
167#
168# AR Tools used to build a static library.
169# RANLIB
170#
171# TCL_FLAGS Extra compiler options needed for programs that use the
172# TCL library.
173#
174# LIBTCL Linker options needed to link against the TCL library.
175#
176# READLINE_FLAGS Compiler options needed for programs that use the
177# readline() library.
178#
179# LIBREADLINE Linker options needed by programs using readline() must
180# link against.
181#
182# NAWK Nawk compatible awk program. Older (obsolete?) solaris
183# systems need this to avoid using the original AT&T AWK.
184#
185# Once the macros above are defined, the rest of this make script will
186# build the SQLite library and testing tools.
187################################################################################
188
189# This is how we compile
190#
chw73ccf012009-05-06 15:24:04 +0000191TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP)
192TCCX_SHARED = $(TCC_SHARED) $(OPTS) -I. -I$(TOP)/src -I$(TOP) \
193 -I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3 \
194 -I$(TOP)/ext/async
chw97185482008-11-17 08:05:31 +0000195
196# Object files for the SQLite library.
197#
198LIBOBJ+= alter.o analyze.o attach.o auth.o \
chw6de061a2009-04-13 08:14:03 +0000199 backup.o bitvec.o btmutex.o btree.o build.o \
chw73ccf012009-05-06 15:24:04 +0000200 callback.o complete.o date.o delete.o expr.o fault.o \
201 fts3.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
202 fts3_tokenizer.o fts3_tokenizer1.o \
203 func.o global.o hash.o \
chw97185482008-11-17 08:05:31 +0000204 icu.o insert.o journal.o legacy.o loadext.o \
chw73ccf012009-05-06 15:24:04 +0000205 main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
206 memjournal.o \
mistachkinf1c6bc52012-06-21 15:09:20 +0000207 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
208 notify.o opcodes.o os.o os_unix.o os_win.o \
chw6de061a2009-04-13 08:14:03 +0000209 pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
210 random.o resolve.o rowset.o rtree.o select.o status.o \
chw97185482008-11-17 08:05:31 +0000211 table.o tokenize.o trigger.o \
212 update.o util.o vacuum.o \
chw6de061a2009-04-13 08:14:03 +0000213 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o \
chw97185482008-11-17 08:05:31 +0000214 walker.o where.o utf.o vtab.o
215
216
chw73ccf012009-05-06 15:24:04 +0000217
chw97185482008-11-17 08:05:31 +0000218# All of the source code files.
219#
220SRC = \
221 $(TOP)/src/alter.c \
222 $(TOP)/src/analyze.c \
223 $(TOP)/src/attach.c \
224 $(TOP)/src/auth.c \
chw6de061a2009-04-13 08:14:03 +0000225 $(TOP)/src/backup.c \
chw97185482008-11-17 08:05:31 +0000226 $(TOP)/src/bitvec.c \
227 $(TOP)/src/btmutex.c \
228 $(TOP)/src/btree.c \
229 $(TOP)/src/btree.h \
230 $(TOP)/src/btreeInt.h \
231 $(TOP)/src/build.c \
232 $(TOP)/src/callback.c \
233 $(TOP)/src/complete.c \
shanehdc97a8c2010-02-23 20:08:35 +0000234 $(TOP)/src/ctime.c \
chw97185482008-11-17 08:05:31 +0000235 $(TOP)/src/date.c \
236 $(TOP)/src/delete.c \
237 $(TOP)/src/expr.c \
238 $(TOP)/src/fault.c \
239 $(TOP)/src/func.c \
240 $(TOP)/src/global.c \
241 $(TOP)/src/hash.c \
242 $(TOP)/src/hash.h \
243 $(TOP)/src/hwtime.h \
244 $(TOP)/src/insert.c \
245 $(TOP)/src/journal.c \
246 $(TOP)/src/legacy.c \
247 $(TOP)/src/loadext.c \
248 $(TOP)/src/main.c \
249 $(TOP)/src/malloc.c \
250 $(TOP)/src/mem0.c \
251 $(TOP)/src/mem1.c \
252 $(TOP)/src/mem2.c \
253 $(TOP)/src/mem3.c \
254 $(TOP)/src/mem5.c \
255 $(TOP)/src/memjournal.c \
256 $(TOP)/src/mutex.c \
257 $(TOP)/src/mutex.h \
chw73ccf012009-05-06 15:24:04 +0000258 $(TOP)/src/mutex_noop.c \
chw97185482008-11-17 08:05:31 +0000259 $(TOP)/src/mutex_unix.c \
260 $(TOP)/src/mutex_w32.c \
chw73ccf012009-05-06 15:24:04 +0000261 $(TOP)/src/notify.c \
chw97185482008-11-17 08:05:31 +0000262 $(TOP)/src/os.c \
263 $(TOP)/src/os.h \
264 $(TOP)/src/os_common.h \
chw97185482008-11-17 08:05:31 +0000265 $(TOP)/src/os_unix.c \
266 $(TOP)/src/os_win.c \
267 $(TOP)/src/pager.c \
268 $(TOP)/src/pager.h \
269 $(TOP)/src/parse.y \
270 $(TOP)/src/pcache.c \
271 $(TOP)/src/pcache.h \
chw73ccf012009-05-06 15:24:04 +0000272 $(TOP)/src/pcache1.c \
chw97185482008-11-17 08:05:31 +0000273 $(TOP)/src/pragma.c \
274 $(TOP)/src/prepare.c \
275 $(TOP)/src/printf.c \
276 $(TOP)/src/random.c \
277 $(TOP)/src/resolve.c \
chw6de061a2009-04-13 08:14:03 +0000278 $(TOP)/src/rowset.c \
chw97185482008-11-17 08:05:31 +0000279 $(TOP)/src/select.c \
280 $(TOP)/src/status.c \
281 $(TOP)/src/shell.c \
282 $(TOP)/src/sqlite.h.in \
283 $(TOP)/src/sqlite3ext.h \
284 $(TOP)/src/sqliteInt.h \
285 $(TOP)/src/sqliteLimit.h \
286 $(TOP)/src/table.c \
287 $(TOP)/src/tclsqlite.c \
288 $(TOP)/src/tokenize.c \
289 $(TOP)/src/trigger.c \
290 $(TOP)/src/utf.c \
291 $(TOP)/src/update.c \
292 $(TOP)/src/util.c \
293 $(TOP)/src/vacuum.c \
294 $(TOP)/src/vdbe.c \
295 $(TOP)/src/vdbe.h \
296 $(TOP)/src/vdbeapi.c \
297 $(TOP)/src/vdbeaux.c \
298 $(TOP)/src/vdbeblob.c \
chw97185482008-11-17 08:05:31 +0000299 $(TOP)/src/vdbemem.c \
300 $(TOP)/src/vdbeInt.h \
301 $(TOP)/src/vtab.c \
302 $(TOP)/src/walker.c \
303 $(TOP)/src/where.c
304
305# Source code for extensions
306#
307SRC += \
308 $(TOP)/ext/fts1/fts1.c \
309 $(TOP)/ext/fts1/fts1.h \
310 $(TOP)/ext/fts1/fts1_hash.c \
311 $(TOP)/ext/fts1/fts1_hash.h \
312 $(TOP)/ext/fts1/fts1_porter.c \
313 $(TOP)/ext/fts1/fts1_tokenizer.h \
314 $(TOP)/ext/fts1/fts1_tokenizer1.c
315SRC += \
316 $(TOP)/ext/fts2/fts2.c \
317 $(TOP)/ext/fts2/fts2.h \
318 $(TOP)/ext/fts2/fts2_hash.c \
319 $(TOP)/ext/fts2/fts2_hash.h \
320 $(TOP)/ext/fts2/fts2_icu.c \
321 $(TOP)/ext/fts2/fts2_porter.c \
322 $(TOP)/ext/fts2/fts2_tokenizer.h \
323 $(TOP)/ext/fts2/fts2_tokenizer.c \
324 $(TOP)/ext/fts2/fts2_tokenizer1.c
325SRC += \
326 $(TOP)/ext/fts3/fts3.c \
327 $(TOP)/ext/fts3/fts3.h \
chw6de061a2009-04-13 08:14:03 +0000328 $(TOP)/ext/fts3/fts3_expr.c \
329 $(TOP)/ext/fts3/fts3_expr.h \
chw97185482008-11-17 08:05:31 +0000330 $(TOP)/ext/fts3/fts3_hash.c \
331 $(TOP)/ext/fts3/fts3_hash.h \
332 $(TOP)/ext/fts3/fts3_icu.c \
333 $(TOP)/ext/fts3/fts3_porter.c \
334 $(TOP)/ext/fts3/fts3_tokenizer.h \
335 $(TOP)/ext/fts3/fts3_tokenizer.c \
336 $(TOP)/ext/fts3/fts3_tokenizer1.c
337SRC += \
chw73ccf012009-05-06 15:24:04 +0000338 $(TOP)/ext/icu/sqliteicu.h \
339 $(TOP)/ext/icu/icu.c
chw97185482008-11-17 08:05:31 +0000340SRC += \
341 $(TOP)/ext/rtree/rtree.h \
342 $(TOP)/ext/rtree/rtree.c
343
344
345# Generated source code files
346#
347SRC += \
348 keywordhash.h \
349 opcodes.c \
350 opcodes.h \
351 parse.c \
352 parse.h \
353 sqlite3.h
354
355
356# Source code to the test files.
357#
358TESTSRC = \
359 $(TOP)/src/test1.c \
360 $(TOP)/src/test2.c \
361 $(TOP)/src/test3.c \
362 $(TOP)/src/test4.c \
363 $(TOP)/src/test5.c \
364 $(TOP)/src/test6.c \
365 $(TOP)/src/test7.c \
366 $(TOP)/src/test8.c \
367 $(TOP)/src/test9.c \
368 $(TOP)/src/test_autoext.c \
369 $(TOP)/src/test_async.c \
chw73ccf012009-05-06 15:24:04 +0000370 $(TOP)/src/test_backup.c \
chw97185482008-11-17 08:05:31 +0000371 $(TOP)/src/test_btree.c \
372 $(TOP)/src/test_config.c \
373 $(TOP)/src/test_devsym.c \
374 $(TOP)/src/test_func.c \
375 $(TOP)/src/test_hexio.c \
chw73ccf012009-05-06 15:24:04 +0000376 $(TOP)/src/test_journal.c \
chw97185482008-11-17 08:05:31 +0000377 $(TOP)/src/test_malloc.c \
378 $(TOP)/src/test_md5.c \
379 $(TOP)/src/test_mutex.c \
380 $(TOP)/src/test_onefile.c \
381 $(TOP)/src/test_osinst.c \
chw73ccf012009-05-06 15:24:04 +0000382 $(TOP)/src/test_pcache.c \
chw97185482008-11-17 08:05:31 +0000383 $(TOP)/src/test_schema.c \
384 $(TOP)/src/test_server.c \
385 $(TOP)/src/test_tclvar.c \
386 $(TOP)/src/test_thread.c \
shaneh84aab392010-05-06 15:35:59 +0000387 $(TOP)/src/test_vfs.c \
chw73ccf012009-05-06 15:24:04 +0000388 $(TOP)/src/test_wsd.c \
chw97185482008-11-17 08:05:31 +0000389
390#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
391#TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
392
393TESTSRC2 = \
chw73ccf012009-05-06 15:24:04 +0000394 $(TOP)/src/attach.c $(TOP)/src/backup.c $(TOP)/src/btree.c \
shanehdc97a8c2010-02-23 20:08:35 +0000395 $(TOP)/src/build.c $(TOP)/src/ctime.c $(TOP)/src/date.c \
chw97185482008-11-17 08:05:31 +0000396 $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \
mistachkinf1c6bc52012-06-21 15:09:20 +0000397 $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
chw97185482008-11-17 08:05:31 +0000398 $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
399 $(TOP)/src/printf.c $(TOP)/src/random.c $(TOP)/src/pcache.c \
chw73ccf012009-05-06 15:24:04 +0000400 $(TOP)/src/pcache1.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
chw97185482008-11-17 08:05:31 +0000401 $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
chw73ccf012009-05-06 15:24:04 +0000402 $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c \
403 $(TOP)/ext/fts3/fts3.c $(TOP)/ext/fts3/fts3_expr.c \
404 $(TOP)/ext/fts3/fts3_tokenizer.c \
405 $(TOP)/ext/async/sqlite3async.c
chw97185482008-11-17 08:05:31 +0000406
407# Header files used by all library source files.
408#
409HDR = \
410 $(TOP)/src/btree.h \
411 $(TOP)/src/btreeInt.h \
412 $(TOP)/src/hash.h \
413 $(TOP)/src/hwtime.h \
414 keywordhash.h \
415 $(TOP)/src/mutex.h \
416 opcodes.h \
417 $(TOP)/src/os.h \
418 $(TOP)/src/os_common.h \
419 $(TOP)/src/pager.h \
420 $(TOP)/src/pcache.h \
421 parse.h \
422 sqlite3.h \
423 $(TOP)/src/sqlite3ext.h \
424 $(TOP)/src/sqliteInt.h \
425 $(TOP)/src/sqliteLimit.h \
426 $(TOP)/src/vdbe.h \
427 $(TOP)/src/vdbeInt.h
428
429# Header files used by extensions
430#
431EXTHDR += \
432 $(TOP)/ext/fts1/fts1.h \
433 $(TOP)/ext/fts1/fts1_hash.h \
434 $(TOP)/ext/fts1/fts1_tokenizer.h
435EXTHDR += \
436 $(TOP)/ext/fts2/fts2.h \
437 $(TOP)/ext/fts2/fts2_hash.h \
438 $(TOP)/ext/fts2/fts2_tokenizer.h
439EXTHDR += \
440 $(TOP)/ext/fts3/fts3.h \
chw73ccf012009-05-06 15:24:04 +0000441 $(TOP)/ext/fts3/fts3_expr.h \
chw97185482008-11-17 08:05:31 +0000442 $(TOP)/ext/fts3/fts3_hash.h \
443 $(TOP)/ext/fts3/fts3_tokenizer.h
444EXTHDR += \
445 $(TOP)/ext/rtree/rtree.h
chw73ccf012009-05-06 15:24:04 +0000446EXTHDR += \
447 $(TOP)/ext/icu/sqliteicu.h
chw97185482008-11-17 08:05:31 +0000448
449# This is the default Makefile target. The objects listed here
450# are what get build when you type just "make" with no arguments.
451#
452all: sqlite3.h libsqlite3.a sqlite3$(EXE)
453
454libsqlite3.a: $(LIBOBJ)
455 $(AR) libsqlite3.a $(LIBOBJ)
456 $(RANLIB) libsqlite3.a
457
458$(SHPREFIX)sqlite3.$(SO): $(LIBOBJ)
459 $(MKSHLIB) -o $(SHPREFIX)sqlite3.$(SO) $(LIBOBJ) $(TLIBS_SHARED)
460
461sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
462 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
463 $(TOP)/src/shell.c \
464 $(LIBREADLINE) $(TLIBS) $(THREADLIB) -L. -lsqlite3
465
466# This target creates a directory named "tsrc" and fills it with
467# copies of all of the C source code and header files needed to
468# build on the target system. Some of the C source code and header
469# files are automatically generated. This target takes care of
470# all that automatic generation.
471#
472target_source: $(SRC)
473 rm -rf tsrc
474 mkdir tsrc
475 cp -f $(SRC) tsrc
476 rm tsrc/sqlite.h.in tsrc/parse.y
477 touch target_source
478
479sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
480 tclsh $(TOP)/tool/mksqlite3c.tcl
481 cp sqlite3.c tclsqlite3.c
482 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
483
484fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
485 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
486
487fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
488 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
489
490# Rules to build the LEMON compiler generator
491#
drh53bc21b2009-07-03 17:09:28 +0000492lemon: $(TOP)/tool/lemon.c $(TOP)/src/lempar.c
chw97185482008-11-17 08:05:31 +0000493 $(BCC) -o lemon $(TOP)/tool/lemon.c
drh53bc21b2009-07-03 17:09:28 +0000494 cp $(TOP)/src/lempar.c .
chw97185482008-11-17 08:05:31 +0000495
496# Rules to build individual *.o files from generated *.c files. This
497# applies to:
498#
499# parse.o
500# opcodes.o
501#
502%.o: %.c $(HDR)
503 $(TCCX_SHARED) -c $<
504
505# Rules to build individual *.o files from files in the src directory.
506#
507%.o: $(TOP)/src/%.c $(HDR)
508 $(TCCX_SHARED) -c $<
509
510tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
511 $(TCCX_SHARED) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
512
513
514
515# Rules to build opcodes.c and opcodes.h
516#
517opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
drh307ff302011-08-30 01:29:04 +0000518 $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c
chw97185482008-11-17 08:05:31 +0000519
520opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
521 cat parse.h $(TOP)/src/vdbe.c | \
522 $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
523
524# Rules to build parse.c and parse.h - the outputs of lemon.
525#
526parse.h: parse.c
527
528parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
529 cp $(TOP)/src/parse.y .
530 rm -f parse.h
531 ./lemon $(OPTS) parse.y
532 mv parse.h parse.h.temp
533 awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
534
535sqlite3.h: $(TOP)/src/sqlite.h.in
536 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
537 -e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' | $(NAWK) '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \
538 $(TOP)/src/sqlite.h.in >sqlite3.h
539
540keywordhash.h: $(TOP)/tool/mkkeywordhash.c
541 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
542 ./mkkeywordhash >keywordhash.h
543
544
545
546# Rules to build the extension objects.
547#
548icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
549 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
550
551fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
552 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
553
554fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
555 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
556
557fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
558 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
559
560fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
561 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
562
563fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
564 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
565
566fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
567 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
568
569fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
570 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
571
chw73ccf012009-05-06 15:24:04 +0000572fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
573 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
574
chw97185482008-11-17 08:05:31 +0000575fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
576 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
577
578fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
579 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
580
581fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
582 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
583
584fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
585 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
586
587fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
588 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
589
590rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
591 $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
592
593
594# Rules for building test programs and for running tests
595#
596tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
597 $(TCCX_SHARED) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
598 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
599
600
601# Rules to build the 'testfixture' application.
602#
603TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
604TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
605
606testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
607 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
608 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
609 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
610
611amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
612 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
613 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
614 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
615
616fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
617 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
618 -DSQLITE_ENABLE_FTS3=1 \
619 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
620 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
621
622fulltest: testfixture$(EXE) sqlite3$(EXE)
623 ./testfixture$(EXE) $(TOP)/test/all.test
624
625soaktest: testfixture$(EXE) sqlite3$(EXE)
dan0626dfc2010-06-15 06:56:37 +0000626 ./testfixture$(EXE) $(TOP)/test/all.test -soak=1
chw97185482008-11-17 08:05:31 +0000627
mistachkinc60941f2012-09-13 01:51:02 +0000628fulltestonly: testfixture$(EXE) sqlite3$(EXE)
629 ./testfixture$(EXE) $(TOP)/test/full.test
630
chw97185482008-11-17 08:05:31 +0000631test: testfixture$(EXE) sqlite3$(EXE)
632 ./testfixture$(EXE) $(TOP)/test/veryquick.test
633
634sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
635 $(TOP)/tool/spaceanal.tcl
636 sed \
637 -e '/^#/d' \
638 -e 's,\\,\\\\,g' \
639 -e 's,",\\",g' \
640 -e 's,^,",' \
641 -e 's,$$,\\n",' \
642 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
643 $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
644 -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
645 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
646 -o sqlite3_analyzer$(EXE) \
647 $(LIBTCL) $(THREADLIB)
648
649TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
650$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
651 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
652
653extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
654 ./testfixture$(EXE) $(TOP)/test/loadext.test
655
656clean:
657 rm -f *.o sqlite3$(EXE) libsqlite3.a sqlite3.h opcodes.*
658 rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
659 rm -f $(PUBLISH)
660 rm -f *.da *.bb *.bbg gmon.out
mistachkinf8a78462012-03-08 20:00:36 +0000661 rm -rf quota2a quota2b quota2c
chw97185482008-11-17 08:05:31 +0000662 rm -rf tsrc target_source
663 rm -f testloadext.dll libtestloadext.so
664 rm -f sqlite3.c fts?amal.c tclsqlite3.c
mistachkinfde3b1c72013-03-29 19:52:04 +0000665 rm -f sqlite3rc.h
666 rm -f shell.c sqlite3ext.h
chw97185482008-11-17 08:05:31 +0000667 rm -f $(SHPREFIX)sqlite3.$(SO)