/ Check-in [b22b6140]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the makefile and README for MSVC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b22b61406899c2694dae984995d2484fdb8122f1
User & Date: mistachkin 2014-02-13 21:57:48
Context
2014-02-14
00:25
Revise how the Tcl system encoding is handled by the test suite. check-in: 9e573198 user: mistachkin tags: trunk
2014-02-13
21:57
Improvements to the makefile and README for MSVC. check-in: b22b6140 user: mistachkin tags: trunk
19:27
Ensure that if the "psow=0" URI option or FCNTL_POWERSAFE_OVERWRITE file-control is used to clear the power-safe overwrite flag, extra padding frames are added to the WAL file. check-in: 48c821fd user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

   210    210   NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
   211    211   !ENDIF
   212    212   
   213    213   # C compiler and options for use in building executables that
   214    214   # will run on the target platform.  (BCC and TCC are usually the
   215    215   # same unless your are cross-compiling.)
   216    216   #
   217         -TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src -fp:precise
          217  +TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
   218    218   RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
   219    219   
   220    220   # Check if assembly code listings should be generated for the source
   221    221   # code files to be compiled.
   222    222   #
   223    223   !IF $(USE_LISTINGS)!=0
   224    224   TCC = $(TCC) -FAcs
................................................................................
  1215   1215   	del /Q parse.y parse.h parse.h.temp
  1216   1216   	copy $(TOP)\src\parse.y .
  1217   1217   	.\lemon.exe $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
  1218   1218   	move parse.h parse.h.temp
  1219   1219   	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
  1220   1220   
  1221   1221   sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
  1222         -	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP) > sqlite3.h
         1222  +	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
  1223   1223   
  1224   1224   mkkeywordhash.exe:	$(TOP)\tool\mkkeywordhash.c
  1225   1225   	$(BCC) -Fe$@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLIBPATHS)
  1226   1226   
  1227   1227   keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
  1228   1228   	.\mkkeywordhash.exe > keywordhash.h
  1229   1229   

