1 #ident "%Z%%M% %I% %E% SMI"
3 ###############################################################################
4 # The following macros should be defined before this script is
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
21 # THREADLIB Specify any extra linker options needed to make the library
24 # OPTS Extra compiler command-line options.
26 # EXE The suffix to add to executable files. ".exe" for windows
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.
36 # TCL_FLAGS Extra compiler options needed for programs that use the
39 # LIBTCL Linker options needed to link against the TCL library.
41 # READLINE_FLAGS Compiler options needed for programs that use the
44 # LIBREADLINE Linker options needed by programs using readline() must
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.
72 $(TOP
)/src
/btree_rb.c \
93 $(TOP
)/src
/sqlite.h.in \
94 $(TOP
)/src
/sqliteInt.h \
96 $(TOP
)/src
/tclsqlite.c \
97 $(TOP
)/src
/tokenize.c \
98 $(TOP
)/src
/trigger.c \
101 $(TOP
)/src
/vacuum.c \
104 $(TOP
)/src
/vdbeaux.c \
105 $(TOP
)/src
/vdbeInt.h \
108 # Source code to the test files.
122 # Header files used by all library source files.
131 $(TOP
)/src
/sqliteInt.h \
135 # Header files used by the VDBE submodule
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
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
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
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
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 | \
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
)
233 parse.c
: $(TOP
)/src
/parse.y lemon
234 cp
$(TOP
)/src
/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.
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
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.
438 install: sqlite libsqlite.a sqlite.h
440 mv libsqlite.a
/usr
/lib
441 mv sqlite.h
/usr
/include
444 rm -f
*.o sqlite libsqlite.a sqlite.h opcodes.
*
445 rm -f lemon lempar.c parse.
* sqlite
*.
tar.gz
447 rm -f
*.da
*.bb
*.bbg gmon.out