8030 libmvect: uninitialized variable
[unleashed.git] / usr / src / lib / libsqlite / main.mk
blobebcb86b2ee29d9c976bd29210e8a26a2afb379b5
1 #ident "%Z%%M% %I% %E% SMI"
3 ###############################################################################
4 # The following macros should be defined before this script is
5 # invoked:
7 # TOP The toplevel directory of the source tree. This is the
8 # directory that contains this "Makefile.in" and the
9 # "configure.in" script.
11 # BCC C Compiler and options for use in building executables that
12 # will run on the platform that is doing the build.
14 # USLEEP If the target operating system supports the "usleep()" system
15 # call, then define the HAVE_USLEEP macro for all C modules.
17 # THREADSAFE If you want the SQLite library to be safe for use within a
18 # multi-threaded program, then define the following macro
19 # appropriately:
21 # THREADLIB Specify any extra linker options needed to make the library
22 # thread safe
24 # OPTS Extra compiler command-line options.
26 # EXE The suffix to add to executable files. ".exe" for windows
27 # and "" for Unix.
29 # TCC C Compiler and options for use in building executables that
30 # will run on the target platform. This is usually the same
31 # as BCC, unless you are cross-compiling.
33 # AR Tools used to build a static library.
34 # RANLIB
36 # TCL_FLAGS Extra compiler options needed for programs that use the
37 # TCL library.
39 # LIBTCL Linker options needed to link against the TCL library.
41 # READLINE_FLAGS Compiler options needed for programs that use the
42 # readline() library.
44 # LIBREADLINE Linker options needed by programs using readline() must
45 # link against.
47 # ENCODING "UTF8" or "ISO8859"
49 # Once the macros above are defined, the rest of this make script will
50 # build the SQLite library and testing tools.
51 ################################################################################
53 # This is how we compile
55 TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
57 # Object files for the SQLite library.
59 LIBOBJ = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
60 expr.o func.o hash.o insert.o \
61 main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \
62 select.o table.o tokenize.o trigger.o update.o util.o \
63 vacuum.o vdbe.o vdbeaux.o where.o tclsqlite.o
65 # All of the source code files.
67 SRC = \
68 $(TOP)/src/attach.c \
69 $(TOP)/src/auth.c \
70 $(TOP)/src/btree.c \
71 $(TOP)/src/btree.h \
72 $(TOP)/src/btree_rb.c \
73 $(TOP)/src/build.c \
74 $(TOP)/src/copy.c \
75 $(TOP)/src/date.c \
76 $(TOP)/src/delete.c \
77 $(TOP)/src/encode.c \
78 $(TOP)/src/expr.c \
79 $(TOP)/src/func.c \
80 $(TOP)/src/hash.c \
81 $(TOP)/src/hash.h \
82 $(TOP)/src/insert.c \
83 $(TOP)/src/main.c \
84 $(TOP)/src/os.c \
85 $(TOP)/src/pager.c \
86 $(TOP)/src/pager.h \
87 $(TOP)/src/parse.y \
88 $(TOP)/src/pragma.c \
89 $(TOP)/src/printf.c \
90 $(TOP)/src/random.c \
91 $(TOP)/src/select.c \
92 $(TOP)/src/shell.c \
93 $(TOP)/src/sqlite.h.in \
94 $(TOP)/src/sqliteInt.h \
95 $(TOP)/src/table.c \
96 $(TOP)/src/tclsqlite.c \
97 $(TOP)/src/tokenize.c \
98 $(TOP)/src/trigger.c \
99 $(TOP)/src/update.c \
100 $(TOP)/src/util.c \
101 $(TOP)/src/vacuum.c \
102 $(TOP)/src/vdbe.c \
103 $(TOP)/src/vdbe.h \
104 $(TOP)/src/vdbeaux.c \
105 $(TOP)/src/vdbeInt.h \
106 $(TOP)/src/where.c
108 # Source code to the test files.
110 TESTSRC = \
111 $(TOP)/src/btree.c \
112 $(TOP)/src/func.c \
113 $(TOP)/src/os.c \
114 $(TOP)/src/pager.c \
115 $(TOP)/src/test1.c \
116 $(TOP)/src/test2.c \
117 $(TOP)/src/test3.c \
118 $(TOP)/src/test4.c \
119 $(TOP)/src/vdbe.c \
120 $(TOP)/src/md5.c
122 # Header files used by all library source files.
124 HDR = \
125 sqlite.h \
126 $(TOP)/src/btree.h \
127 config.h \
128 $(TOP)/src/hash.h \
129 opcodes.h \
130 $(TOP)/src/os.h \
131 $(TOP)/src/sqliteInt.h \
132 $(TOP)/src/vdbe.h \
133 parse.h
135 # Header files used by the VDBE submodule
137 VDBEHDR = \
138 $(HDR) \
139 $(TOP)/src/vdbeInt.h
141 # This is the default Makefile target. The objects listed here
142 # are what get build when you type just "make" with no arguments.
144 all: sqlite.h config.h libsqlite.a sqlite$(EXE)
146 # Generate the file "last_change" which contains the date of change
147 # of the most recently modified source code file
149 last_change: $(SRC)
150 cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
151 | awk '{print $$5,$$6}' >last_change
153 libsqlite.a: $(LIBOBJ)
154 $(AR) libsqlite.a $(LIBOBJ)
155 $(RANLIB) libsqlite.a
157 sqlite$(EXE): $(TOP)/src/shell.c libsqlite.a sqlite.h
158 $(TCCX) $(READLINE_FLAGS) -o sqlite$(EXE) $(TOP)/src/shell.c \
159 libsqlite.a $(LIBREADLINE) $(THREADLIB)
161 sqlite_analyzer$(EXE): $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC) \
162 $(TOP)/tool/spaceanal.tcl
163 sed \
164 -e '/^#/d' \
165 -e 's,\\,\\\\,g' \
166 -e 's,",\\",g' \
167 -e 's,^,",' \
168 -e 's,$$,\\n",' \
169 $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
170 $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -static -o \
171 sqlite_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \
172 libsqlite.a $(LIBTCL)
175 # This target creates a directory named "tsrc" and fills it with
176 # copies of all of the C source code and header files needed to
177 # build on the target system. Some of the C source code and header
178 # files are automatically generated. This target takes care of
179 # all that automatic generation.
181 target_source: $(SRC) $(VDBEHDR) opcodes.c
182 rm -rf tsrc
183 mkdir tsrc
184 cp $(SRC) $(VDBEHDR) tsrc
185 rm tsrc/sqlite.h.in tsrc/parse.y
186 cp parse.c opcodes.c tsrc
188 # Rules to build the LEMON compiler generator
190 lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
191 $(BCC) -o lemon $(TOP)/tool/lemon.c
192 cp $(TOP)/tool/lempar.c .
194 btree.o: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
195 $(TCCX) -c $(TOP)/src/btree.c
197 btree_rb.o: $(TOP)/src/btree_rb.c $(HDR)
198 $(TCCX) -c $(TOP)/src/btree_rb.c
200 build.o: $(TOP)/src/build.c $(HDR)
201 $(TCCX) -c $(TOP)/src/build.c
203 main.o: $(TOP)/src/main.c $(HDR)
204 $(TCCX) -c $(TOP)/src/main.c
206 pager.o: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
207 $(TCCX) -c $(TOP)/src/pager.c
209 opcodes.o: opcodes.c
210 $(TCCX) -c opcodes.c
212 opcodes.c: $(TOP)/src/vdbe.c
213 echo '/* Automatically generated file. Do not edit */' >opcodes.c
214 echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c
215 grep '^case OP_' $(TOP)/src/vdbe.c | \
216 sed -e 's/^.*OP_/ "/' -e 's/:.*$$/", /' >>opcodes.c
217 echo '};' >>opcodes.c
219 opcodes.h: $(TOP)/src/vdbe.h
220 echo '/* Automatically generated file. Do not edit */' >opcodes.h
221 grep '^case OP_' $(TOP)/src/vdbe.c | \
222 sed -e 's/://' | \
223 awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h
225 os.o: $(TOP)/src/os.c $(HDR)
226 $(TCCX) -c $(TOP)/src/os.c
228 parse.o: parse.c $(HDR)
229 $(TCCX) -c parse.c
231 parse.h: parse.c
233 parse.c: $(TOP)/src/parse.y lemon
234 cp $(TOP)/src/parse.y .
235 ./lemon parse.y
237 # The config.h file will contain a single #define that tells us how
238 # many bytes are in a pointer. This only works if a pointer is the
239 # same size on the host as it is on the target. If you are cross-compiling
240 # to a target with a different pointer size, you'll need to manually
241 # configure the config.h file.
243 config.h:
244 echo '#include <stdio.h>' >temp.c
245 echo 'int main(){printf(' >>temp.c
246 echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >>temp.c
247 echo 'exit(0);}' >>temp.c
248 $(BCC) -o temp temp.c
249 ./temp >config.h
250 echo >>config.h
251 rm -f temp.c temp
253 sqlite.h: $(TOP)/src/sqlite.h.in
254 sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
255 -e s/--ENCODING--/$(ENCODING)/ \
256 $(TOP)/src/sqlite.h.in >sqlite.h
258 tokenize.o: $(TOP)/src/tokenize.c $(HDR)
259 $(TCCX) -c $(TOP)/src/tokenize.c
261 trigger.o: $(TOP)/src/trigger.c $(HDR)
262 $(TCCX) -c $(TOP)/src/trigger.c
264 util.o: $(TOP)/src/util.c $(HDR)
265 $(TCCX) -c $(TOP)/src/util.c
267 vacuum.o: $(TOP)/src/vacuum.c $(HDR)
268 $(TCCX) -c $(TOP)/src/vacuum.c
270 vdbe.o: $(TOP)/src/vdbe.c $(VDBEHDR)
271 $(TCCX) -c $(TOP)/src/vdbe.c
273 vdbeaux.o: $(TOP)/src/vdbeaux.c $(VDBEHDR)
274 $(TCCX) -c $(TOP)/src/vdbeaux.c
276 where.o: $(TOP)/src/where.c $(HDR)
277 $(TCCX) -c $(TOP)/src/where.c
279 copy.o: $(TOP)/src/copy.c $(HDR)
280 $(TCCX) -c $(TOP)/src/copy.c
282 date.o: $(TOP)/src/date.c $(HDR)
283 $(TCCX) -c $(TOP)/src/date.c
285 delete.o: $(TOP)/src/delete.c $(HDR)
286 $(TCCX) -c $(TOP)/src/delete.c
288 encode.o: $(TOP)/src/encode.c
289 $(TCCX) -c $(TOP)/src/encode.c
291 expr.o: $(TOP)/src/expr.c $(HDR)
292 $(TCCX) -c $(TOP)/src/expr.c
294 func.o: $(TOP)/src/func.c $(HDR)
295 $(TCCX) -c $(TOP)/src/func.c
297 hash.o: $(TOP)/src/hash.c $(HDR)
298 $(TCCX) -c $(TOP)/src/hash.c
300 insert.o: $(TOP)/src/insert.c $(HDR)
301 $(TCCX) -c $(TOP)/src/insert.c
303 random.o: $(TOP)/src/random.c $(HDR)
304 $(TCCX) -c $(TOP)/src/random.c
306 select.o: $(TOP)/src/select.c $(HDR)
307 $(TCCX) -c $(TOP)/src/select.c
309 table.o: $(TOP)/src/table.c $(HDR)
310 $(TCCX) -c $(TOP)/src/table.c
312 update.o: $(TOP)/src/update.c $(HDR)
313 $(TCCX) -c $(TOP)/src/update.c
315 tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
316 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
318 pragma.o: $(TOP)/src/pragma.c $(HDR)
319 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/pragma.c
321 printf.o: $(TOP)/src/printf.c $(HDR)
322 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/printf.c
324 attach.o: $(TOP)/src/attach.c $(HDR)
325 $(TCCX) -c $(TOP)/src/attach.c
327 auth.o: $(TOP)/src/auth.c $(HDR)
328 $(TCCX) -c $(TOP)/src/auth.c
330 tclsqlite: $(TOP)/src/tclsqlite.c libsqlite.a
331 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \
332 $(TOP)/src/tclsqlite.c libsqlite.a $(LIBTCL)
334 testfixture$(EXE): $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC)
335 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -o testfixture$(EXE) \
336 $(TESTSRC) $(TOP)/src/tclsqlite.c \
337 libsqlite.a $(LIBTCL) $(THREADLIB)
339 fulltest: testfixture$(EXE) sqlite$(EXE)
340 ./testfixture$(EXE) $(TOP)/test/all.test
342 test: testfixture$(EXE) sqlite$(EXE)
343 ./testfixture$(EXE) $(TOP)/test/quick.test
345 index.html: $(TOP)/www/index.tcl last_change
346 tclsh $(TOP)/www/index.tcl `cat $(TOP)/VERSION` >index.html
348 sqlite.html: $(TOP)/www/sqlite.tcl
349 tclsh $(TOP)/www/sqlite.tcl >sqlite.html
351 c_interface.html: $(TOP)/www/c_interface.tcl
352 tclsh $(TOP)/www/c_interface.tcl >c_interface.html
354 changes.html: $(TOP)/www/changes.tcl
355 tclsh $(TOP)/www/changes.tcl >changes.html
357 lang.html: $(TOP)/www/lang.tcl
358 tclsh $(TOP)/www/lang.tcl >lang.html
360 vdbe.html: $(TOP)/www/vdbe.tcl
361 tclsh $(TOP)/www/vdbe.tcl >vdbe.html
363 arch.html: $(TOP)/www/arch.tcl
364 tclsh $(TOP)/www/arch.tcl >arch.html
366 arch.png: $(TOP)/www/arch.png
367 cp $(TOP)/www/arch.png .
369 opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
370 tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
372 mingw.html: $(TOP)/www/mingw.tcl
373 tclsh $(TOP)/www/mingw.tcl >mingw.html
375 tclsqlite.html: $(TOP)/www/tclsqlite.tcl
376 tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html
378 speed.html: $(TOP)/www/speed.tcl
379 tclsh $(TOP)/www/speed.tcl >speed.html
381 faq.html: $(TOP)/www/faq.tcl
382 tclsh $(TOP)/www/faq.tcl >faq.html
384 formatchng.html: $(TOP)/www/formatchng.tcl
385 tclsh $(TOP)/www/formatchng.tcl >formatchng.html
387 conflict.html: $(TOP)/www/conflict.tcl
388 tclsh $(TOP)/www/conflict.tcl >conflict.html
390 download.html: $(TOP)/www/download.tcl
391 tclsh $(TOP)/www/download.tcl >download.html
393 omitted.html: $(TOP)/www/omitted.tcl
394 tclsh $(TOP)/www/omitted.tcl >omitted.html
396 datatypes.html: $(TOP)/www/datatypes.tcl
397 tclsh $(TOP)/www/datatypes.tcl >datatypes.html
399 quickstart.html: $(TOP)/www/quickstart.tcl
400 tclsh $(TOP)/www/quickstart.tcl >quickstart.html
402 fileformat.html: $(TOP)/www/fileformat.tcl
403 tclsh $(TOP)/www/fileformat.tcl >fileformat.html
405 nulls.html: $(TOP)/www/nulls.tcl
406 tclsh $(TOP)/www/nulls.tcl >nulls.html
409 # Files to be published on the website.
411 DOC = \
412 index.html \
413 sqlite.html \
414 changes.html \
415 lang.html \
416 opcode.html \
417 arch.html \
418 arch.png \
419 vdbe.html \
420 c_interface.html \
421 mingw.html \
422 tclsqlite.html \
423 download.html \
424 speed.html \
425 faq.html \
426 formatchng.html \
427 conflict.html \
428 omitted.html \
429 datatypes.html \
430 quickstart.html \
431 fileformat.html \
432 nulls.html
434 doc: $(DOC)
435 mkdir -p doc
436 mv $(DOC) doc
438 install: sqlite libsqlite.a sqlite.h
439 mv sqlite /usr/bin
440 mv libsqlite.a /usr/lib
441 mv sqlite.h /usr/include
443 clean:
444 rm -f *.o sqlite libsqlite.a sqlite.h opcodes.*
445 rm -f lemon lempar.c parse.* sqlite*.tar.gz
446 rm -f $(PUBLISH)
447 rm -f *.da *.bb *.bbg gmon.out
448 rm -rf tsrc