Changes to README.md.

    16     16   
    17     17       tar xzf sqlite.tar.gz    ;#  Unpack the source tree into "sqlite"
    18     18       mkdir bld                ;#  Build will occur in a sibling directory
    19     19       cd bld                   ;#  Change to the build directory
    20     20       ../sqlite/configure      ;#  Run the configure script
    21     21       make                     ;#  Run the makefile.
    22     22       make sqlite3.c           ;#  Build the "amalgamation" source file
    23         -    make test                ;#  Run some tests (requires TCL)
           23  +    make test                ;#  Run some tests (requires Tcl)
    24     24   
    25     25   See the makefile for additional targets.
    26     26   
    27     27   The configure script uses autoconf 2.61 and libtool.  If the configure
    28     28   script does not work out for you, there is a generic makefile named
    29     29   "Makefile.linux-gcc" in the top directory of the source tree that you
    30     30   can copy and edit to suit your needs.  Comments on the generic makefile
    31     31   show what changes are needed.
    32     32   
    33         -SQLite does not require TCL to run, but a TCL installation is required
    34         -by the makefiles.  SQLite contains a lot of generated code and TCL is
    35         -used to do much of that code generation.  The makefile also requires
    36         -AWK.
           33  +## Using MSVC
           34  +
           35  +On Windows, all applicable build products can be compiled with MSVC.
           36  +First open the command prompt window associated with the desired compiler
           37  +version (e.g. "Developer Command Prompt for VS2013").  Next, use NMAKE
           38  +with the provided "Makefile.msc" to build one of the supported targets.
           39  +
           40  +For example:
           41  +
           42  +    mkdir bld
           43  +    cd bld
           44  +    nmake /f Makefile.msc TOP=..\sqlite
           45  +    nmake /f Makefile.msc sqlite3.c TOP=..\sqlite
           46  +    nmake /f Makefile.msc sqlite3.dll TOP=..\sqlite
           47  +    nmake /f Makefile.msc sqlite3.exe TOP=..\sqlite
           48  +    nmake /f Makefile.msc test TOP=..\sqlite
           49  +
           50  +There are several build options that can be set via the NMAKE command
           51  +line.  For example, to build for WinRT, simply add "FOR_WINRT=1" argument
           52  +to the "sqlite3.dll" command line above.  When debugging into the SQLite
           53  +code, adding the "DEBUG=1" argument to one of the above command lines is
           54  +recommended.
           55  +
           56  +SQLite does not require Tcl to run, but a Tcl installation is required
           57  +by the makefiles (including those for MSVC).  SQLite contains a lot of
           58  +generated code and Tcl is used to do much of that code generation.  The
           59  +makefiles also require AWK.
    37     60   
    38     61   ## Source Code Tour
    39     62   
    40     63   Most of the core source files are in the **src/** subdirectory.  But
    41     64   src/ also contains files used to build the "testfixture" test harness;
    42     65   those file all begin with "test".  And src/ contains the "shell.c" file
    43     66   which is the main program for the "sqlite3.exe" command-line shell and
    44     67   the "tclsqlite.c" file which implements the bindings to SQLite from the
    45         -TCL programming language.  (Historical note:  SQLite began as a TCL
           68  +Tcl programming language.  (Historical note:  SQLite began as a Tcl
    46     69   extension and only later escaped to the wild as an independent library.)
    47     70   
    48     71   Test scripts and programs are found in the **test/** subdirectory.
    49         -There are other test suites for SQLite (see 
           72  +There are other test suites for SQLite (see
    50     73   [How SQLite Is Tested](http://www.sqlite.org/testing.html))
    51     74   but those other test suites are
    52     75   in separate source repositories.
    53     76   
    54     77   The **ext/** subdirectory contains code for extensions.  The
    55     78   Full-text search engine is in **ext/fts3**.  The R-Tree engine is in
    56     79   **ext/rtree**.  The **ext/misc** subdirectory contains a number of
................................................................................
    63     86   ### Generated Source Code Files
    64     87   
    65     88   Several of the C-language source files used by SQLite are generated from
    66     89   other sources rather than being typed in manually by a programmer.  This
    67     90   section will summarize those automatically-generated files.  To create all
    68     91   of the automatically-generated files, simply run "make target_source".
    69     92   The "target_source" make target will create a subdirectory "tsrc/" and
    70         -fill it with all the source files needed to build SQLite, both 
           93  +fill it with all the source files needed to build SQLite, both
    71     94   manually-edited files and automatically-generated files.
    72     95   
    73     96   The SQLite interface is defined by the **sqlite3.h** header file, which is
    74     97   generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION.  The
    75         -TCL script at tool/mksqlite3h.tcl does the conversion.  The manifest.uuid
           98  +Tcl script at tool/mksqlite3h.tcl does the conversion.  The manifest.uuid
    76     99   file contains the SHA1 hash of the particular check-in and is used to generate
    77    100   the SQLITE_SOURCE_ID macro.  The VERSION file contains the current SQLite
    78    101   version number.  The sqlite3.h header is really just a copy of src/sqlite.h.in
    79    102   with the source-id and version number inserted at just the right spots.
    80    103   Note that comment text in the sqlite3.h file is used to generate much of
    81         -the SQLite API documentation.  The TCL scripts used to generate that
          104  +the SQLite API documentation.  The Tcl scripts used to generate that
    82    105   documentation are in a separate source repository.
    83    106   
    84    107   The SQL language parser is **parse.c** which is generate from a grammar in
    85    108   the src/parse.y file.  The conversion of "parse.y" into "parse.c" is done
    86         -by the [lemon](./doc/lemon.html) LALR(1) parser generator.  The source code 
          109  +by the [lemon](./doc/lemon.html) LALR(1) parser generator.  The source code
    87    110   for lemon is at tool/lemon.c.  Lemon uses a
    88    111   template for generating its parser.  A generic template is in tool/lempar.c,
    89    112   but SQLite uses a slightly modified template found in src/lempar.c.
    90    113   
    91    114   Lemon also generates the **parse.h** header file, at the same time it
    92    115   generates parse.c. But the parse.h header file is
    93    116   modified further (to add additional symbols) using the ./addopcodes.awk
................................................................................
   113    136   **sqlite3.c** called "the amalgamation".  The amalgamation is the recommended
   114    137   way of using SQLite in a larger application.  Combining all individual
   115    138   source code files into a single big source code file allows the C compiler
   116    139   to perform more cross-procedure analysis and generate better code.  SQLite
   117    140   runs about 5% faster when compiled from the amalgamation versus when compiled
   118    141   from individual source files.
   119    142   
   120         -The amalgamation is generated from the tool/mksqlite3c.tcl TCL script.
          143  +The amalgamation is generated from the tool/mksqlite3c.tcl Tcl script.
   121    144   First, all of the individual source files must be gathered into the tsrc/
   122    145   subdirectory (using the equivalent of "make target_source") then the
   123    146   tool/mksqlite3c.tcl script is run to copy them all together in just the
   124    147   right order while resolving internal "#include" references.
   125    148   
   126    149   The amalgamation source file is more than 100K lines long.  Some symbolic
   127    150   debuggers (most notably MSVC) are unable to deal with files longer than 64K
   128         -lines.  To work around this, a separate TCL script, tool/split-sqlite3c.tcl,
          151  +lines.  To work around this, a separate Tcl script, tool/split-sqlite3c.tcl,
   129    152   can be run on the amalgamation to break it up into a single small C file
   130    153   called **sqlite3-all.c** that does #include on about five other files
   131    154   named **sqlite3-1.c**, **sqlite3-2.c**, ..., **sqlite3-5.c**.  In this way,
   132    155   all of the source code is contained within a single translation unit so
   133         -that the compiler can do extra cross-procedure optimization, but no 
          156  +that the compiler can do extra cross-procedure optimization, but no
   134    157   individual source file exceeds 32K lines in length.
   135    158   
   136    159   ## How It All Fits Together
   137    160   
   138    161   SQLite is modular in design.
   139         -See the [architectural description](http://www.sqlite.org/arch.html) 
          162  +See the [architectural description](http://www.sqlite.org/arch.html)
   140    163   for details. Other documents that are useful in
   141    164   (helping to understand how SQLite works include the
   142    165   [file format](http://www.sqlite.org/fileformat2.html) description,
   143    166   the [virtual machine](http://www.sqlite.org/vdbe.html) that runs
   144         -prepared statements, the description of 
          167  +prepared statements, the description of
   145    168   [how transactions work](http://www.sqlite.org/atomiccommit.html), and
   146    169   the [overview of the query planner](http://www.sqlite.org/optoverview.html).
   147    170   
   148    171   Unfortunately, years of effort have gone into optimizating SQLite, both
   149    172   for small size and high performance.  And optimizations tend to result in
   150    173   complex code.  So there is a lot of complexity in the SQLite implementation.
   151    174   
................................................................................
   178    201   
   179    202     *  **pager.c** - This file contains the "pager" implementation, the
   180    203        module that implements transactions.
   181    204   
   182    205     *  **os_unix.c** and **os_win.c** - These two files implement the interface
   183    206        between SQLite and the underlying operating system using the run-time
   184    207        pluggable VFS interface.
   185         -  
          208  +
   186    209   
   187    210   ## Contacts
   188    211   
   189    212   The main SQLite webpage is [http://www.sqlite.org/](http://www.sqlite.org/)
   190    213   with geographically distributed backup servers at
   191    214   [http://www2.sqlite.org/](http://www2.sqlite.org) and
   192    215   [http://www3.sqlite.org/](http://www3.sqlite.org).