xref: /sqlite-3.40.0/Makefile.in (revision 8a29dfde)
1#!/usr/make
2#
3# Makefile for SQLITE
4#
5# This makefile is suppose to be configured automatically using the
6# autoconf.  But if that does not work for you, you can configure
7# the makefile manually.  Just set the parameters below to values that
8# work well for your system.
9#
10# If the configure script does not work out-of-the-box, you might
11# be able to get it to work by giving it some hints.  See the comment
12# at the beginning of configure.in for additional information.
13#
14
15# The toplevel directory of the source tree.  This is the directory
16# that contains this "Makefile.in" and the "configure.in" script.
17#
18TOP = @srcdir@
19
20# C Compiler and options for use in building executables that
21# will run on the platform that is doing the build.
22#
23BCC = @BUILD_CC@ @BUILD_CFLAGS@
24
25# C Compile and options for use in building executables that
26# will run on the target platform.  (BCC and TCC are usually the
27# same unless your are cross-compiling.)
28#
29TCC = @CC@ @CPPFLAGS@ @CFLAGS@ -I. -I${TOP}/src
30
31# Define -DNDEBUG to compile without debugging (i.e., for production usage)
32# Omitting the define will cause extra debugging code to be inserted and
33# includes extra comments when "EXPLAIN stmt" is used.
34#
35TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
36
37# Compiler options needed for programs that use the TCL library.
38#
39TCC += @TCL_INCLUDE_SPEC@
40
41# The library that programs using TCL must link against.
42#
43LIBTCL = @TCL_LIB_SPEC@ @TCL_LIBS@
44
45# Compiler options needed for programs that use the readline() library.
46#
47READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
48
49# The library that programs using readline() must link against.
50#
51LIBREADLINE = @TARGET_READLINE_LIBS@
52
53# Should the database engine be compiled threadsafe
54#
55TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
56
57# Do threads override each others locks by default (1), or do we test (-1)
58#
59TCC += -DSQLITE_THREAD_OVERRIDE_LOCK=@THREADSOVERRIDELOCKS@
60
61# Any target libraries which libsqlite must be linked against
62#
63TLIBS = @LIBS@
64
65# Flags controlling use of the in memory btree implementation
66#
67# TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
68# default to file, 2 to default to memory, and 3 to force temporary
69# tables to always be in memory.
70#
71TEMP_STORE = -DTEMP_STORE=@TEMP_STORE@
72
73# Enable/disable loadable extensions based on configuration
74TCC += @LOADEXTENSION_FLAGS@
75
76# Version numbers and release number for the SQLite being compiled.
77#
78VERSION = @VERSION@
79VERSION_NUMBER = @VERSION_NUMBER@
80RELEASE = @RELEASE@
81
82# Filename extensions
83#
84BEXE = @BUILD_EXEEXT@
85TEXE = @TARGET_EXEEXT@
86
87# The following variable is "1" if the configure script was able to locate
88# the tclConfig.sh file.  It is an empty string otherwise.  When this
89# variable is "1", the TCL extension library (libtclsqlite3.so) is built
90# and installed.
91#
92HAVE_TCL = @HAVE_TCL@
93
94# This is the command to use for tclsh - normally just "tclsh", but we may
95# know the specific version we want to use
96#
97TCLSH_CMD = @TCLSH_CMD@
98
99# The suffix used on shared libraries.  Ex:  ".dll", ".so", ".dylib"
100#
101SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
102
103# If gcov support was enabled by the configure script, add the appropriate
104# flags here.  It's not always as easy as just having the user add the right
105# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
106# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
107# Supposedly GCC does the right thing if you use --coverage, but in
108# practice it still fails.  See:
109#
110# http://www.mail-archive.com/[email protected]/msg26197.html
111#
112# for more info.
113#
114GCOV_CFLAGS1 = -fprofile-arcs -ftest-coverage
115GCOV_LDFLAGS1 = -lgcov
116USE_GCOV = @USE_GCOV@
117LTCOMPILE_EXTRAS += $(GCOV_CFLAGS$(USE_GCOV))
118LTLINK_EXTRAS += $(GCOV_LDFLAGS$(USE_GCOV))
119
120
121# The directory into which to store package information for
122
123# Some standard variables and programs
124#
125prefix = @prefix@
126exec_prefix = @exec_prefix@
127libdir = @libdir@
128bindir = @bindir@
129includedir = @includedir@
130INSTALL = @INSTALL@
131LIBTOOL = ./libtool
132ALLOWRELEASE = @ALLOWRELEASE@
133
134# libtool compile/link/install
135LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC) $(LTCOMPILE_EXTRAS)
136LTLINK = $(LIBTOOL) --mode=link $(TCC) @LDFLAGS@ $(LTLINK_EXTRAS)
137LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
138
139# nawk compatible awk.
140NAWK = @AWK@
141
142# You should not have to change anything below this line
143###############################################################################
144
145# Object files for the SQLite library (non-amalgamation).
146#
147OBJS0 = alter.lo analyze.lo attach.lo auth.lo bitvec.lo btmutex.lo \
148        btree.lo build.lo callback.lo complete.lo date.lo \
149        delete.lo expr.lo fault.lo func.lo \
150        hash.lo journal.lo insert.lo loadext.lo \
151        main.lo malloc.lo mem1.lo mem2.lo mem3.lo mem4.lo mem5.lo mutex.lo \
152        mutex_os2.lo mutex_unix.lo mutex_w32.lo \
153        opcodes.lo os.lo os_unix.lo os_win.lo os_os2.lo \
154        pager.lo parse.lo pragma.lo prepare.lo printf.lo random.lo \
155        select.lo table.lo tokenize.lo trigger.lo update.lo \
156        util.lo vacuum.lo \
157        vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbefifo.lo vdbemem.lo \
158        where.lo utf.lo legacy.lo vtab.lo
159
160# Object files for the amalgamation.
161#
162OBJS1 = sqlite3.lo
163
164# Determine the real value of LIBOBJ based on the 'configure' script
165#
166USE_AMALGAMATION = @USE_AMALGAMATION@
167LIBOBJ = $(OBJS$(USE_AMALGAMATION))
168
169
170# All of the source code files.
171#
172SRC = \
173  $(TOP)/src/alter.c \
174  $(TOP)/src/analyze.c \
175  $(TOP)/src/attach.c \
176  $(TOP)/src/auth.c \
177  $(TOP)/src/bitvec.c \
178  $(TOP)/src/btmutex.c \
179  $(TOP)/src/btree.c \
180  $(TOP)/src/btree.h \
181  $(TOP)/src/btreeInt.h \
182  $(TOP)/src/build.c \
183  $(TOP)/src/callback.c \
184  $(TOP)/src/complete.c \
185  $(TOP)/src/date.c \
186  $(TOP)/src/delete.c \
187  $(TOP)/src/expr.c \
188  $(TOP)/src/fault.c \
189  $(TOP)/src/func.c \
190  $(TOP)/src/hash.c \
191  $(TOP)/src/hash.h \
192  $(TOP)/src/insert.c \
193  $(TOP)/src/journal.c \
194  $(TOP)/src/legacy.c \
195  $(TOP)/src/loadext.c \
196  $(TOP)/src/main.c \
197  $(TOP)/src/malloc.c \
198  $(TOP)/src/mem1.c \
199  $(TOP)/src/mem2.c \
200  $(TOP)/src/mem3.c \
201  $(TOP)/src/mem4.c \
202  $(TOP)/src/mem5.c \
203  $(TOP)/src/mutex.c \
204  $(TOP)/src/mutex.h \
205  $(TOP)/src/mutex_os2.c \
206  $(TOP)/src/mutex_unix.c \
207  $(TOP)/src/mutex_w32.c \
208  $(TOP)/src/os.c \
209  $(TOP)/src/os.h \
210  $(TOP)/src/os_common.h \
211  $(TOP)/src/os_unix.c \
212  $(TOP)/src/os_win.c \
213  $(TOP)/src/os_os2.c \
214  $(TOP)/src/pager.c \
215  $(TOP)/src/pager.h \
216  $(TOP)/src/parse.y \
217  $(TOP)/src/pragma.c \
218  $(TOP)/src/prepare.c \
219  $(TOP)/src/printf.c \
220  $(TOP)/src/random.c \
221  $(TOP)/src/select.c \
222  $(TOP)/src/shell.c \
223  $(TOP)/src/sqlite.h.in \
224  $(TOP)/src/sqlite3ext.h \
225  $(TOP)/src/sqliteInt.h \
226  $(TOP)/src/sqliteLimit.h \
227  $(TOP)/src/table.c \
228  $(TOP)/src/tclsqlite.c \
229  $(TOP)/src/tokenize.c \
230  $(TOP)/src/trigger.c \
231  $(TOP)/src/utf.c \
232  $(TOP)/src/update.c \
233  $(TOP)/src/util.c \
234  $(TOP)/src/vacuum.c \
235  $(TOP)/src/vdbe.c \
236  $(TOP)/src/vdbe.h \
237  $(TOP)/src/vdbeapi.c \
238  $(TOP)/src/vdbeaux.c \
239  $(TOP)/src/vdbeblob.c \
240  $(TOP)/src/vdbefifo.c \
241  $(TOP)/src/vdbemem.c \
242  $(TOP)/src/vdbeInt.h \
243  $(TOP)/src/vtab.c \
244  $(TOP)/src/where.c
245
246# Generated source code files
247#
248SRC += \
249  keywordhash.h \
250  opcodes.c \
251  opcodes.h \
252  parse.c \
253  parse.h \
254  config.h \
255  sqlite3.h
256
257# Source code for extensions
258#
259SRC += \
260  $(TOP)/ext/fts1/fts1.c \
261  $(TOP)/ext/fts1/fts1.h \
262  $(TOP)/ext/fts1/fts1_hash.c \
263  $(TOP)/ext/fts1/fts1_hash.h \
264  $(TOP)/ext/fts1/fts1_porter.c \
265  $(TOP)/ext/fts1/fts1_tokenizer.h \
266  $(TOP)/ext/fts1/fts1_tokenizer1.c
267SRC += \
268  $(TOP)/ext/fts2/fts2.c \
269  $(TOP)/ext/fts2/fts2.h \
270  $(TOP)/ext/fts2/fts2_hash.c \
271  $(TOP)/ext/fts2/fts2_hash.h \
272  $(TOP)/ext/fts2/fts2_icu.c \
273  $(TOP)/ext/fts2/fts2_porter.c \
274  $(TOP)/ext/fts2/fts2_tokenizer.h \
275  $(TOP)/ext/fts2/fts2_tokenizer.c \
276  $(TOP)/ext/fts2/fts2_tokenizer1.c
277SRC += \
278  $(TOP)/ext/fts3/fts3.c \
279  $(TOP)/ext/fts3/fts3.h \
280  $(TOP)/ext/fts3/fts3_hash.c \
281  $(TOP)/ext/fts3/fts3_hash.h \
282  $(TOP)/ext/fts3/fts3_icu.c \
283  $(TOP)/ext/fts3/fts3_porter.c \
284  $(TOP)/ext/fts3/fts3_tokenizer.h \
285  $(TOP)/ext/fts3/fts3_tokenizer.c \
286  $(TOP)/ext/fts3/fts3_tokenizer1.c
287SRC += \
288  $(TOP)/ext/icu/icu.c
289
290# Source code to the library files needed by the test fixture
291#
292TESTSRC2 = \
293  $(TOP)/src/attach.c \
294  $(TOP)/src/bitvec.c \
295  $(TOP)/src/btree.c \
296  $(TOP)/src/build.c \
297  $(TOP)/src/date.c \
298  $(TOP)/src/expr.c \
299  $(TOP)/src/func.c \
300  $(TOP)/src/insert.c \
301  $(TOP)/src/malloc.c \
302  $(TOP)/src/os.c \
303  $(TOP)/src/os_os2.c \
304  $(TOP)/src/os_unix.c \
305  $(TOP)/src/os_win.c \
306  $(TOP)/src/pager.c \
307  $(TOP)/src/pragma.c \
308  $(TOP)/src/prepare.c \
309  $(TOP)/src/printf.c \
310  $(TOP)/src/random.c \
311  $(TOP)/src/select.c \
312  $(TOP)/src/tokenize.c \
313  $(TOP)/src/utf.c \
314  $(TOP)/src/util.c \
315  $(TOP)/src/vdbe.c \
316  $(TOP)/src/vdbeapi.c \
317  $(TOP)/src/vdbeaux.c \
318  $(TOP)/src/vdbemem.c \
319  $(TOP)/src/where.c \
320  parse.c
321
322# Source code to the actual test files.
323#
324TESTSRC = \
325  $(TOP)/src/test1.c \
326  $(TOP)/src/test2.c \
327  $(TOP)/src/test3.c \
328  $(TOP)/src/test4.c \
329  $(TOP)/src/test5.c \
330  $(TOP)/src/test6.c \
331  $(TOP)/src/test7.c \
332  $(TOP)/src/test8.c \
333  $(TOP)/src/test9.c \
334  $(TOP)/src/test_autoext.c \
335  $(TOP)/src/test_async.c \
336  $(TOP)/src/test_btree.c \
337  $(TOP)/src/test_config.c \
338  $(TOP)/src/test_devsym.c \
339  $(TOP)/src/test_func.c \
340  $(TOP)/src/test_hexio.c \
341  $(TOP)/src/test_malloc.c \
342  $(TOP)/src/test_md5.c \
343  $(TOP)/src/test_onefile.c \
344  $(TOP)/src/test_schema.c \
345  $(TOP)/src/test_server.c \
346  $(TOP)/src/test_tclvar.c \
347  $(TOP)/src/test_thread.c
348
349# Header files used by all library source files.
350#
351HDR = \
352   sqlite3.h  \
353   $(TOP)/src/btree.h \
354   $(TOP)/src/btreeInt.h \
355   $(TOP)/src/hash.h \
356   $(TOP)/src/sqliteLimit.h \
357   $(TOP)/src/mutex.h \
358   opcodes.h \
359   $(TOP)/src/os.h \
360   $(TOP)/src/os_common.h \
361   $(TOP)/src/sqlite3ext.h \
362   $(TOP)/src/sqliteInt.h  \
363   $(TOP)/src/vdbe.h \
364   $(TOP)/src/vdbeInt.h \
365   parse.h \
366   config.h
367
368# Header files used by extensions
369#
370HDR += \
371  $(TOP)/ext/fts1/fts1.h \
372  $(TOP)/ext/fts1/fts1_hash.h \
373  $(TOP)/ext/fts1/fts1_tokenizer.h
374HDR += \
375  $(TOP)/ext/fts2/fts2.h \
376  $(TOP)/ext/fts2/fts2_hash.h \
377  $(TOP)/ext/fts2/fts2_tokenizer.h
378HDR += \
379  $(TOP)/ext/fts3/fts3.h \
380  $(TOP)/ext/fts3/fts3_hash.h \
381  $(TOP)/ext/fts3/fts3_tokenizer.h
382
383# If using the amalgamation, use sqlite3.c directly to build the test
384# fixture.  Otherwise link against libsqlite3.la.  (This distinction is
385# necessary because the test fixture requires non-API symbols which are
386# hidden when the library is built via the amalgamation).
387#
388TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
389TESTFIXTURE_SRC1 = sqlite3.c
390TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
391
392
393# This is the default Makefile target.  The objects listed here
394# are what get build when you type just "make" with no arguments.
395#
396all:	sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
397
398Makefile: $(TOP)/Makefile.in
399	./config.status
400
401# Generate the file "last_change" which contains the date of change
402# of the most recently modified source code file
403#
404last_change:	$(SRC)
405	cat $(SRC) | grep '$$Id: ' | sort -k 5 | tail -1 \
406          | $(NAWK) '{print $$5,$$6}' >last_change
407
408libsqlite3.la:	$(LIBOBJ)
409	$(LTLINK) -o $@ $(LIBOBJ) $(TLIBS) \
410		${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8"
411
412libtclsqlite3.la:	tclsqlite.lo libsqlite3.la
413	$(LTLINK) -o $@ tclsqlite.lo \
414		$(LIBOBJ) @TCL_STUB_LIB_SPEC@ $(TLIBS) \
415                -rpath "$(libdir)/sqlite" \
416		-version-info "8:6:8"
417
418sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h
419	$(LTLINK) $(READLINE_FLAGS) \
420		-o $@ $(TOP)/src/shell.c libsqlite3.la \
421		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
422
423# This target creates a directory named "tsrc" and fills it with
424# copies of all of the C source code and header files needed to
425# build on the target system.  Some of the C source code and header
426# files are automatically generated.  This target takes care of
427# all that automatic generation.
428#
429.target_source:	$(SRC)
430	rm -rf tsrc
431	mkdir -p tsrc
432	cp $(SRC) tsrc
433	rm tsrc/sqlite.h.in tsrc/parse.y
434	touch .target_source
435
436sqlite3.c:	.target_source $(TOP)/tool/mksqlite3c.tcl
437	$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl
438
439# Rules to build the LEMON compiler generator
440#
441lemon$(BEXE):	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
442	$(BCC) -o $@ $(TOP)/tool/lemon.c
443	cp $(TOP)/tool/lempar.c .
444
445
446# Rule to build the amalgamation
447#
448sqlite3.lo:	sqlite3.c
449	$(LTCOMPILE) -c sqlite3.c
450
451# Rules to build individual files
452#
453alter.lo:	$(TOP)/src/alter.c $(HDR)
454	$(LTCOMPILE) -c $(TOP)/src/alter.c
455
456analyze.lo:	$(TOP)/src/analyze.c $(HDR)
457	$(LTCOMPILE) -c $(TOP)/src/analyze.c
458
459attach.lo:	$(TOP)/src/attach.c $(HDR)
460	$(LTCOMPILE) -c $(TOP)/src/attach.c
461
462auth.lo:	$(TOP)/src/auth.c $(HDR)
463	$(LTCOMPILE) -c $(TOP)/src/auth.c
464
465bitvec.lo:	$(TOP)/src/bitvec.c $(HDR)
466	$(LTCOMPILE) -c $(TOP)/src/bitvec.c
467
468btmutex.lo:	$(TOP)/src/btmutex.c $(HDR)
469	$(LTCOMPILE) -c $(TOP)/src/btmutex.c
470
471btree.lo:	$(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
472	$(LTCOMPILE) -c $(TOP)/src/btree.c
473
474build.lo:	$(TOP)/src/build.c $(HDR)
475	$(LTCOMPILE) -c $(TOP)/src/build.c
476
477callback.lo:	$(TOP)/src/callback.c $(HDR)
478	$(LTCOMPILE) -c $(TOP)/src/callback.c
479
480complete.lo:	$(TOP)/src/complete.c $(HDR)
481	$(LTCOMPILE) -c $(TOP)/src/complete.c
482
483date.lo:	$(TOP)/src/date.c $(HDR)
484	$(LTCOMPILE) -c $(TOP)/src/date.c
485
486delete.lo:	$(TOP)/src/delete.c $(HDR)
487	$(LTCOMPILE) -c $(TOP)/src/delete.c
488
489expr.lo:	$(TOP)/src/expr.c $(HDR)
490	$(LTCOMPILE) -c $(TOP)/src/expr.c
491
492fault.lo:	$(TOP)/src/fault.c $(HDR)
493	$(LTCOMPILE) -c $(TOP)/src/fault.c
494
495func.lo:	$(TOP)/src/func.c $(HDR)
496	$(LTCOMPILE) -c $(TOP)/src/func.c
497
498hash.lo:	$(TOP)/src/hash.c $(HDR)
499	$(LTCOMPILE) -c $(TOP)/src/hash.c
500
501insert.lo:	$(TOP)/src/insert.c $(HDR)
502	$(LTCOMPILE) -c $(TOP)/src/insert.c
503
504journal.lo:	$(TOP)/src/journal.c $(HDR)
505	$(LTCOMPILE) -c $(TOP)/src/journal.c
506
507legacy.lo:	$(TOP)/src/legacy.c $(HDR)
508	$(LTCOMPILE) -c $(TOP)/src/legacy.c
509
510loadext.lo:	$(TOP)/src/loadext.c $(HDR)
511	$(LTCOMPILE) -c $(TOP)/src/loadext.c
512
513main.lo:	$(TOP)/src/main.c $(HDR)
514	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/main.c
515
516malloc.lo:	$(TOP)/src/malloc.c $(HDR)
517	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/malloc.c
518
519mem1.lo:	$(TOP)/src/mem1.c $(HDR)
520	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem1.c
521
522mem2.lo:	$(TOP)/src/mem2.c $(HDR)
523	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem2.c
524
525mem3.lo:	$(TOP)/src/mem3.c $(HDR)
526	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem3.c
527
528mem4.lo:	$(TOP)/src/mem4.c $(HDR)
529	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem4.c
530
531mem5.lo:	$(TOP)/src/mem5.c $(HDR)
532	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem5.c
533
534mutex.lo:	$(TOP)/src/mutex.c $(HDR)
535	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex.c
536
537mutex_os2.lo:	$(TOP)/src/mutex_os2.c $(HDR)
538	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_os2.c
539
540mutex_unix.lo:	$(TOP)/src/mutex_unix.c $(HDR)
541	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_unix.c
542
543mutex_w32.lo:	$(TOP)/src/mutex_w32.c $(HDR)
544	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_w32.c
545
546pager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
547	$(LTCOMPILE) -c $(TOP)/src/pager.c
548
549opcodes.lo:	opcodes.c
550	$(LTCOMPILE) -c opcodes.c
551
552opcodes.c:	opcodes.h $(TOP)/mkopcodec.awk
553	sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
554
555opcodes.h:	parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
556	cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
557
558os.lo:	$(TOP)/src/os.c $(HDR)
559	$(LTCOMPILE) -c $(TOP)/src/os.c
560
561os_unix.lo:	$(TOP)/src/os_unix.c $(HDR)
562	$(LTCOMPILE) -c $(TOP)/src/os_unix.c
563
564os_win.lo:	$(TOP)/src/os_win.c $(HDR)
565	$(LTCOMPILE) -c $(TOP)/src/os_win.c
566
567os_os2.lo:	$(TOP)/src/os_os2.c $(HDR)
568	$(LTCOMPILE) -c $(TOP)/src/os_os2.c
569
570parse.lo:	parse.c $(HDR)
571	$(LTCOMPILE) -c parse.c
572
573parse.h:	parse.c
574
575parse.c:	$(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
576	cp $(TOP)/src/parse.y .
577	./lemon$(BEXE) $(OPTS) parse.y
578	mv parse.h parse.h.temp
579	$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
580
581pragma.lo:	$(TOP)/src/pragma.c $(HDR)
582	$(LTCOMPILE) -c $(TOP)/src/pragma.c
583
584prepare.lo:	$(TOP)/src/prepare.c $(HDR)
585	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/prepare.c
586
587printf.lo:	$(TOP)/src/printf.c $(HDR)
588	$(LTCOMPILE) -c $(TOP)/src/printf.c
589
590random.lo:	$(TOP)/src/random.c $(HDR)
591	$(LTCOMPILE) -c $(TOP)/src/random.c
592
593select.lo:	$(TOP)/src/select.c $(HDR)
594	$(LTCOMPILE) -c $(TOP)/src/select.c
595
596sqlite3.h:	$(TOP)/src/sqlite.h.in
597	sed -e s/--VERS--/$(RELEASE)/ $(TOP)/src/sqlite.h.in | \
598	sed -e s/--VERSION-NUMBER--/$(VERSION_NUMBER)/ >sqlite3.h
599
600table.lo:	$(TOP)/src/table.c $(HDR)
601	$(LTCOMPILE) -c $(TOP)/src/table.c
602
603tclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
604	$(LTCOMPILE) -c $(TOP)/src/tclsqlite.c
605
606tokenize.lo:	$(TOP)/src/tokenize.c keywordhash.h $(HDR)
607	$(LTCOMPILE) -c $(TOP)/src/tokenize.c
608
609keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
610	$(BCC) -o mkkeywordhash$(BEXE) $(OPTS) $(TOP)/tool/mkkeywordhash.c
611	./mkkeywordhash$(BEXE) >keywordhash.h
612
613trigger.lo:	$(TOP)/src/trigger.c $(HDR)
614	$(LTCOMPILE) -c $(TOP)/src/trigger.c
615
616update.lo:	$(TOP)/src/update.c $(HDR)
617	$(LTCOMPILE) -c $(TOP)/src/update.c
618
619utf.lo:	$(TOP)/src/utf.c $(HDR)
620	$(LTCOMPILE) -c $(TOP)/src/utf.c
621
622util.lo:	$(TOP)/src/util.c $(HDR)
623	$(LTCOMPILE) -c $(TOP)/src/util.c
624
625vacuum.lo:	$(TOP)/src/vacuum.c $(HDR)
626	$(LTCOMPILE) -c $(TOP)/src/vacuum.c
627
628vdbe.lo:	$(TOP)/src/vdbe.c $(HDR)
629	$(LTCOMPILE) -c $(TOP)/src/vdbe.c
630
631vdbeapi.lo:	$(TOP)/src/vdbeapi.c $(HDR)
632	$(LTCOMPILE) -c $(TOP)/src/vdbeapi.c
633
634vdbeaux.lo:	$(TOP)/src/vdbeaux.c $(HDR)
635	$(LTCOMPILE) -c $(TOP)/src/vdbeaux.c
636
637vdbeblob.lo:	$(TOP)/src/vdbeblob.c $(HDR)
638	$(LTCOMPILE) -c $(TOP)/src/vdbeblob.c
639
640vdbefifo.lo:	$(TOP)/src/vdbefifo.c $(HDR)
641	$(LTCOMPILE) -c $(TOP)/src/vdbefifo.c
642
643vdbemem.lo:	$(TOP)/src/vdbemem.c $(HDR)
644	$(LTCOMPILE) -c $(TOP)/src/vdbemem.c
645
646vtab.lo:	$(TOP)/src/vtab.c $(HDR)
647	$(LTCOMPILE) -c $(TOP)/src/vtab.c
648
649where.lo:	$(TOP)/src/where.c $(HDR)
650	$(LTCOMPILE) -c $(TOP)/src/where.c
651
652tclsqlite-shell.lo:	$(TOP)/src/tclsqlite.c $(HDR)
653	$(LTCOMPILE) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c
654
655tclsqlite-stubs.lo:	$(TOP)/src/tclsqlite.c $(HDR)
656	$(LTCOMPILE) -DTCL_USE_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c
657
658tclsqlite3$(TEXE):	tclsqlite-shell.lo libsqlite3.la
659	$(LTLINK) -o $@ tclsqlite-shell.lo \
660		 libsqlite3.la $(LIBTCL)
661
662testfixture$(TEXE):	$(TESTFIXTURE_SRC)
663	$(LTLINK) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
664                -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE $(TEMP_STORE) \
665		-o $@ $(TESTFIXTURE_SRC) $(LIBTCL)
666
667
668fulltest:	testfixture$(TEXE) sqlite3$(TEXE)
669	./testfixture$(TEXE) $(TOP)/test/all.test
670
671test:	testfixture$(TEXE) sqlite3$(TEXE)
672	./testfixture$(TEXE) $(TOP)/test/quick.test
673
674sqlite3_analyzer$(TEXE):	$(TESTFIXTURE_SRC) $(TOP)/tool/spaceanal.tcl
675	sed \
676	  -e '/^#/d' \
677	  -e 's,\\,\\\\,g' \
678	  -e 's,",\\",g' \
679	  -e 's,^,",' \
680	  -e 's,$$,\\n",' \
681	  $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
682	$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
683		-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
684		$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL)
685
686
687install:	sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
688	$(INSTALL) -d $(DESTDIR)$(libdir)
689	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
690	$(INSTALL) -d $(DESTDIR)$(bindir)
691	$(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
692	$(INSTALL) -d $(DESTDIR)$(includedir)
693	$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
694	$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
695	$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig;
696	$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig;
697
698tcl_install:	libtclsqlite3.la
699	$(TCLSH_CMD) $(TOP)/tclinstaller.tcl $(VERSION)
700
701clean:
702	rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
703	rm -f sqlite3.h opcodes.*
704	rm -rf .libs .deps tsrc
705	rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
706	rm -f mkkeywordhash$(BEXE) keywordhash.h
707	rm -f $(PUBLISH)
708	rm -f *.da *.bb *.bbg gmon.out
709	rm -f testfixture$(TEXE) test.db
710	rm -f common.tcl
711	rm -f sqlite3.dll sqlite3.lib sqlite3.def
712	rm -f sqlite3.c .target_source
713
714distclean:	clean
715	rm -f config.log config.status libtool Makefile sqlite3.pc
716
717#
718# Windows section
719#
720dll: sqlite3.dll
721
722REAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o)
723
724$(REAL_LIBOBJ): $(LIBOBJ)
725
726sqlite3.def: $(REAL_LIBOBJ)
727	echo 'EXPORTS' >sqlite3.def
728	nm $(REAL_LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \
729		| sed 's/^.* _//' >>sqlite3.def
730
731sqlite3.dll: $(REAL_LIBOBJ) sqlite3.def
732	$(TCC) -shared -o $@ sqlite3.def \
733		-Wl,"--strip-all" $(REAL_LIBOBJ)
734