xref: /sqlite-3.40.0/Makefile.in (revision ef5ecb41)
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 = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src
30
31# Some standard variables and programs
32#
33prefix = @prefix@
34exec_prefix = @exec_prefix@
35INSTALL = @INSTALL@
36LIBTOOL = ./libtool
37RELEASE = @ALLOWRELEASE@
38
39# libtool compile/link/install
40LTCOMPILE = $(LIBTOOL) --mode=compile $(TCC)
41LTLINK = $(LIBTOOL) --mode=link $(TCC)
42LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
43
44# Compiler options needed for programs that use the TCL library.
45#
46TCL_FLAGS = @TARGET_TCL_INC@
47
48# The library that programs using TCL must link against.
49#
50LIBTCL = @TARGET_TCL_LIBS@
51
52# Compiler options needed for programs that use the readline() library.
53#
54READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
55
56# The library that programs using readline() must link against.
57#
58LIBREADLINE = @TARGET_READLINE_LIBS@
59
60# Should the database engine assume text is coded as UTF-8 or iso8859?
61#
62# ENCODING  = UTF8
63# ENCODING  = ISO8859
64ENCODING = @ENCODING@
65
66# Flags controlling use of the in memory btree implementation
67#
68# SQLITE_OMIT_INMEMORYDB is defined in order to omit the in-memory
69# red/black tree driver in the file btree_rb.c
70#
71# TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
72# default to file, 2 to default to memory, and 3 to force temporary
73# tables to always be in memory.
74#
75INMEMORYDB = @INMEMORYDB@
76INCOREFLAGS = -DTEMP_STORE=@TEMP_STORE@
77
78ifeq (${INMEMORYDB},0)
79INCOREFLAGS += -DSQLITE_OMIT_INMEMORYDB=1
80endif
81
82# You should not have to change anything below this line
83###############################################################################
84
85# Object files for the SQLite library.
86#
87LIBOBJ = attach.lo auth.lo btree.lo build.lo copy.lo date.lo \
88         delete.lo encode.lo expr.lo func.lo hash.lo insert.lo \
89         main.lo opcodes.lo os.lo pager.lo parse.lo pragma.lo \
90         printf.lo random.lo select.lo table.lo tokenize.lo \
91         update.lo util.lo vacuum.lo vdbe.lo vdbeaux.lo \
92         where.lo trigger.lo
93
94# Only build the in-core DB if it is required.
95ifeq (${INMEMORYDB},1)
96LIBOBJ += btree_rb.lo
97endif
98
99# All of the source code files.
100#
101SRC = \
102  $(TOP)/src/attach.c \
103  $(TOP)/src/auth.c \
104  $(TOP)/src/btree.c \
105  $(TOP)/src/btree.h \
106  $(TOP)/src/btree_rb.c \
107  $(TOP)/src/build.c \
108  $(TOP)/src/copy.c \
109  $(TOP)/src/date.c \
110  $(TOP)/src/delete.c \
111  $(TOP)/src/encode.c \
112  $(TOP)/src/expr.c \
113  $(TOP)/src/func.c \
114  $(TOP)/src/hash.c \
115  $(TOP)/src/hash.h \
116  $(TOP)/src/insert.c \
117  $(TOP)/src/main.c \
118  $(TOP)/src/os.c \
119  $(TOP)/src/pager.c \
120  $(TOP)/src/pager.h \
121  $(TOP)/src/parse.y \
122  $(TOP)/src/pragma.c \
123  $(TOP)/src/printf.c \
124  $(TOP)/src/random.c \
125  $(TOP)/src/select.c \
126  $(TOP)/src/shell.c \
127  $(TOP)/src/sqlite.h.in \
128  $(TOP)/src/sqliteInt.h \
129  $(TOP)/src/table.c \
130  $(TOP)/src/tclsqlite.c \
131  $(TOP)/src/tokenize.c \
132  $(TOP)/src/trigger.c \
133  $(TOP)/src/update.c \
134  $(TOP)/src/util.c \
135  $(TOP)/src/vacuum.c \
136  $(TOP)/src/vdbe.c \
137  $(TOP)/src/vdbeaux.c \
138  $(TOP)/src/vdbe.h \
139  $(TOP)/src/where.c
140
141# Source code to the test files.
142#
143TESTSRC = \
144  $(TOP)/src/btree.c \
145  $(TOP)/src/func.c \
146  $(TOP)/src/os.c \
147  $(TOP)/src/pager.c \
148  $(TOP)/src/test1.c \
149  $(TOP)/src/test2.c \
150  $(TOP)/src/test3.c \
151  $(TOP)/src/test4.c \
152  $(TOP)/src/vdbe.c \
153  $(TOP)/src/md5.c
154
155# Header files used by all library source files.
156#
157HDR = \
158   sqlite.h  \
159   $(TOP)/src/btree.h \
160   config.h \
161   $(TOP)/src/hash.h \
162   opcodes.h \
163   $(TOP)/src/os.h \
164   $(TOP)/src/sqliteInt.h  \
165   $(TOP)/src/vdbe.h  \
166   parse.h
167
168# Header files used by the VDBE submodule
169#
170VDBEHDR = \
171   $(HDR) \
172   $(TOP)/src/vdbeInt.h
173
174# This is the default Makefile target.  The objects listed here
175# are what get build when you type just "make" with no arguments.
176#
177all:	sqlite.h libsqlite.la sqlite@TARGET_EXEEXT@
178
179Makefile: $(TOP)/Makefile.in
180	./config.status
181
182# Generate the file "last_change" which contains the date of change
183# of the most recently modified source code file
184#
185last_change:	$(SRC)
186	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
187          | awk '{print $$5,$$6}' >last_change
188
189libsqlite.la:	$(LIBOBJ)
190	$(LTLINK) -o libsqlite.la $(LIBOBJ) ${RELEASE} -rpath @exec_prefix@/lib \
191		-version-info "8:6:8"
192
193libtclsqlite.la:	tclsqlite.lo libsqlite.la
194	$(LTLINK) -o libtclsqlite.la tclsqlite.lo \
195		libsqlite.la $(LIBTCL) -rpath @exec_prefix@/lib/sqlite \
196		-version-info "8:6:8"
197
198sqlite@TARGET_EXEEXT@:	$(TOP)/src/shell.c libsqlite.la sqlite.h
199	$(LTLINK) $(READLINE_FLAGS) -o sqlite $(TOP)/src/shell.c \
200		libsqlite.la $(LIBREADLINE)
201
202# This target creates a directory named "tsrc" and fills it with
203# copies of all of the C source code and header files needed to
204# build on the target system.  Some of the C source code and header
205# files are automatically generated.  This target takes care of
206# all that automatic generation.
207#
208target_source:	$(SRC) $(VDBEHDR)
209	rm -rf tsrc
210	mkdir tsrc
211	cp $(SRC) $(VDBEHDR) tsrc
212	rm tsrc/sqlite.h.in tsrc/parse.y
213	cp parse.c opcodes.c tsrc
214
215# Rules to build the LEMON compiler generator
216#
217lemon@BUILD_EXEEXT@:	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
218	$(BCC) -o lemon $(TOP)/tool/lemon.c
219	cp $(TOP)/tool/lempar.c .
220
221btree.lo:	$(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
222	$(LTCOMPILE) -c $(TOP)/src/btree.c
223
224btree_rb.lo:	$(TOP)/src/btree_rb.c $(HDR)
225	$(LTCOMPILE) -c $(TOP)/src/btree_rb.c
226
227build.lo:	$(TOP)/src/build.c $(HDR)
228	$(LTCOMPILE) -c $(TOP)/src/build.c
229
230main.lo:	$(TOP)/src/main.c $(HDR)
231	$(LTCOMPILE) -c ${INCOREFLAGS} $(TOP)/src/main.c
232
233pager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
234	$(LTCOMPILE) -c $(TOP)/src/pager.c
235
236opcodes.lo:	opcodes.c
237	$(LTCOMPILE) -c opcodes.c
238
239opcodes.c:	$(TOP)/src/vdbe.c
240	echo '/* Automatically generated file.  Do not edit */' >opcodes.c
241	echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c
242	grep '^case OP_' $(TOP)/src/vdbe.c | \
243	  sed -e 's/^.*OP_/  "/' -e 's/:.*$$/", /' >>opcodes.c
244	echo '};' >>opcodes.c
245
246opcodes.h:	$(TOP)/src/vdbe.h
247	echo '/* Automatically generated file.  Do not edit */' >opcodes.h
248	grep '^case OP_' $(TOP)/src/vdbe.c | \
249	  sed -e 's/://' | \
250	  awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h
251
252os.lo:	$(TOP)/src/os.c $(HDR)
253	$(LTCOMPILE) -c $(TOP)/src/os.c
254
255parse.lo:	parse.c $(HDR)
256	$(LTCOMPILE) -c parse.c
257
258parse.h:	parse.c
259
260parse.c:	$(TOP)/src/parse.y lemon@BUILD_EXEEXT@
261	cp $(TOP)/src/parse.y .
262	./lemon parse.y
263
264# The config.h file will contain a single #define that tells us how
265# many bytes are in a pointer.  This only works if a pointer is the
266# same size on the host as it is on the target.  If you are cross-compiling
267# to a target with a different pointer size, you'll need to manually
268# configure the config.h file.
269#
270config.h:
271	echo '#include <stdio.h>' >temp.c
272	echo 'int main(){printf(' >>temp.c
273	echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >>temp.c
274	echo 'exit(0);}' >>temp.c
275	$(BCC) -o temp temp.c
276	./temp >config.h
277	echo >>config.h
278	rm -f temp.c temp
279
280sqlite.h:	$(TOP)/src/sqlite.h.in
281	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
282            -e s/--ENCODING--/$(ENCODING)/ \
283                 $(TOP)/src/sqlite.h.in >sqlite.h
284
285tokenize.lo:	$(TOP)/src/tokenize.c $(HDR)
286	$(LTCOMPILE) -c $(TOP)/src/tokenize.c
287
288util.lo:	$(TOP)/src/util.c $(HDR)
289	$(LTCOMPILE) -c $(TOP)/src/util.c
290
291vdbe.lo:	$(TOP)/src/vdbe.c $(VDBEHDR)
292	$(LTCOMPILE) -c $(TOP)/src/vdbe.c
293
294vdbeaux.lo:	$(TOP)/src/vdbe.c $(VDBEHDR)
295	$(LTCOMPILE) -c $(TOP)/src/vdbeaux.c
296
297where.lo:	$(TOP)/src/where.c $(HDR)
298	$(LTCOMPILE) -c $(TOP)/src/where.c
299
300copy.lo:	$(TOP)/src/copy.c $(HDR)
301	$(LTCOMPILE) -c $(TOP)/src/copy.c
302
303date.lo:	$(TOP)/src/date.c $(HDR)
304	$(LTCOMPILE) -c $(TOP)/src/date.c
305
306delete.lo:	$(TOP)/src/delete.c $(HDR)
307	$(LTCOMPILE) -c $(TOP)/src/delete.c
308
309encode.lo:	$(TOP)/src/encode.c
310	$(LTCOMPILE) -c $(TOP)/src/encode.c
311
312expr.lo:	$(TOP)/src/expr.c $(HDR)
313	$(LTCOMPILE) -c $(TOP)/src/expr.c
314
315func.lo:	$(TOP)/src/func.c $(HDR)
316	$(LTCOMPILE) -c $(TOP)/src/func.c
317
318hash.lo:	$(TOP)/src/hash.c $(HDR)
319	$(LTCOMPILE) -c $(TOP)/src/hash.c
320
321insert.lo:	$(TOP)/src/insert.c $(HDR)
322	$(LTCOMPILE) -c $(TOP)/src/insert.c
323
324random.lo:	$(TOP)/src/random.c $(HDR)
325	$(LTCOMPILE) -c $(TOP)/src/random.c
326
327select.lo:	$(TOP)/src/select.c $(HDR)
328	$(LTCOMPILE) -c $(TOP)/src/select.c
329
330table.lo:	$(TOP)/src/table.c $(HDR)
331	$(LTCOMPILE) -c $(TOP)/src/table.c
332
333trigger.lo:	$(TOP)/src/trigger.c $(HDR)
334	$(LTCOMPILE) -c $(TOP)/src/trigger.c
335
336update.lo:	$(TOP)/src/update.c $(HDR)
337	$(LTCOMPILE) -c $(TOP)/src/update.c
338
339vacuum.lo:	$(TOP)/src/vacuum.c $(HDR)
340	$(LTCOMPILE) -c $(TOP)/src/vacuum.c
341
342tclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
343	$(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
344
345pragma.lo:	$(TOP)/src/pragma.c $(HDR)
346	$(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/pragma.c
347
348printf.lo:	$(TOP)/src/printf.c $(HDR)
349	$(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/printf.c
350
351attach.lo:	$(TOP)/src/attach.c $(HDR)
352	$(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/attach.c
353
354auth.lo:	$(TOP)/src/auth.c $(HDR)
355	$(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/auth.c
356
357tclsqlite-sh.lo:	$(TOP)/src/tclsqlite.c $(HDR)
358	$(LTCOMPILE) $(TCL_FLAGS) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c
359
360tclsqlite:	tclsqlite-sh.lo libsqlite.la
361	$(LTLINK) $(TCL_FLAGS) -o tclsqlite tclsqlite-sh.lo libsqlite.la $(LIBTCL)
362
363testfixture@TARGET_EXEEXT@:	$(TOP)/src/tclsqlite.c libtclsqlite.la libsqlite.la $(TESTSRC)
364	$(LTLINK) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1\
365                -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \
366		libtclsqlite.la libsqlite.la $(LIBTCL)
367
368fulltest:	testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@
369	./testfixture $(TOP)/test/all.test
370
371test:	testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@
372	./testfixture $(TOP)/test/quick.test
373
374index.html:	$(TOP)/www/index.tcl last_change
375	tclsh $(TOP)/www/index.tcl `cat $(TOP)/VERSION` >index.html
376
377sqlite.html:	$(TOP)/www/sqlite.tcl
378	tclsh $(TOP)/www/sqlite.tcl >sqlite.html
379
380c_interface.html:	$(TOP)/www/c_interface.tcl
381	tclsh $(TOP)/www/c_interface.tcl >c_interface.html
382
383changes.html:	$(TOP)/www/changes.tcl
384	tclsh $(TOP)/www/changes.tcl >changes.html
385
386lang.html:	$(TOP)/www/lang.tcl
387	tclsh $(TOP)/www/lang.tcl >lang.html
388
389vdbe.html:	$(TOP)/www/vdbe.tcl
390	tclsh $(TOP)/www/vdbe.tcl >vdbe.html
391
392arch.html:	$(TOP)/www/arch.tcl
393	tclsh $(TOP)/www/arch.tcl >arch.html
394
395arch.png:	$(TOP)/www/arch.png
396	cp $(TOP)/www/arch.png .
397
398opcode.html:	$(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
399	tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
400
401mingw.html:	$(TOP)/www/mingw.tcl
402	tclsh $(TOP)/www/mingw.tcl >mingw.html
403
404tclsqlite.html:	$(TOP)/www/tclsqlite.tcl
405	tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html
406
407speed.html:	$(TOP)/www/speed.tcl
408	tclsh $(TOP)/www/speed.tcl >speed.html
409
410faq.html:	$(TOP)/www/faq.tcl
411	tclsh $(TOP)/www/faq.tcl >faq.html
412
413formatchng.html:	$(TOP)/www/formatchng.tcl
414	tclsh $(TOP)/www/formatchng.tcl >formatchng.html
415
416conflict.html:	$(TOP)/www/conflict.tcl
417	tclsh $(TOP)/www/conflict.tcl >conflict.html
418
419download.html:	$(TOP)/www/download.tcl
420	tclsh $(TOP)/www/download.tcl >download.html
421
422omitted.html:	$(TOP)/www/omitted.tcl
423	tclsh $(TOP)/www/omitted.tcl >omitted.html
424
425datatypes.html:	$(TOP)/www/datatypes.tcl
426	tclsh $(TOP)/www/datatypes.tcl >datatypes.html
427
428quickstart.html:	$(TOP)/www/quickstart.tcl
429	tclsh $(TOP)/www/quickstart.tcl >quickstart.html
430
431fileformat.html:	$(TOP)/www/fileformat.tcl
432	tclsh $(TOP)/www/fileformat.tcl >fileformat.html
433
434nulls.html:	$(TOP)/www/nulls.tcl
435	tclsh $(TOP)/www/nulls.tcl >nulls.html
436
437
438# Files to be published on the website.
439#
440DOC = \
441  index.html \
442  sqlite.html \
443  changes.html \
444  lang.html \
445  opcode.html \
446  arch.html \
447  arch.png \
448  vdbe.html \
449  c_interface.html \
450  mingw.html \
451  tclsqlite.html \
452  download.html \
453  speed.html \
454  faq.html \
455  formatchng.html \
456  conflict.html \
457  omitted.html \
458  datatypes.html \
459  quickstart.html \
460  fileformat.html \
461  nulls.html
462
463doc:	$(DOC)
464	mkdir -p doc
465	mv $(DOC) doc
466
467install:	sqlite libsqlite.la sqlite.h
468	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib
469	$(LTINSTALL) libsqlite.la $(DESTDIR)$(exec_prefix)/lib
470	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
471	$(LTINSTALL) sqlite $(DESTDIR)$(exec_prefix)/bin
472	$(INSTALL) -d $(DESTDIR)$(prefix)/include
473	$(INSTALL) -m 0644 sqlite.h $(DESTDIR)$(prefix)/include
474	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib/pkgconfig;
475	$(INSTALL) -m 0644 sqlite.pc $(DESTDIR)$(exec_prefix)/lib/pkgconfig;
476
477clean:
478	rm -f *.lo *.la *.o sqlite@TARGET_EXEEXT@ libsqlite.la sqlite.h opcodes.*
479	rm -rf .libs .deps
480	rm -f lemon@BUILD_EXEEXT@ lempar.c parse.* sqlite*.tar.gz
481	rm -f $(PUBLISH)
482	rm -f *.da *.bb *.bbg gmon.out
483	rm -f testfixture@TARGET_EXEEXT@ test.db
484	rm -rf doc
485	rm -f sqlite.dll sqlite.lib
486
487#
488# Windows section; all this funky .dll stuff ;-)
489#
490dll: sqlite.dll
491
492REAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o)
493
494sqlite.dll: $(LIBOBJ) $(TOP)/sqlite.def
495	dllwrap --dllname sqlite.dll --def $(TOP)/sqlite.def $(REAL_LIBOBJ)
496	strip sqlite.dll
497
498#target for dll import libraries
499implib: sqlite.lib
500
501#make Borland C++ and/or Microsoft VC import library for the dll
502#   ignore any errors (usually due to missing programs)
503sqlite.lib: sqlite.dll
504	-implib -a sqlite.lib sqlite.dll
505	-lib /machine:i386 /def:$(TOP)/sqlite.def
506
507distclean:	clean
508	rm -f config.log config.status libtool Makefile config.h
509