]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the amalgamation generator to the makefile. (CVS 3783)
authordrh <drh@noemail.net>
Sat, 31 Mar 2007 22:29:05 +0000 (22:29 +0000)
committerdrh <drh@noemail.net>
Sat, 31 Mar 2007 22:29:05 +0000 (22:29 +0000)
FossilOrigin-Name: a0f3c960fa3e958e12bc488451ee2d637562909b

main.mk
manifest
manifest.uuid
tool/mksqlite3c.tcl

diff --git a/main.mk b/main.mk
index c687153d965ad5395de8560e8b503b1bbd7b1ac0..9d09cefcbbcc552e334e4a4ec577329276136819 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -249,9 +249,12 @@ objects: $(LIBOBJ_ORIG)
 target_source: $(SRC)
        rm -rf tsrc
        mkdir tsrc
-       cp $(SRC) $(TOP)/src/*.h tsrc
+       cp -f $(SRC) $(TOP)/src/*.h tsrc 2>/dev/null
        rm tsrc/sqlite.h.in tsrc/parse.y
 
+sqlite3.c:     target_source $(TOP)/tool/mksqlite3c.tcl
+       tclsh $(TOP)/tool/mksqlite3c.tcl
+
 # Rules to build the LEMON compiler generator
 #
 lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
index 8bf4ae9509286c008640566b244a0d1385e6a3af..b70068cbc54b19332a0c8c1ab5d67d037e556cd3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\samalgamation\sso\sthat\sit\scan\sbe\scompiled\swith\sREDEF_IO\senabled.\s(CVS\s3782)
-D 2007-03-31T16:29:06
+C Add\sthe\samalgamation\sgenerator\sto\sthe\smakefile.\s(CVS\s3783)
+D 2007-03-31T22:29:05
 F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -43,7 +43,7 @@ F ext/fts2/fts2_tokenizer.h 4c5ffe31d63622869eb6eec1503df7f6996fd1bd
 F ext/fts2/fts2_tokenizer1.c 6067f2f710bc7e91c0688b7b11be1027777553e0
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
 F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
-F main.mk 0bf049ca7589932f1fdd074d71f0f6621a63e972
+F main.mk 49c1b97b57d2a0091fbecee6feb9a992661ff05a
 F mkdll.sh cbc7d92d02f9317a3d24ab55bb727275417260ca
 F mkopcodec.awk bd46ad001c98dfbab07b1713cb8e692fa0e5415d
 F mkopcodeh.awk cde995d269aa06c94adbf6455bea0acedb913fa5
@@ -382,7 +382,7 @@ F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
 F tool/mkkeywordhash.c 520d0016eaac0d783ea8ffb7f91d150d0bf06e81
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
-F tool/mksqlite3c.tcl 72969469d0487df1b1b50dfc7a2be56a2a193168
+F tool/mksqlite3c.tcl 59f5db8e291dd83f92be379c97f2c00b844ca3b8
 F tool/omittest.tcl e6b3d6a1285f9813bc1dea53bb522b4b72774710
 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
 F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
@@ -447,7 +447,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 476e7c3fcc69d8b21d161c758aaa5ef7163abb15
-R bf353a147116ca034c191387f8be374c
+P 6a3d6142d8be18bf2a9913f0329bcce48867304b
+R 8f9be996e31b89d4cd4e62ba5ca94214
 U drh
-Z e7a7582e202988b95ca76eab2f374fb0
+Z 4d11376f6943f83b5517f075c03b85dd
index 54315d7d000ea66d60f02130cad792f00dbd9270..d0dcc788fb543c847b80d87c77592fa9b483ec0f 100644 (file)
@@ -1 +1 @@
-6a3d6142d8be18bf2a9913f0329bcce48867304b
\ No newline at end of file
+a0f3c960fa3e958e12bc488451ee2d637562909b
\ No newline at end of file
index deb77979a8a332afa00643fbb52e5826db544584..c2c88b9e4e3dd3fdc30fd04fd03cff1a5a0f89b3 100644 (file)
@@ -6,24 +6,64 @@
 #
 #      make target_source
 #
-# Then run this script
+# The make target above moves all of the source code files into
+# a subdirectory named "tsrc".  (This script expects to find the files
+# there and will not work if they are not found.)  There are a few
+# generated C code files that are also added to the tsrc directory.
+# For example, the "parse.c" and "parse.h" files to implement the
+# the parser are derived from "parse.y" using lemon.  And the 
+# "keywordhash.h" files is generated by a program named "mkkeywordhash".
 #
-#      tclsh mkonebigsourcefile.tcl
+# After the "tsrc" directory has been created and populated, run
+# this script:
 #
-# The combined SQLite source code will be written into sqlite3.c
+#      tclsh mksqlite3c.tcl
 #
+# The amalgamated SQLite code will be written into sqlite3.c
+#
+
+# Begin by reading the "sqlite3.h" header file.  Count the number of lines
+# in this file and extract the version number.  That information will be
+# needed in order to generate the header of the amalgamation.
+#
+set in [open tsrc/sqlite3.h]
+set cnt 0
+set VERSION ?????
+while {![eof $in]} {
+  set line [gets $in]
+  if {$line=="" && [eof $in]} break
+  incr cnt
+  regexp {#define\s+SQLITE_VERSION\s+"(.*)"} $line all VERSION
+}
+close $in
 
 # Open the output file and write a header comment at the beginning
 # of the file.
 #
 set out [open sqlite3.c w]
-puts $out \
-"/******************************************************************************
-** This file is a amalgamation of many separate source files from SQLite.  By
-** pulling all the source files into this single unified source file, the
-** entire code can be compiled as a single translation unit, which allows the
-** compiler to do a better job of optimizing.
-*/"
+set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
+puts $out [subst \
+{/******************************************************************************
+** This file is a amalgamation of many separate C source files from SQLite
+** version $VERSION.  By combining all the individual C code files into this 
+** single large file, the entire code can be compiled as a one translation
+** unit.  This allows many compilers to do optimizations that would not be
+** possible if the files were compiled separately.  Performance improvements
+** of 5% are more are commonly seen when SQLite is compiled as a single
+** translation unit.
+**
+** This file is all you need to compile SQLite.  To use SQLite in other
+** programs, you need this file and the "sqlite3.h" header file that defines
+** the programming interface to the SQLite library.  (If you do not have 
+** the "sqlite3.h" header file at hand, you will find a copy in the first
+** $cnt lines past the header of this amalgamation.)  Additional code
+** files may be needed if you want a wrapper to interface SQLite with your
+** choice of programming language.  The code for the "sqlite3" command-line
+** shell is also in a separate file.  This file contains only code for the
+** core SQLite library.
+**
+** This amalgamation was generated on $today.
+*/}]
 
 # These are the header files used by SQLite.  The first time any of these 
 # files are seen in a #include statement in the C code, include the complete
@@ -47,6 +87,7 @@ foreach hdr {
 } {
   set available_hdr($hdr) 1
 }
+set available_hdr(sqlite3.h) 0
 
 # 78 stars used for comment formatting.
 set s78 \
@@ -105,6 +146,8 @@ proc copy_file {filename} {
 # inlining opportunities.
 #
 foreach file {
+   sqlite3.h
+
    os.c
 
    printf.c