Index: Makefile.in
==================================================================
--- Makefile.in
+++ Makefile.in
@@ -9,13 +9,17 @@
 #    the following to point from the build directory to the src/ folder.
 #
 SRCDIR = @srcdir@/src
 
 #### The directory into which object code files should be written.
+#    Having a "./" prefix in the value of this variable breaks our use of the
+#    "makeheaders" tool when running make on the MinGW platform, apparently
+#    due to some command line argument manipulation performed automatically
+#    by the shell.
 #
 #
-OBJDIR = ./bld
+OBJDIR = bld
 
 #### C Compiler and options for use in building executables that
 #    will run on the platform that is doing the build.  This is used
 #    to compile code-generator programs as part of the build process.
 #    See TCC below for the C compiler for building the finished binary.

Index: auto.def
==================================================================
--- auto.def
+++ auto.def
@@ -4,10 +4,11 @@
 
 options {
     with-openssl:path|auto|none
                          => {Look for openssl in the given path, or auto or none}
     with-zlib:path       => {Look for zlib in the given path}
+    with-tcl:path        => {Enable Tcl integration, with Tcl in the specified path}
     internal-sqlite=1    => {Don't use the internal sqlite, use the system one}
     static=0             => {Link a static executable}
     lineedit=1           => {Disable line editing}
     fossil-debug=0       => {Build with fossil debugging enabled}
 }
@@ -78,10 +79,34 @@
     define-append EXTRA_LDFLAGS -L$zlibpath
 }
 if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
     user-error "zlib not found please install it or specify the location with --with-zlib"
 }
+
+set tclpath [opt-val with-tcl]
+if {$tclpath ne ""} {
+    if {$tclpath ne "1"} {
+        cc-with [list -cflags [list -I$tclpath/include -L$tclpath/lib]]
+    }
+    if {![cc-check-includes tcl.h]} {
+        user-error "Cannot find tcl.h"
+    }
+    foreach tlib {tcl8.6 tcl8.5 tcl notfound} {
+        if {$tlib=="notfound"} {
+            user-error "Cannot find a usable libtcl"
+        }
+        if {[cc-check-function-in-lib Tcl_CreateInterp $tlib]} {
+            define-append LIBS -l$tlib
+            break
+        }
+    }
+    define FOSSIL_ENABLE_TCL
+    if {$tclpath ne "1"} {
+        define-append EXTRA_CFLAGS -I$tclpath/include
+        define-append EXTRA_LDFLAGS -L$tclpath/lib
+    }
+}
 
 # Helper for openssl checking
 proc check-for-openssl {msg {cflags {}}} {
     msg-checking "Checking for $msg..."
     set rc 0

Index: src/db.c
==================================================================
--- src/db.c
+++ src/db.c
@@ -1792,10 +1792,13 @@
   { "repo-cksum",    0,                0, 0, "on"                  },
   { "self-register", 0,                0, 0, "off"                 },
   { "ssl-ca-location",0,              40, 0, ""                    },
   { "ssl-identity",  0,               40, 0, ""                    },
   { "ssh-command",   0,               32, 0, ""                    },
+#ifdef FOSSIL_ENABLE_TCL
+  { "tcl",           0,                0, 0, "off"                 },
+#endif
   { "web-browser",   0,               32, 0, ""                    },
   { "white-foreground", 0,             0, 0, "off"                 },
   { 0,0,0,0,0 }
 };
 
@@ -1945,10 +1948,16 @@
 **                     authenticate this client, in addition to the normal
 **                     password authentication.
 **
 **    ssh-command      Command used to talk to a remote machine with
 **                     the "ssh://" protocol.
+**
+**    tcl              If enabled, Tcl integration commands will be added to
+**                     the TH1 interpreter, allowing Tcl expressions and
+**                     scripts to be evaluated from TH1.  Additionally, the
+**                     Tcl interpreter will be able to evaluate TH1 expressions
+**                     and scripts.  Default: off.
 **
 **    web-browser      A shell command used to launch your preferred
 **                     web browser when given a URL as an argument.
 **                     Defaults to "start" on windows, "open" on Mac,
 **                     and "firefox" on Unix.

Index: src/main.c
==================================================================
--- src/main.c
+++ src/main.c
@@ -27,10 +27,14 @@
 #include <sys/stat.h>
 
 
 #if INTERFACE
 
+#ifdef FOSSIL_ENABLE_TCL
+#include "tcl.h"
+#endif
+
 /*
 ** Number of elements in an array
 */
 #define count(X)  (sizeof(X)/sizeof(X[0]))
 
@@ -69,10 +73,23 @@
   char TktFmt;           /* t: create new ticket report formats */
   char RdAddr;           /* e: read email addresses or other private data */
   char Zip;              /* z: download zipped artifact via /zip URL */
   char Private;          /* x: can send and receive private content */
 };
+
+#ifdef FOSSIL_ENABLE_TCL
+/*
+** All Tcl related context information is in this structure.  This structure
+** definition has been copied from and should be kept in sync with the one in
+** "th_tcl.c".
+*/
+struct TclContext {
+  int argc;
+  char **argv;
+  Tcl_Interp *interp;
+};
+#endif
 
 /*
 ** All global variables are in this structure.
 */
 struct Global {
@@ -145,10 +162,15 @@
   char *zIpAddr;          /* The remote IP address */
   char *zNonce;           /* The nonce used for login */
   
   /* permissions used by the server */
   struct FossilUserPerms perm;
+
+#ifdef FOSSIL_ENABLE_TCL
+  /* all Tcl related context necessary for integration */
+  struct TclContext tcl;
+#endif
 
   /* For defense against Cross-site Request Forgery attacks */
   char zCsrfToken[12];    /* Value of the anti-CSRF token */
   int okCsrf;             /* Anti-CSRF token is present and valid */
 
@@ -313,10 +335,16 @@
 int main(int argc, char **argv){
   const char *zCmdName = "unknown";
   int idx;
   int rc;
   int i;
+
+#ifdef FOSSIL_ENABLE_TCL
+  g.tcl.argc = argc;
+  g.tcl.argv = argv;
+  g.tcl.interp = 0;
+#endif
 
   sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
   g.now = time(0);
   g.argc = argc;
   g.argv = argv;

Index: src/main.mk
==================================================================
--- src/main.mk
+++ src/main.mk
@@ -301,11 +301,15 @@
 # using -lsqlite3.
 SQLITE3_OBJ.1 = 
 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
 SQLITE3_OBJ.  = $(SQLITE3_OBJ.0)
 
-EXTRAOBJ =  $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE))  $(OBJDIR)/shell.o  $(OBJDIR)/th.o  $(OBJDIR)/th_lang.o
+TCL_OBJ.1 =
+TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
+TCL_OBJ. = $(TCL_OBJ.0)
+
+EXTRAOBJ =  $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE))  $(OBJDIR)/shell.o  $(OBJDIR)/th.o  $(OBJDIR)/th_lang.o  $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
 
 $(APPNAME):	$(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
 	$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
 
 # This rule prevents make from using its default rules to try build
@@ -909,5 +913,8 @@
 	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
 
 $(OBJDIR)/th_lang.o:	$(SRCDIR)/th_lang.c
 	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
 
+$(OBJDIR)/th_tcl.o:	$(SRCDIR)/th_tcl.c
+	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
+

Index: src/makemake.tcl
==================================================================
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -198,15 +198,20 @@
 # using -lsqlite3.
 SQLITE3_OBJ.1 = 
 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
 SQLITE3_OBJ.  = $(SQLITE3_OBJ.0)
 
+TCL_OBJ.1 =
+TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
+TCL_OBJ. = $(TCL_OBJ.0)
+
 EXTRAOBJ = \
   $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
   $(OBJDIR)/shell.o \
   $(OBJDIR)/th.o \
-  $(OBJDIR)/th_lang.o
+  $(OBJDIR)/th_lang.o \
+  $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
 
 $(APPNAME):	$(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
 	$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
 
 # This rule prevents make from using its default rules to try build
@@ -265,10 +270,13 @@
 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
 
 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
 
+writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
+writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
+
 close $output_file
 #
 # End of the main.mk output
 ##############################################################################
 ##############################################################################

Index: src/th.h
==================================================================
--- src/th.h
+++ src/th.h
@@ -154,10 +154,11 @@
 */
 int th_register_language(Th_Interp *interp);            /* th_lang.c */
 int th_register_sqlite(Th_Interp *interp);              /* th_sqlite.c */
 int th_register_vfs(Th_Interp *interp);                 /* th_vfs.c */
 int th_register_testvfs(Th_Interp *interp);             /* th_testvfs.c */
+int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 /*
 ** General purpose hash table from th_lang.c.
 */
 typedef struct Th_Hash      Th_Hash;

Index: src/th_main.c
==================================================================
--- src/th_main.c
+++ src/th_main.c
@@ -93,10 +93,11 @@
     }
     if( g.cgiOutput ){
       cgi_append_content(z, n);
     }else{
       fwrite(z, 1, n, stdout);
+      fflush(stdout);
     }
     if( encode ) free((char*)z);
   }
 }
 
@@ -334,10 +335,39 @@
   if( n<iMin ) n = iMin;
   if( n>iMax ) n = iMax;
   Th_SetResultInt(interp, n);
   return TH_OK;
 }
+
+/*
+** TH1 command:     repository ?BOOLEAN?
+**
+** Return the fully qualified file name of the open repository or an empty
+** string if one is not currently open.  Optionally, it will attempt to open
+** the repository if the boolean argument is non-zero.
+*/
+static int repositoryCmd(
+  Th_Interp *interp,
+  void *p, 
+  int argc, 
+  const char **argv, 
+  int *argl
+){
+  int openRepository;
+
+  if( argc!=1 && argc!=2 ){
+    return Th_WrongNumArgs(interp, "repository ?BOOLEAN?");
+  }
+  if( argc==2 ){
+    if( Th_ToInt(interp, argv[1], argl[1], &openRepository) ){
+      return TH_ERROR;
+    }
+    if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
+  }
+  Th_SetResult(interp, g.zRepositoryName, -1);
+  return TH_OK;
+}
 
 /*
 ** Make sure the interpreter has been initialized.  Initialize it if
 ** it has not been already.
 **
@@ -357,15 +387,21 @@
     {"htmlize",       htmlizeCmd,           0},
     {"date",          dateCmd,              0},
     {"html",          putsCmd,              0},
     {"puts",          putsCmd,       (void*)1},
     {"wiki",          wikiCmd,              0},
+    {"repository",    repositoryCmd,        0},
   };
   if( g.interp==0 ){
     int i;
     g.interp = Th_CreateInterp(&vtab);
     th_register_language(g.interp);       /* Basic scripting commands. */
+#ifdef FOSSIL_ENABLE_TCL
+    if( getenv("TH1_ENABLE_TCL")!=0 || db_get_boolean("tcl", 0) ){
+      th_register_tcl(g.interp, &g.tcl);  /* Tcl integration commands. */
+    }
+#endif
     for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
       Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
                        aCommand[i].pContext, 0);
     }
   }
@@ -529,9 +565,10 @@
 void test_th_render(void){
   Blob in;
   if( g.argc<3 ){
     usage("FILE");
   }
+  db_open_config(0); /* Needed for "tcl" setting. */
   blob_zero(&in);
   blob_read_from_file(&in, g.argv[2]);
   Th_Render(blob_str(&in));
 }

ADDED   src/th_tcl.c
Index: src/th_tcl.c
==================================================================
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -0,0 +1,427 @@
+/*
+** This file contains code used to bridge the TH1 and Tcl scripting languages.
+*/
+
+#include "config.h"
+
+#ifdef FOSSIL_ENABLE_TCL
+
+#include "th.h"
+#include "tcl.h"
+
+/*
+** Are we being compiled against Tcl 8.6 or higher?
+ */
+#if (TCL_MAJOR_VERSION > 8) || \
+    ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 6))
+/*
+** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using
+** Tcl_EvalObjv instead of invoking the objProc directly.
+ */
+#define USE_TCL_EVALOBJV   1
+#endif
+
+/*
+** These macros are designed to reduce the redundant code required to marshal
+** arguments from TH1 to Tcl.
+ */
+#define USE_ARGV_TO_OBJV() \
+  int objc;                \
+  Tcl_Obj **objv;          \
+  int i;
+
+#define COPY_ARGV_TO_OBJV()                                         \
+  objc = argc-1;                                                    \
+  objv = (Tcl_Obj **)ckalloc((unsigned)(objc * sizeof(Tcl_Obj *))); \
+  for(i=1; i<argc; i++){                                            \
+    objv[i-1] = Tcl_NewStringObj(argv[i], argl[i]);                 \
+    Tcl_IncrRefCount(objv[i-1]);                                    \
+  }
+
+#define FREE_ARGV_TO_OBJV()      \
+  for(i=1; i<argc; i++){         \
+    Tcl_DecrRefCount(objv[i-1]); \
+  }                              \
+  ckfree((char *)objv);
+
+/*
+** Fetch the Tcl interpreter from the specified void pointer, cast to a Tcl
+** context.
+ */
+#define GET_CTX_TCL_INTERP(ctx) \
+  ((struct TclContext *)(ctx))->interp
+
+/*
+** Creates and initializes a Tcl interpreter for use with the specified TH1
+** interpreter.  Stores the created Tcl interpreter in the Tcl context supplied
+** by the caller.  This must be declared here because quite a few functions in
+** this file need to use it before it can be defined.
+ */
+static int createTclInterp(Th_Interp *interp, void *pContext);
+
+/*
+** Returns the Tcl interpreter result as a string with the associated length.
+** If the Tcl interpreter or the Tcl result are NULL, the length will be 0.
+** If the length pointer is NULL, the length will not be stored.
+ */
+static char *getTclResult(
+  Tcl_Interp *pInterp,
+  int *pN
+){
+  Tcl_Obj *resultPtr;
+  if( !pInterp ){ /* This should not happen. */
+    if( pN ) *pN = 0;
+    return 0;
+  }
+  resultPtr = Tcl_GetObjResult(pInterp);
+  if( !resultPtr ){ /* This should not happen either? */
+    if( pN ) *pN = 0;
+    return 0;
+  }
+  return Tcl_GetStringFromObj(resultPtr, pN);
+}
+
+/*
+** Tcl context information used by TH1.  This structure definition has been
+** copied from and should be kept in sync with the one in "main.c".
+*/
+struct TclContext {
+  int argc;
+  char **argv;
+  Tcl_Interp *interp;
+};
+
+/*
+** Syntax:
+**
+**   tclEval arg ?arg ...?
+*/
+static int tclEval_command(
+  Th_Interp *interp,
+  void *ctx,
+  int argc,
+  const char **argv,
+  int *argl
+){
+  Tcl_Interp *tclInterp;
+  Tcl_Obj *objPtr;
+  int rc;
+  int nResult;
+  const char *zResult;
+
+  if ( createTclInterp(interp, ctx)!=TH_OK ){
+    return TH_ERROR;
+  }
+  if( argc<2 ){
+    return Th_WrongNumArgs(interp, "tclEval arg ?arg ...?");
+  }
+  tclInterp = GET_CTX_TCL_INTERP(ctx);
+  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
+    Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
+    return TH_ERROR;
+  }
+  Tcl_Preserve((ClientData)tclInterp);
+  if( argc==2 ){
+    objPtr = Tcl_NewStringObj(argv[1], argl[1]);
+    Tcl_IncrRefCount(objPtr);
+    rc = Tcl_EvalObjEx(tclInterp, objPtr, 0);
+    Tcl_DecrRefCount(objPtr);
+  }else{
+    USE_ARGV_TO_OBJV();
+    COPY_ARGV_TO_OBJV();
+    objPtr = Tcl_ConcatObj(objc, objv);
+    Tcl_IncrRefCount(objPtr);
+    rc = Tcl_EvalObjEx(tclInterp, objPtr, 0);
+    Tcl_DecrRefCount(objPtr);
+    FREE_ARGV_TO_OBJV();
+  }
+  zResult = getTclResult(tclInterp, &nResult);
+  Th_SetResult(interp, zResult, nResult);
+  Tcl_Release((ClientData)tclInterp);
+  return rc;
+}
+
+/*
+** Syntax:
+**
+**   tclExpr arg ?arg ...?
+*/
+static int tclExpr_command(
+  Th_Interp *interp,
+  void *ctx,
+  int argc,
+  const char **argv,
+  int *argl
+){
+  Tcl_Interp *tclInterp;
+  Tcl_Obj *objPtr;
+  Tcl_Obj *resultObjPtr;
+  int rc;
+  int nResult;
+  const char *zResult;
+
+  if ( createTclInterp(interp, ctx)!=TH_OK ){
+    return TH_ERROR;
+  }
+  if( argc<2 ){
+    return Th_WrongNumArgs(interp, "tclExpr arg ?arg ...?");
+  }
+  tclInterp = GET_CTX_TCL_INTERP(ctx);
+  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
+    Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
+    return TH_ERROR;
+  }
+  Tcl_Preserve((ClientData)tclInterp);
+  if( argc==2 ){
+    objPtr = Tcl_NewStringObj(argv[1], argl[1]);
+    Tcl_IncrRefCount(objPtr);
+    rc = Tcl_ExprObj(tclInterp, objPtr, &resultObjPtr);
+    Tcl_DecrRefCount(objPtr);
+  }else{
+    USE_ARGV_TO_OBJV();
+    COPY_ARGV_TO_OBJV();
+    objPtr = Tcl_ConcatObj(objc, objv);
+    Tcl_IncrRefCount(objPtr);
+    rc = Tcl_ExprObj(tclInterp, objPtr, &resultObjPtr);
+    Tcl_DecrRefCount(objPtr);
+    FREE_ARGV_TO_OBJV();
+  }
+  if( rc==TCL_OK ){
+    zResult = Tcl_GetStringFromObj(resultObjPtr, &nResult);
+  }else{
+    zResult = getTclResult(tclInterp, &nResult);
+  }
+  Th_SetResult(interp, zResult, nResult);
+  if( rc==TCL_OK ) Tcl_DecrRefCount(resultObjPtr);
+  Tcl_Release((ClientData)tclInterp);
+  return rc;
+}
+
+/*
+** Syntax:
+**
+**   tclInvoke command ?arg ...?
+*/
+static int tclInvoke_command(
+  Th_Interp *interp,
+  void *ctx,
+  int argc,
+  const char **argv,
+  int *argl
+){
+  Tcl_Interp *tclInterp;
+#ifndef USE_TCL_EVALOBJV
+  Tcl_Command command;
+  Tcl_CmdInfo cmdInfo;
+#endif
+  int rc;
+  int nResult;
+  const char *zResult;
+#ifndef USE_TCL_EVALOBJV
+  Tcl_Obj *objPtr;
+#endif
+  USE_ARGV_TO_OBJV();
+
+  if ( createTclInterp(interp, ctx)!=TH_OK ){
+    return TH_ERROR;
+  }
+  if( argc<2 ){
+    return Th_WrongNumArgs(interp, "tclInvoke command ?arg ...?");
+  }
+  tclInterp = GET_CTX_TCL_INTERP(ctx);
+  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
+    Th_ErrorMessage(interp, "invalid Tcl interpreter", (const char *)"", 0);
+    return TH_ERROR;
+  }
+  Tcl_Preserve((ClientData)tclInterp);
+#ifndef USE_TCL_EVALOBJV
+  objPtr = Tcl_NewStringObj(argv[1], argl[1]);
+  Tcl_IncrRefCount(objPtr);
+  command = Tcl_GetCommandFromObj(tclInterp, objPtr);
+  if( !command || Tcl_GetCommandInfoFromToken(command,&cmdInfo)==0 ){
+    Th_ErrorMessage(interp, "Tcl command not found:", argv[1], argl[1]);
+    Tcl_DecrRefCount(objPtr);
+    Tcl_Release((ClientData)tclInterp);
+    return TH_ERROR;
+  }
+  if( !cmdInfo.objProc ){
+    Th_ErrorMessage(interp, "Cannot invoke Tcl command:", argv[1], argl[1]);
+    Tcl_DecrRefCount(objPtr);
+    Tcl_Release((ClientData)tclInterp);
+    return TH_ERROR;
+  }
+  Tcl_DecrRefCount(objPtr);
+#endif
+  COPY_ARGV_TO_OBJV();
+#ifdef USE_TCL_EVALOBJV
+  rc = Tcl_EvalObjv(tclInterp, objc, objv, 0);
+#else
+  Tcl_ResetResult(tclInterp);
+  rc = cmdInfo.objProc(cmdInfo.objClientData, tclInterp, objc, objv);
+#endif
+  FREE_ARGV_TO_OBJV();
+  zResult = getTclResult(tclInterp, &nResult);
+  Th_SetResult(interp, zResult, nResult);
+  Tcl_Release((ClientData)tclInterp);
+  return rc;
+}
+
+/*
+** Syntax:
+**
+**   th1Eval arg
+*/
+static int Th1EvalObjCmd(
+  ClientData clientData,
+  Tcl_Interp *interp,
+  int objc,
+  Tcl_Obj *CONST objv[]
+){
+  Th_Interp *th1Interp;
+  int nArg;
+  const char *arg;
+  int rc;
+
+  if( objc!=2 ){
+    Tcl_WrongNumArgs(interp, 1, objv, "arg");
+    return TCL_ERROR;
+  }
+  th1Interp = (Th_Interp *)clientData;
+  if( !th1Interp ){
+    Tcl_AppendResult(interp, "invalid TH1 interpreter", NULL);
+    return TCL_ERROR;
+  }
+  arg = Tcl_GetStringFromObj(objv[1], &nArg);
+  rc = Th_Eval(th1Interp, 0, arg, nArg);
+  arg = Th_GetResult(th1Interp, &nArg);
+  Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, nArg));
+  return rc;
+}
+
+/*
+** Syntax:
+**
+**   th1Expr arg
+*/
+static int Th1ExprObjCmd(
+  ClientData clientData,
+  Tcl_Interp *interp,
+  int objc,
+  Tcl_Obj *CONST objv[]
+){
+  Th_Interp *th1Interp;
+  int nArg;
+  const char *arg;
+  int rc;
+
+  if( objc!=2 ){
+    Tcl_WrongNumArgs(interp, 1, objv, "arg");
+    return TCL_ERROR;
+  }
+  th1Interp = (Th_Interp *)clientData;
+  if( !th1Interp ){
+    Tcl_AppendResult(interp, "invalid TH1 interpreter", NULL);
+    return TCL_ERROR;
+  }
+  arg = Tcl_GetStringFromObj(objv[1], &nArg);
+  rc = Th_Expr(th1Interp, arg, nArg);
+  arg = Th_GetResult(th1Interp, &nArg);
+  Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, nArg));
+  return rc;
+}
+
+/*
+** Array of Tcl integration commands.  Used when adding or removing the Tcl
+** integration commands from TH1.
+*/
+static struct _Command {
+  const char *zName;
+  Th_CommandProc xProc;
+  void *pContext;
+} aCommand[] = {
+  {"tclEval",   tclEval_command,   0},
+  {"tclExpr",   tclExpr_command,   0},
+  {"tclInvoke", tclInvoke_command, 0},
+  {0, 0, 0}
+};
+
+/*
+** Called if the Tcl interpreter is deleted.  Removes the Tcl integration
+** commands from the TH1 interpreter.
+ */
+static void Th1DeleteProc(
+  ClientData clientData,
+  Tcl_Interp *interp
+){
+  int i;
+  Th_Interp *th1Interp = (Th_Interp *)clientData;
+  if( !th1Interp ) return;
+  /* Remove the Tcl integration commands. */
+  for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
+    Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
+  }
+}
+
+/*
+** Creates and initializes a Tcl interpreter for use with the specified TH1
+** interpreter.  Stores the created Tcl interpreter in the Tcl context supplied
+** by the caller.
+ */
+static int createTclInterp(
+  Th_Interp *interp,
+  void *pContext
+){
+  struct TclContext *tclContext = (struct TclContext *)pContext;
+  Tcl_Interp *tclInterp;
+
+  if ( !tclContext ){
+    Th_ErrorMessage(interp,
+        "Invalid Tcl context", (const char *)"", 0);
+    return TH_ERROR;
+  }
+  if ( tclContext->interp ){
+    return TH_OK;
+  }
+  if ( tclContext->argc>0 && tclContext->argv ) {
+    Tcl_FindExecutable(tclContext->argv[0]);
+  }
+  tclInterp = tclContext->interp = Tcl_CreateInterp();
+  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
+    Th_ErrorMessage(interp,
+        "Could not create Tcl interpreter", (const char *)"", 0);
+    return TH_ERROR;
+  }
+  if( Tcl_Init(tclInterp)!=TCL_OK ){
+    Th_ErrorMessage(interp,
+        "Tcl initialization error:", Tcl_GetStringResult(tclInterp), -1);
+    Tcl_DeleteInterp(tclInterp);
+    tclContext->interp = tclInterp = 0;
+    return TH_ERROR;
+  }
+  /* Add the TH1 integration commands to Tcl. */
+  Tcl_CallWhenDeleted(tclInterp, Th1DeleteProc, interp);
+  Tcl_CreateObjCommand(tclInterp, "th1Eval", Th1EvalObjCmd, interp, NULL);
+  Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL);
+  return TH_OK;
+}
+
+/*
+** Register the Tcl language commands with interpreter interp.
+** Usually this is called soon after interpreter creation.
+*/
+int th_register_tcl(
+  Th_Interp *interp,
+  void *pContext
+){
+  int i;
+  /* Add the Tcl integration commands to TH1. */
+  for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
+    void *ctx = aCommand[i].pContext;
+    /* Use Tcl interpreter for context? */
+    if( !ctx ) ctx = pContext;
+    Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
+  }
+  return TH_OK;
+}
+
+#endif /* FOSSIL_ENABLE_TCL */

ADDED   test/th1-tcl.test
Index: test/th1-tcl.test
==================================================================
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -0,0 +1,102 @@
+#
+# Copyright (c) 2011 D. Richard Hipp
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the Simplified BSD License (also
+# known as the "2-Clause License" or "FreeBSD License".)
+#
+# This program is distributed in the hope that it will be useful,
+# but without any warranty; without even the implied warranty of
+# merchantability or fitness for a particular purpose.
+#
+# Author contact information:
+#   drh@hwaci.com
+#   http://www.hwaci.com/drh/
+#
+############################################################################
+#
+# TH1/Tcl integration
+#
+
+set dir [file dirname [info script]]
+
+###############################################################################
+
+set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl1.txt]]
+
+test th1-tcl-1 {[regexp -- {^\d+
+\d+
+\d+
+via Tcl invoke
+4
+4
+two words
+one_word
+three words now
+\d+
+two words
+4
+\d+
+two words
+4
+\d+
+one_word
+three words now
+$} [string map [list \r\n \n] $RESULT]]}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl2.txt]]
+
+test th1-tcl-2 {[regexp -- {^\d+
+$} [string map [list \r\n \n] $RESULT]]}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl3.txt]]
+
+test th1-tcl-3 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+invalid command name &quot;bad_command&quot;</p>}}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl4.txt]]
+
+test th1-tcl-4 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+divide by zero</p>}}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl5.txt]]
+
+test th1-tcl-5 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+Tcl command not found: bad_command</p>} || $RESULT eq {<hr><p\
+class="thmainError">ERROR: invalid command name &quot;bad_command&quot;</p>}}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl6.txt]]
+
+test th1-tcl-6 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+no such command:  bad_command</p>}}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl7.txt]]
+
+test th1-tcl-7 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+syntax error in expression: &quot;2**0&quot;</p>}}
+
+###############################################################################
+
+fossil test-th-render [file nativename [file join $dir th1-tcl8.txt]]
+
+test th1-tcl-8 {$RESULT eq {<hr><p class="thmainError">ERROR:\
+Cannot invoke Tcl command: tailcall</p>} || $RESULT eq {<hr><p\
+class="thmainError">ERROR: tailcall can only be called from a proc or\
+lambda</p>}}
+

ADDED   test/th1-tcl1.txt
Index: test/th1-tcl1.txt
==================================================================
--- test/th1-tcl1.txt
+++ test/th1-tcl1.txt
@@ -0,0 +1,27 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  set channel stdout; tclInvoke set channel $channel
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclEval clock seconds]
+  doOut [tclEval {set x [clock seconds]}]
+  tclEval {puts $channel "[clock seconds]"}
+  tclInvoke puts $channel "via Tcl invoke"
+  doOut [tclExpr 2+2]
+  doOut [tclExpr 2 + 2]
+  doOut [tclInvoke set x "two words"]
+  doOut [tclInvoke eval set y one_word]
+  doOut [tclInvoke eval {set z "three words now"}]
+  doOut [set x [tclEval {set x [clock seconds]}]]
+  doOut [tclInvoke th1Eval {set y "two words"}]
+  doOut [set z [tclInvoke th1Expr {2+2}]]
+  doOut $x
+  doOut $y
+  doOut $z
+  doOut [tclEval set x]
+  doOut [tclEval set y]
+  doOut [tclEval set z]
+</th1>

ADDED   test/th1-tcl2.txt
Index: test/th1-tcl2.txt
==================================================================
--- test/th1-tcl2.txt
+++ test/th1-tcl2.txt
@@ -0,0 +1,19 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  # NOTE: This test requires that the SQLite package be available for the Tcl
+  #       interpreter that is linked to the Fossil executable.
+  #
+  tclInvoke set repository_name [repository 1]
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclEval {
+    package require sqlite3
+    sqlite3 db $repository_name
+    set x [db eval {SELECT COUNT(*) FROM user;}]
+    db close
+    return $x
+  }]
+</th1>

ADDED   test/th1-tcl3.txt
Index: test/th1-tcl3.txt
==================================================================
--- test/th1-tcl3.txt
+++ test/th1-tcl3.txt
@@ -0,0 +1,9 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclEval bad_command]
+</th1>

ADDED   test/th1-tcl4.txt
Index: test/th1-tcl4.txt
==================================================================
--- test/th1-tcl4.txt
+++ test/th1-tcl4.txt
@@ -0,0 +1,9 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclExpr 2/0]
+</th1>

ADDED   test/th1-tcl5.txt
Index: test/th1-tcl5.txt
==================================================================
--- test/th1-tcl5.txt
+++ test/th1-tcl5.txt
@@ -0,0 +1,9 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclInvoke bad_command]
+</th1>

ADDED   test/th1-tcl6.txt
Index: test/th1-tcl6.txt
==================================================================
--- test/th1-tcl6.txt
+++ test/th1-tcl6.txt
@@ -0,0 +1,9 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+  doOut [tclEval th1Eval bad_command]
+</th1>

ADDED   test/th1-tcl7.txt
Index: test/th1-tcl7.txt
==================================================================
--- test/th1-tcl7.txt
+++ test/th1-tcl7.txt
@@ -0,0 +1,19 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+
+  #
+  # BUGBUG: Attempting to divide by zero will crash TH1 with the error:
+  #         "child killed: floating-point exception"
+  #
+  # doOut [tclEval th1Expr 2/0]
+
+  #
+  # NOTE: For now, just cause an expression syntax error.
+  #
+  doOut [tclEval th1Expr 2**0]
+</th1>

ADDED   test/th1-tcl8.txt
Index: test/th1-tcl8.txt
==================================================================
--- test/th1-tcl8.txt
+++ test/th1-tcl8.txt
@@ -0,0 +1,14 @@
+<th1>
+  #
+  # This is a "TH1 fragment" used to test the Tcl integration features of TH1.
+  # The corresponding test file executes this file using the test-th-render
+  # Fossil command.
+  #
+  proc doOut {msg} {puts $msg; puts \n}
+
+  if {[tclInvoke set tcl_version] >= 8.6} {
+    doOut [tclInvoke tailcall set x 1]
+  } else {
+    doOut "This test requires Tcl 8.6 or higher."
+  }
+</th1>

ADDED   win/Makefile.mingw.mistachkin
Index: win/Makefile.mingw.mistachkin
==================================================================
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -0,0 +1,1052 @@
+#!/usr/bin/make
+#
+# This is a makefile for us on windows using mingw.
+#
+#### The toplevel directory of the source tree.  Fossil can be built
+#    in a directory that is separate from the source tree.  Just change
+#    the following to point from the build directory to the src/ folder.
+#
+SRCDIR = src
+
+#### The directory into which object code files should be written.
+#
+OBJDIR = wbld
+
+#### C Compiler and options for use in building executables that
+#    will run on the platform that is doing the build.  This is used
+#    to compile code-generator programs as part of the build process.
+#    See TCC below for the C compiler for building the finished binary.
+#
+BCC = gcc
+
+#### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
+#
+FOSSIL_ENABLE_SSL=1
+
+#### Enable scripting support via Tcl/Tk
+#
+FOSSIL_ENABLE_TCL=1
+
+#### Use the Tcl source directory instead of the install directory?
+#    This is useful when Tcl has been compiled statically with MinGW.
+#
+FOSSIL_TCL_SOURCE=1
+
+#### The directory where the zlib library source code is located.
+#    The recommended usage here is to use the Sysinternals junction tool
+#    to create a hard link between an "zlib-1.x.y" sub-directory of the
+#    Fossil source code directory and the target zlib source directory.
+#
+ZLIBDIR = $(SRCDIR)/../zlib-1.2.5
+
+#### The directory where the OpenSSL library source code is located.
+#    The recommended usage here is to use the Sysinternals junction tool
+#    to create a hard link between an "openssl-1.x" sub-directory of the
+#    Fossil source code directory and the target OpenSSL source directory.
+#
+OPENSSLDIR = $(SRCDIR)/../openssl-1.0.0e
+
+#### Either the directory where the Tcl library is installed or the Tcl
+#    source code directory resides (depending on the value of the macro
+#    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
+#    this directory must have "include" and "lib" sub-directories.  If
+#    this points to the Tcl source code directory, this directory must
+#    have "generic" and "win" sub-directories.  The recommended usage
+#    here is to use the Sysinternals junction tool to create a hard
+#    link between a "tcl-8.x" sub-directory of the Fossil source code
+#    directory and the target Tcl directory.  This removes the need to
+#    hard-code the necessary paths in this Makefile.
+#
+TCLDIR = $(SRCDIR)/../tcl-8.6
+
+#### C Compile and options for use in building executables that
+#    will run on the target platform.  This is usually the same
+#    as BCC, unless you are cross-compiling.  This C compiler builds
+#    the finished binary for fossil.  The BCC compiler above is used
+#    for building intermediate code-generator tools.
+#
+TCC = gcc -Os -Wall -L$(ZLIBDIR) -I$(ZLIBDIR)
+
+# With HTTPS support
+ifdef FOSSIL_ENABLE_SSL
+TCC += -L$(OPENSSLDIR) -I$(OPENSSLDIR)/include
+endif
+
+# With Tcl support
+ifdef FOSSIL_ENABLE_TCL
+ifdef FOSSIL_TCL_SOURCE
+TCC += -L$(TCLDIR)/win -I$(TCLDIR)/generic -I$(TCLDIR)/win
+else
+TCC += -L$(TCLDIR)/lib -I$(TCLDIR)/include
+endif
+endif
+
+# With HTTPS support
+ifdef FOSSIL_ENABLE_SSL
+TCC += -DFOSSIL_ENABLE_SSL=1
+endif
+
+# With Tcl support (statically linked)
+ifdef FOSSIL_ENABLE_TCL
+TCC += -DFOSSIL_ENABLE_TCL=1 -DSTATIC_BUILD
+endif
+
+#### Extra arguments for linking the finished binary.  Fossil needs
+#    to link against the Z-Lib compression library.  There are no
+#    other mandatory dependencies.  We add the -static option here
+#    so that we can build a static executable that will run in a
+#    chroot jail.
+#
+LIB = -static
+LIB += -lmingwex -lz
+
+# OpenSSL: Add the necessary libaries required.
+ifdef FOSSIL_ENABLE_SSL
+LIB += -lssl -lcrypto -lgdi32
+endif
+
+# Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
+ifdef FOSSIL_ENABLE_TCL
+LIB += -ltcl86
+endif
+
+#### These libraries MUST appear in the same order as they do for Tcl
+#    or linking with it will not work (exact reason unknown).
+#
+LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
+
+#### Tcl shell for use in running the fossil testsuite.  This is only
+#    used for testing.  If you do not run
+#
+TCLSH = tclsh
+
+#### Nullsoft installer makensis location
+#
+MAKENSIS = "c:\Program Files\NSIS\makensis.exe"
+
+#### Include a configuration file that can override any one of these settings.
+#
+-include config.w32
+
+# STOP HERE
+# You should not need to change anything below this line
+#--------------------------------------------------------
+XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR)
+
+SRC = \
+  $(SRCDIR)/add.c \
+  $(SRCDIR)/allrepo.c \
+  $(SRCDIR)/attach.c \
+  $(SRCDIR)/bag.c \
+  $(SRCDIR)/bisect.c \
+  $(SRCDIR)/blob.c \
+  $(SRCDIR)/branch.c \
+  $(SRCDIR)/browse.c \
+  $(SRCDIR)/captcha.c \
+  $(SRCDIR)/cgi.c \
+  $(SRCDIR)/checkin.c \
+  $(SRCDIR)/checkout.c \
+  $(SRCDIR)/clearsign.c \
+  $(SRCDIR)/clone.c \
+  $(SRCDIR)/comformat.c \
+  $(SRCDIR)/configure.c \
+  $(SRCDIR)/content.c \
+  $(SRCDIR)/db.c \
+  $(SRCDIR)/delta.c \
+  $(SRCDIR)/deltacmd.c \
+  $(SRCDIR)/descendants.c \
+  $(SRCDIR)/diff.c \
+  $(SRCDIR)/diffcmd.c \
+  $(SRCDIR)/doc.c \
+  $(SRCDIR)/encode.c \
+  $(SRCDIR)/event.c \
+  $(SRCDIR)/export.c \
+  $(SRCDIR)/file.c \
+  $(SRCDIR)/finfo.c \
+  $(SRCDIR)/glob.c \
+  $(SRCDIR)/graph.c \
+  $(SRCDIR)/gzip.c \
+  $(SRCDIR)/http.c \
+  $(SRCDIR)/http_socket.c \
+  $(SRCDIR)/http_ssl.c \
+  $(SRCDIR)/http_transport.c \
+  $(SRCDIR)/import.c \
+  $(SRCDIR)/info.c \
+  $(SRCDIR)/leaf.c \
+  $(SRCDIR)/login.c \
+  $(SRCDIR)/main.c \
+  $(SRCDIR)/manifest.c \
+  $(SRCDIR)/md5.c \
+  $(SRCDIR)/merge.c \
+  $(SRCDIR)/merge3.c \
+  $(SRCDIR)/name.c \
+  $(SRCDIR)/path.c \
+  $(SRCDIR)/pivot.c \
+  $(SRCDIR)/popen.c \
+  $(SRCDIR)/pqueue.c \
+  $(SRCDIR)/printf.c \
+  $(SRCDIR)/rebuild.c \
+  $(SRCDIR)/report.c \
+  $(SRCDIR)/rss.c \
+  $(SRCDIR)/schema.c \
+  $(SRCDIR)/search.c \
+  $(SRCDIR)/setup.c \
+  $(SRCDIR)/sha1.c \
+  $(SRCDIR)/shun.c \
+  $(SRCDIR)/skins.c \
+  $(SRCDIR)/sqlcmd.c \
+  $(SRCDIR)/stash.c \
+  $(SRCDIR)/stat.c \
+  $(SRCDIR)/style.c \
+  $(SRCDIR)/sync.c \
+  $(SRCDIR)/tag.c \
+  $(SRCDIR)/tar.c \
+  $(SRCDIR)/th_main.c \
+  $(SRCDIR)/timeline.c \
+  $(SRCDIR)/tkt.c \
+  $(SRCDIR)/tktsetup.c \
+  $(SRCDIR)/undo.c \
+  $(SRCDIR)/update.c \
+  $(SRCDIR)/url.c \
+  $(SRCDIR)/user.c \
+  $(SRCDIR)/verify.c \
+  $(SRCDIR)/vfile.c \
+  $(SRCDIR)/wiki.c \
+  $(SRCDIR)/wikiformat.c \
+  $(SRCDIR)/winhttp.c \
+  $(SRCDIR)/xfer.c \
+  $(SRCDIR)/zip.c
+
+TRANS_SRC = \
+  $(OBJDIR)/add_.c \
+  $(OBJDIR)/allrepo_.c \
+  $(OBJDIR)/attach_.c \
+  $(OBJDIR)/bag_.c \
+  $(OBJDIR)/bisect_.c \
+  $(OBJDIR)/blob_.c \
+  $(OBJDIR)/branch_.c \
+  $(OBJDIR)/browse_.c \
+  $(OBJDIR)/captcha_.c \
+  $(OBJDIR)/cgi_.c \
+  $(OBJDIR)/checkin_.c \
+  $(OBJDIR)/checkout_.c \
+  $(OBJDIR)/clearsign_.c \
+  $(OBJDIR)/clone_.c \
+  $(OBJDIR)/comformat_.c \
+  $(OBJDIR)/configure_.c \
+  $(OBJDIR)/content_.c \
+  $(OBJDIR)/db_.c \
+  $(OBJDIR)/delta_.c \
+  $(OBJDIR)/deltacmd_.c \
+  $(OBJDIR)/descendants_.c \
+  $(OBJDIR)/diff_.c \
+  $(OBJDIR)/diffcmd_.c \
+  $(OBJDIR)/doc_.c \
+  $(OBJDIR)/encode_.c \
+  $(OBJDIR)/event_.c \
+  $(OBJDIR)/export_.c \
+  $(OBJDIR)/file_.c \
+  $(OBJDIR)/finfo_.c \
+  $(OBJDIR)/glob_.c \
+  $(OBJDIR)/graph_.c \
+  $(OBJDIR)/gzip_.c \
+  $(OBJDIR)/http_.c \
+  $(OBJDIR)/http_socket_.c \
+  $(OBJDIR)/http_ssl_.c \
+  $(OBJDIR)/http_transport_.c \
+  $(OBJDIR)/import_.c \
+  $(OBJDIR)/info_.c \
+  $(OBJDIR)/leaf_.c \
+  $(OBJDIR)/login_.c \
+  $(OBJDIR)/main_.c \
+  $(OBJDIR)/manifest_.c \
+  $(OBJDIR)/md5_.c \
+  $(OBJDIR)/merge_.c \
+  $(OBJDIR)/merge3_.c \
+  $(OBJDIR)/name_.c \
+  $(OBJDIR)/path_.c \
+  $(OBJDIR)/pivot_.c \
+  $(OBJDIR)/popen_.c \
+  $(OBJDIR)/pqueue_.c \
+  $(OBJDIR)/printf_.c \
+  $(OBJDIR)/rebuild_.c \
+  $(OBJDIR)/report_.c \
+  $(OBJDIR)/rss_.c \
+  $(OBJDIR)/schema_.c \
+  $(OBJDIR)/search_.c \
+  $(OBJDIR)/setup_.c \
+  $(OBJDIR)/sha1_.c \
+  $(OBJDIR)/shun_.c \
+  $(OBJDIR)/skins_.c \
+  $(OBJDIR)/sqlcmd_.c \
+  $(OBJDIR)/stash_.c \
+  $(OBJDIR)/stat_.c \
+  $(OBJDIR)/style_.c \
+  $(OBJDIR)/sync_.c \
+  $(OBJDIR)/tag_.c \
+  $(OBJDIR)/tar_.c \
+  $(OBJDIR)/th_main_.c \
+  $(OBJDIR)/timeline_.c \
+  $(OBJDIR)/tkt_.c \
+  $(OBJDIR)/tktsetup_.c \
+  $(OBJDIR)/undo_.c \
+  $(OBJDIR)/update_.c \
+  $(OBJDIR)/url_.c \
+  $(OBJDIR)/user_.c \
+  $(OBJDIR)/verify_.c \
+  $(OBJDIR)/vfile_.c \
+  $(OBJDIR)/wiki_.c \
+  $(OBJDIR)/wikiformat_.c \
+  $(OBJDIR)/winhttp_.c \
+  $(OBJDIR)/xfer_.c \
+  $(OBJDIR)/zip_.c
+
+OBJ = \
+ $(OBJDIR)/add.o \
+ $(OBJDIR)/allrepo.o \
+ $(OBJDIR)/attach.o \
+ $(OBJDIR)/bag.o \
+ $(OBJDIR)/bisect.o \
+ $(OBJDIR)/blob.o \
+ $(OBJDIR)/branch.o \
+ $(OBJDIR)/browse.o \
+ $(OBJDIR)/captcha.o \
+ $(OBJDIR)/cgi.o \
+ $(OBJDIR)/checkin.o \
+ $(OBJDIR)/checkout.o \
+ $(OBJDIR)/clearsign.o \
+ $(OBJDIR)/clone.o \
+ $(OBJDIR)/comformat.o \
+ $(OBJDIR)/configure.o \
+ $(OBJDIR)/content.o \
+ $(OBJDIR)/db.o \
+ $(OBJDIR)/delta.o \
+ $(OBJDIR)/deltacmd.o \
+ $(OBJDIR)/descendants.o \
+ $(OBJDIR)/diff.o \
+ $(OBJDIR)/diffcmd.o \
+ $(OBJDIR)/doc.o \
+ $(OBJDIR)/encode.o \
+ $(OBJDIR)/event.o \
+ $(OBJDIR)/export.o \
+ $(OBJDIR)/file.o \
+ $(OBJDIR)/finfo.o \
+ $(OBJDIR)/glob.o \
+ $(OBJDIR)/graph.o \
+ $(OBJDIR)/gzip.o \
+ $(OBJDIR)/http.o \
+ $(OBJDIR)/http_socket.o \
+ $(OBJDIR)/http_ssl.o \
+ $(OBJDIR)/http_transport.o \
+ $(OBJDIR)/import.o \
+ $(OBJDIR)/info.o \
+ $(OBJDIR)/leaf.o \
+ $(OBJDIR)/login.o \
+ $(OBJDIR)/main.o \
+ $(OBJDIR)/manifest.o \
+ $(OBJDIR)/md5.o \
+ $(OBJDIR)/merge.o \
+ $(OBJDIR)/merge3.o \
+ $(OBJDIR)/name.o \
+ $(OBJDIR)/path.o \
+ $(OBJDIR)/pivot.o \
+ $(OBJDIR)/popen.o \
+ $(OBJDIR)/pqueue.o \
+ $(OBJDIR)/printf.o \
+ $(OBJDIR)/rebuild.o \
+ $(OBJDIR)/report.o \
+ $(OBJDIR)/rss.o \
+ $(OBJDIR)/schema.o \
+ $(OBJDIR)/search.o \
+ $(OBJDIR)/setup.o \
+ $(OBJDIR)/sha1.o \
+ $(OBJDIR)/shun.o \
+ $(OBJDIR)/skins.o \
+ $(OBJDIR)/sqlcmd.o \
+ $(OBJDIR)/stash.o \
+ $(OBJDIR)/stat.o \
+ $(OBJDIR)/style.o \
+ $(OBJDIR)/sync.o \
+ $(OBJDIR)/tag.o \
+ $(OBJDIR)/tar.o \
+ $(OBJDIR)/th_main.o \
+ $(OBJDIR)/timeline.o \
+ $(OBJDIR)/tkt.o \
+ $(OBJDIR)/tktsetup.o \
+ $(OBJDIR)/undo.o \
+ $(OBJDIR)/update.o \
+ $(OBJDIR)/url.o \
+ $(OBJDIR)/user.o \
+ $(OBJDIR)/verify.o \
+ $(OBJDIR)/vfile.o \
+ $(OBJDIR)/wiki.o \
+ $(OBJDIR)/wikiformat.o \
+ $(OBJDIR)/winhttp.o \
+ $(OBJDIR)/xfer.o \
+ $(OBJDIR)/zip.o
+
+APPNAME = fossil.exe
+TRANSLATE   = $(subst /,\\,$(OBJDIR)/translate.exe)
+MAKEHEADERS = $(subst /,\\,$(OBJDIR)/makeheaders.exe)
+MKINDEX     = $(subst /,\\,$(OBJDIR)/mkindex.exe)
+VERSION     = $(subst /,\\,$(OBJDIR)/version.exe)
+
+
+all:	$(OBJDIR) $(APPNAME)
+
+$(OBJDIR)/icon.o:	$(SRCDIR)/../win/icon.rc
+	cp $(SRCDIR)/../win/icon.rc $(OBJDIR)
+	windres $(OBJDIR)/icon.rc -o $(OBJDIR)/icon.o
+
+install:	$(APPNAME)
+	mv $(APPNAME) $(INSTALLDIR)
+
+$(OBJDIR):
+	mkdir $(OBJDIR)
+
+$(OBJDIR)/translate:	$(SRCDIR)/translate.c
+	$(BCC) -o $(OBJDIR)/translate $(SRCDIR)/translate.c
+
+$(OBJDIR)/makeheaders:	$(SRCDIR)/makeheaders.c
+	$(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
+
+$(OBJDIR)/mkindex:	$(SRCDIR)/mkindex.c
+	$(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
+
+$(VERSION): $(SRCDIR)/mkversion.c
+	$(BCC) -o $(OBJDIR)/version $(SRCDIR)/mkversion.c
+
+# WARNING. DANGER. Running the testsuite modifies the repository the
+# build is done from, i.e. the checkout belongs to. Do not sync/push
+# the repository after running the tests.
+test:	$(OBJDIR) $(APPNAME)
+	$(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME)
+
+$(OBJDIR)/VERSION.h:	$(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION)
+	$(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
+
+EXTRAOBJ =  $(OBJDIR)/sqlite3.o  $(OBJDIR)/shell.o  $(OBJDIR)/th.o  $(OBJDIR)/th_lang.o
+
+ifdef FOSSIL_ENABLE_TCL
+EXTRAOBJ +=  $(OBJDIR)/th_tcl.o
+endif
+
+$(APPNAME):	$(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) $(OBJDIR)/icon.o
+	$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) $(OBJDIR)/icon.o
+
+# This rule prevents make from using its default rules to try build
+# an executable named "manifest" out of the file named "manifest.c"
+#
+$(SRCDIR)/../manifest:
+	# noop
+
+# Requires msys to be installed in addition to the mingw, for the "rm"
+# command.  "del" will not work here because it is not a separate command
+# but a MSDOS-shell builtin.
+#
+clean:
+	rm -rf $(OBJDIR) $(APPNAME)
+
+setup: $(OBJDIR) $(APPNAME)
+	$(MAKENSIS) ./fossil.nsi
+
+
+$(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex
+	$(MKINDEX) $(TRANS_SRC) >$@
+$(OBJDIR)/headers:	$(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h
+	$(MAKEHEADERS)  $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h
+	echo Done >$(OBJDIR)/headers
+
+$(OBJDIR)/headers: Makefile
+Makefile:
+$(OBJDIR)/add_.c:	$(SRCDIR)/add.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/add.c >$(OBJDIR)/add_.c
+
+$(OBJDIR)/add.o:	$(OBJDIR)/add_.c $(OBJDIR)/add.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/add.o -c $(OBJDIR)/add_.c
+
+add.h:	$(OBJDIR)/headers
+$(OBJDIR)/allrepo_.c:	$(SRCDIR)/allrepo.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/allrepo.c >$(OBJDIR)/allrepo_.c
+
+$(OBJDIR)/allrepo.o:	$(OBJDIR)/allrepo_.c $(OBJDIR)/allrepo.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/allrepo.o -c $(OBJDIR)/allrepo_.c
+
+allrepo.h:	$(OBJDIR)/headers
+$(OBJDIR)/attach_.c:	$(SRCDIR)/attach.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/attach.c >$(OBJDIR)/attach_.c
+
+$(OBJDIR)/attach.o:	$(OBJDIR)/attach_.c $(OBJDIR)/attach.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/attach.o -c $(OBJDIR)/attach_.c
+
+attach.h:	$(OBJDIR)/headers
+$(OBJDIR)/bag_.c:	$(SRCDIR)/bag.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/bag.c >$(OBJDIR)/bag_.c
+
+$(OBJDIR)/bag.o:	$(OBJDIR)/bag_.c $(OBJDIR)/bag.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/bag.o -c $(OBJDIR)/bag_.c
+
+bag.h:	$(OBJDIR)/headers
+$(OBJDIR)/bisect_.c:	$(SRCDIR)/bisect.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/bisect.c >$(OBJDIR)/bisect_.c
+
+$(OBJDIR)/bisect.o:	$(OBJDIR)/bisect_.c $(OBJDIR)/bisect.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/bisect.o -c $(OBJDIR)/bisect_.c
+
+bisect.h:	$(OBJDIR)/headers
+$(OBJDIR)/blob_.c:	$(SRCDIR)/blob.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/blob.c >$(OBJDIR)/blob_.c
+
+$(OBJDIR)/blob.o:	$(OBJDIR)/blob_.c $(OBJDIR)/blob.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/blob.o -c $(OBJDIR)/blob_.c
+
+blob.h:	$(OBJDIR)/headers
+$(OBJDIR)/branch_.c:	$(SRCDIR)/branch.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/branch.c >$(OBJDIR)/branch_.c
+
+$(OBJDIR)/branch.o:	$(OBJDIR)/branch_.c $(OBJDIR)/branch.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/branch.o -c $(OBJDIR)/branch_.c
+
+branch.h:	$(OBJDIR)/headers
+$(OBJDIR)/browse_.c:	$(SRCDIR)/browse.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/browse.c >$(OBJDIR)/browse_.c
+
+$(OBJDIR)/browse.o:	$(OBJDIR)/browse_.c $(OBJDIR)/browse.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/browse.o -c $(OBJDIR)/browse_.c
+
+browse.h:	$(OBJDIR)/headers
+$(OBJDIR)/captcha_.c:	$(SRCDIR)/captcha.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/captcha.c >$(OBJDIR)/captcha_.c
+
+$(OBJDIR)/captcha.o:	$(OBJDIR)/captcha_.c $(OBJDIR)/captcha.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/captcha.o -c $(OBJDIR)/captcha_.c
+
+captcha.h:	$(OBJDIR)/headers
+$(OBJDIR)/cgi_.c:	$(SRCDIR)/cgi.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/cgi.c >$(OBJDIR)/cgi_.c
+
+$(OBJDIR)/cgi.o:	$(OBJDIR)/cgi_.c $(OBJDIR)/cgi.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/cgi.o -c $(OBJDIR)/cgi_.c
+
+cgi.h:	$(OBJDIR)/headers
+$(OBJDIR)/checkin_.c:	$(SRCDIR)/checkin.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/checkin.c >$(OBJDIR)/checkin_.c
+
+$(OBJDIR)/checkin.o:	$(OBJDIR)/checkin_.c $(OBJDIR)/checkin.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/checkin.o -c $(OBJDIR)/checkin_.c
+
+checkin.h:	$(OBJDIR)/headers
+$(OBJDIR)/checkout_.c:	$(SRCDIR)/checkout.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/checkout.c >$(OBJDIR)/checkout_.c
+
+$(OBJDIR)/checkout.o:	$(OBJDIR)/checkout_.c $(OBJDIR)/checkout.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/checkout.o -c $(OBJDIR)/checkout_.c
+
+checkout.h:	$(OBJDIR)/headers
+$(OBJDIR)/clearsign_.c:	$(SRCDIR)/clearsign.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/clearsign.c >$(OBJDIR)/clearsign_.c
+
+$(OBJDIR)/clearsign.o:	$(OBJDIR)/clearsign_.c $(OBJDIR)/clearsign.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/clearsign.o -c $(OBJDIR)/clearsign_.c
+
+clearsign.h:	$(OBJDIR)/headers
+$(OBJDIR)/clone_.c:	$(SRCDIR)/clone.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/clone.c >$(OBJDIR)/clone_.c
+
+$(OBJDIR)/clone.o:	$(OBJDIR)/clone_.c $(OBJDIR)/clone.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/clone.o -c $(OBJDIR)/clone_.c
+
+clone.h:	$(OBJDIR)/headers
+$(OBJDIR)/comformat_.c:	$(SRCDIR)/comformat.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/comformat.c >$(OBJDIR)/comformat_.c
+
+$(OBJDIR)/comformat.o:	$(OBJDIR)/comformat_.c $(OBJDIR)/comformat.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/comformat.o -c $(OBJDIR)/comformat_.c
+
+comformat.h:	$(OBJDIR)/headers
+$(OBJDIR)/configure_.c:	$(SRCDIR)/configure.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/configure.c >$(OBJDIR)/configure_.c
+
+$(OBJDIR)/configure.o:	$(OBJDIR)/configure_.c $(OBJDIR)/configure.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/configure.o -c $(OBJDIR)/configure_.c
+
+configure.h:	$(OBJDIR)/headers
+$(OBJDIR)/content_.c:	$(SRCDIR)/content.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/content.c >$(OBJDIR)/content_.c
+
+$(OBJDIR)/content.o:	$(OBJDIR)/content_.c $(OBJDIR)/content.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/content.o -c $(OBJDIR)/content_.c
+
+content.h:	$(OBJDIR)/headers
+$(OBJDIR)/db_.c:	$(SRCDIR)/db.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/db.c >$(OBJDIR)/db_.c
+
+$(OBJDIR)/db.o:	$(OBJDIR)/db_.c $(OBJDIR)/db.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/db.o -c $(OBJDIR)/db_.c
+
+db.h:	$(OBJDIR)/headers
+$(OBJDIR)/delta_.c:	$(SRCDIR)/delta.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/delta.c >$(OBJDIR)/delta_.c
+
+$(OBJDIR)/delta.o:	$(OBJDIR)/delta_.c $(OBJDIR)/delta.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/delta.o -c $(OBJDIR)/delta_.c
+
+delta.h:	$(OBJDIR)/headers
+$(OBJDIR)/deltacmd_.c:	$(SRCDIR)/deltacmd.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/deltacmd.c >$(OBJDIR)/deltacmd_.c
+
+$(OBJDIR)/deltacmd.o:	$(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
+
+deltacmd.h:	$(OBJDIR)/headers
+$(OBJDIR)/descendants_.c:	$(SRCDIR)/descendants.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/descendants.c >$(OBJDIR)/descendants_.c
+
+$(OBJDIR)/descendants.o:	$(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c
+
+descendants.h:	$(OBJDIR)/headers
+$(OBJDIR)/diff_.c:	$(SRCDIR)/diff.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/diff.c >$(OBJDIR)/diff_.c
+
+$(OBJDIR)/diff.o:	$(OBJDIR)/diff_.c $(OBJDIR)/diff.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/diff.o -c $(OBJDIR)/diff_.c
+
+diff.h:	$(OBJDIR)/headers
+$(OBJDIR)/diffcmd_.c:	$(SRCDIR)/diffcmd.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/diffcmd.c >$(OBJDIR)/diffcmd_.c
+
+$(OBJDIR)/diffcmd.o:	$(OBJDIR)/diffcmd_.c $(OBJDIR)/diffcmd.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/diffcmd.o -c $(OBJDIR)/diffcmd_.c
+
+diffcmd.h:	$(OBJDIR)/headers
+$(OBJDIR)/doc_.c:	$(SRCDIR)/doc.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/doc.c >$(OBJDIR)/doc_.c
+
+$(OBJDIR)/doc.o:	$(OBJDIR)/doc_.c $(OBJDIR)/doc.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/doc.o -c $(OBJDIR)/doc_.c
+
+doc.h:	$(OBJDIR)/headers
+$(OBJDIR)/encode_.c:	$(SRCDIR)/encode.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/encode.c >$(OBJDIR)/encode_.c
+
+$(OBJDIR)/encode.o:	$(OBJDIR)/encode_.c $(OBJDIR)/encode.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/encode.o -c $(OBJDIR)/encode_.c
+
+encode.h:	$(OBJDIR)/headers
+$(OBJDIR)/event_.c:	$(SRCDIR)/event.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/event.c >$(OBJDIR)/event_.c
+
+$(OBJDIR)/event.o:	$(OBJDIR)/event_.c $(OBJDIR)/event.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/event.o -c $(OBJDIR)/event_.c
+
+event.h:	$(OBJDIR)/headers
+$(OBJDIR)/export_.c:	$(SRCDIR)/export.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/export.c >$(OBJDIR)/export_.c
+
+$(OBJDIR)/export.o:	$(OBJDIR)/export_.c $(OBJDIR)/export.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c
+
+export.h:	$(OBJDIR)/headers
+$(OBJDIR)/file_.c:	$(SRCDIR)/file.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/file.c >$(OBJDIR)/file_.c
+
+$(OBJDIR)/file.o:	$(OBJDIR)/file_.c $(OBJDIR)/file.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c
+
+file.h:	$(OBJDIR)/headers
+$(OBJDIR)/finfo_.c:	$(SRCDIR)/finfo.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/finfo.c >$(OBJDIR)/finfo_.c
+
+$(OBJDIR)/finfo.o:	$(OBJDIR)/finfo_.c $(OBJDIR)/finfo.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/finfo.o -c $(OBJDIR)/finfo_.c
+
+finfo.h:	$(OBJDIR)/headers
+$(OBJDIR)/glob_.c:	$(SRCDIR)/glob.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/glob.c >$(OBJDIR)/glob_.c
+
+$(OBJDIR)/glob.o:	$(OBJDIR)/glob_.c $(OBJDIR)/glob.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c
+
+glob.h:	$(OBJDIR)/headers
+$(OBJDIR)/graph_.c:	$(SRCDIR)/graph.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/graph.c >$(OBJDIR)/graph_.c
+
+$(OBJDIR)/graph.o:	$(OBJDIR)/graph_.c $(OBJDIR)/graph.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/graph.o -c $(OBJDIR)/graph_.c
+
+graph.h:	$(OBJDIR)/headers
+$(OBJDIR)/gzip_.c:	$(SRCDIR)/gzip.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/gzip.c >$(OBJDIR)/gzip_.c
+
+$(OBJDIR)/gzip.o:	$(OBJDIR)/gzip_.c $(OBJDIR)/gzip.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/gzip.o -c $(OBJDIR)/gzip_.c
+
+gzip.h:	$(OBJDIR)/headers
+$(OBJDIR)/http_.c:	$(SRCDIR)/http.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/http.c >$(OBJDIR)/http_.c
+
+$(OBJDIR)/http.o:	$(OBJDIR)/http_.c $(OBJDIR)/http.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c
+
+http.h:	$(OBJDIR)/headers
+$(OBJDIR)/http_socket_.c:	$(SRCDIR)/http_socket.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/http_socket.c >$(OBJDIR)/http_socket_.c
+
+$(OBJDIR)/http_socket.o:	$(OBJDIR)/http_socket_.c $(OBJDIR)/http_socket.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/http_socket.o -c $(OBJDIR)/http_socket_.c
+
+http_socket.h:	$(OBJDIR)/headers
+$(OBJDIR)/http_ssl_.c:	$(SRCDIR)/http_ssl.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/http_ssl.c >$(OBJDIR)/http_ssl_.c
+
+$(OBJDIR)/http_ssl.o:	$(OBJDIR)/http_ssl_.c $(OBJDIR)/http_ssl.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/http_ssl.o -c $(OBJDIR)/http_ssl_.c
+
+http_ssl.h:	$(OBJDIR)/headers
+$(OBJDIR)/http_transport_.c:	$(SRCDIR)/http_transport.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/http_transport.c >$(OBJDIR)/http_transport_.c
+
+$(OBJDIR)/http_transport.o:	$(OBJDIR)/http_transport_.c $(OBJDIR)/http_transport.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/http_transport.o -c $(OBJDIR)/http_transport_.c
+
+http_transport.h:	$(OBJDIR)/headers
+$(OBJDIR)/import_.c:	$(SRCDIR)/import.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/import.c >$(OBJDIR)/import_.c
+
+$(OBJDIR)/import.o:	$(OBJDIR)/import_.c $(OBJDIR)/import.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/import.o -c $(OBJDIR)/import_.c
+
+import.h:	$(OBJDIR)/headers
+$(OBJDIR)/info_.c:	$(SRCDIR)/info.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/info.c >$(OBJDIR)/info_.c
+
+$(OBJDIR)/info.o:	$(OBJDIR)/info_.c $(OBJDIR)/info.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/info.o -c $(OBJDIR)/info_.c
+
+info.h:	$(OBJDIR)/headers
+$(OBJDIR)/leaf_.c:	$(SRCDIR)/leaf.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/leaf.c >$(OBJDIR)/leaf_.c
+
+$(OBJDIR)/leaf.o:	$(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
+
+leaf.h:	$(OBJDIR)/headers
+$(OBJDIR)/login_.c:	$(SRCDIR)/login.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/login.c >$(OBJDIR)/login_.c
+
+$(OBJDIR)/login.o:	$(OBJDIR)/login_.c $(OBJDIR)/login.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
+
+login.h:	$(OBJDIR)/headers
+$(OBJDIR)/main_.c:	$(SRCDIR)/main.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/main.c >$(OBJDIR)/main_.c
+
+$(OBJDIR)/main.o:	$(OBJDIR)/main_.c $(OBJDIR)/main.h $(OBJDIR)/page_index.h $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/main.o -c $(OBJDIR)/main_.c
+
+main.h:	$(OBJDIR)/headers
+$(OBJDIR)/manifest_.c:	$(SRCDIR)/manifest.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/manifest.c >$(OBJDIR)/manifest_.c
+
+$(OBJDIR)/manifest.o:	$(OBJDIR)/manifest_.c $(OBJDIR)/manifest.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/manifest.o -c $(OBJDIR)/manifest_.c
+
+manifest.h:	$(OBJDIR)/headers
+$(OBJDIR)/md5_.c:	$(SRCDIR)/md5.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/md5.c >$(OBJDIR)/md5_.c
+
+$(OBJDIR)/md5.o:	$(OBJDIR)/md5_.c $(OBJDIR)/md5.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/md5.o -c $(OBJDIR)/md5_.c
+
+md5.h:	$(OBJDIR)/headers
+$(OBJDIR)/merge_.c:	$(SRCDIR)/merge.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/merge.c >$(OBJDIR)/merge_.c
+
+$(OBJDIR)/merge.o:	$(OBJDIR)/merge_.c $(OBJDIR)/merge.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/merge.o -c $(OBJDIR)/merge_.c
+
+merge.h:	$(OBJDIR)/headers
+$(OBJDIR)/merge3_.c:	$(SRCDIR)/merge3.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/merge3.c >$(OBJDIR)/merge3_.c
+
+$(OBJDIR)/merge3.o:	$(OBJDIR)/merge3_.c $(OBJDIR)/merge3.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/merge3.o -c $(OBJDIR)/merge3_.c
+
+merge3.h:	$(OBJDIR)/headers
+$(OBJDIR)/name_.c:	$(SRCDIR)/name.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/name.c >$(OBJDIR)/name_.c
+
+$(OBJDIR)/name.o:	$(OBJDIR)/name_.c $(OBJDIR)/name.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/name.o -c $(OBJDIR)/name_.c
+
+name.h:	$(OBJDIR)/headers
+$(OBJDIR)/path_.c:	$(SRCDIR)/path.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/path.c >$(OBJDIR)/path_.c
+
+$(OBJDIR)/path.o:	$(OBJDIR)/path_.c $(OBJDIR)/path.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/path.o -c $(OBJDIR)/path_.c
+
+path.h:	$(OBJDIR)/headers
+$(OBJDIR)/pivot_.c:	$(SRCDIR)/pivot.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/pivot.c >$(OBJDIR)/pivot_.c
+
+$(OBJDIR)/pivot.o:	$(OBJDIR)/pivot_.c $(OBJDIR)/pivot.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/pivot.o -c $(OBJDIR)/pivot_.c
+
+pivot.h:	$(OBJDIR)/headers
+$(OBJDIR)/popen_.c:	$(SRCDIR)/popen.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/popen.c >$(OBJDIR)/popen_.c
+
+$(OBJDIR)/popen.o:	$(OBJDIR)/popen_.c $(OBJDIR)/popen.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/popen.o -c $(OBJDIR)/popen_.c
+
+popen.h:	$(OBJDIR)/headers
+$(OBJDIR)/pqueue_.c:	$(SRCDIR)/pqueue.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/pqueue.c >$(OBJDIR)/pqueue_.c
+
+$(OBJDIR)/pqueue.o:	$(OBJDIR)/pqueue_.c $(OBJDIR)/pqueue.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/pqueue.o -c $(OBJDIR)/pqueue_.c
+
+pqueue.h:	$(OBJDIR)/headers
+$(OBJDIR)/printf_.c:	$(SRCDIR)/printf.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/printf.c >$(OBJDIR)/printf_.c
+
+$(OBJDIR)/printf.o:	$(OBJDIR)/printf_.c $(OBJDIR)/printf.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/printf.o -c $(OBJDIR)/printf_.c
+
+printf.h:	$(OBJDIR)/headers
+$(OBJDIR)/rebuild_.c:	$(SRCDIR)/rebuild.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/rebuild.c >$(OBJDIR)/rebuild_.c
+
+$(OBJDIR)/rebuild.o:	$(OBJDIR)/rebuild_.c $(OBJDIR)/rebuild.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/rebuild.o -c $(OBJDIR)/rebuild_.c
+
+rebuild.h:	$(OBJDIR)/headers
+$(OBJDIR)/report_.c:	$(SRCDIR)/report.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/report.c >$(OBJDIR)/report_.c
+
+$(OBJDIR)/report.o:	$(OBJDIR)/report_.c $(OBJDIR)/report.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
+
+report.h:	$(OBJDIR)/headers
+$(OBJDIR)/rss_.c:	$(SRCDIR)/rss.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/rss.c >$(OBJDIR)/rss_.c
+
+$(OBJDIR)/rss.o:	$(OBJDIR)/rss_.c $(OBJDIR)/rss.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/rss.o -c $(OBJDIR)/rss_.c
+
+rss.h:	$(OBJDIR)/headers
+$(OBJDIR)/schema_.c:	$(SRCDIR)/schema.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/schema.c >$(OBJDIR)/schema_.c
+
+$(OBJDIR)/schema.o:	$(OBJDIR)/schema_.c $(OBJDIR)/schema.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/schema.o -c $(OBJDIR)/schema_.c
+
+schema.h:	$(OBJDIR)/headers
+$(OBJDIR)/search_.c:	$(SRCDIR)/search.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/search.c >$(OBJDIR)/search_.c
+
+$(OBJDIR)/search.o:	$(OBJDIR)/search_.c $(OBJDIR)/search.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/search.o -c $(OBJDIR)/search_.c
+
+search.h:	$(OBJDIR)/headers
+$(OBJDIR)/setup_.c:	$(SRCDIR)/setup.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/setup.c >$(OBJDIR)/setup_.c
+
+$(OBJDIR)/setup.o:	$(OBJDIR)/setup_.c $(OBJDIR)/setup.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/setup.o -c $(OBJDIR)/setup_.c
+
+setup.h:	$(OBJDIR)/headers
+$(OBJDIR)/sha1_.c:	$(SRCDIR)/sha1.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/sha1.c >$(OBJDIR)/sha1_.c
+
+$(OBJDIR)/sha1.o:	$(OBJDIR)/sha1_.c $(OBJDIR)/sha1.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/sha1.o -c $(OBJDIR)/sha1_.c
+
+sha1.h:	$(OBJDIR)/headers
+$(OBJDIR)/shun_.c:	$(SRCDIR)/shun.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/shun.c >$(OBJDIR)/shun_.c
+
+$(OBJDIR)/shun.o:	$(OBJDIR)/shun_.c $(OBJDIR)/shun.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/shun.o -c $(OBJDIR)/shun_.c
+
+shun.h:	$(OBJDIR)/headers
+$(OBJDIR)/skins_.c:	$(SRCDIR)/skins.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/skins.c >$(OBJDIR)/skins_.c
+
+$(OBJDIR)/skins.o:	$(OBJDIR)/skins_.c $(OBJDIR)/skins.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/skins.o -c $(OBJDIR)/skins_.c
+
+skins.h:	$(OBJDIR)/headers
+$(OBJDIR)/sqlcmd_.c:	$(SRCDIR)/sqlcmd.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/sqlcmd.c >$(OBJDIR)/sqlcmd_.c
+
+$(OBJDIR)/sqlcmd.o:	$(OBJDIR)/sqlcmd_.c $(OBJDIR)/sqlcmd.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/sqlcmd.o -c $(OBJDIR)/sqlcmd_.c
+
+sqlcmd.h:	$(OBJDIR)/headers
+$(OBJDIR)/stash_.c:	$(SRCDIR)/stash.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/stash.c >$(OBJDIR)/stash_.c
+
+$(OBJDIR)/stash.o:	$(OBJDIR)/stash_.c $(OBJDIR)/stash.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/stash.o -c $(OBJDIR)/stash_.c
+
+stash.h:	$(OBJDIR)/headers
+$(OBJDIR)/stat_.c:	$(SRCDIR)/stat.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/stat.c >$(OBJDIR)/stat_.c
+
+$(OBJDIR)/stat.o:	$(OBJDIR)/stat_.c $(OBJDIR)/stat.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c
+
+stat.h:	$(OBJDIR)/headers
+$(OBJDIR)/style_.c:	$(SRCDIR)/style.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/style.c >$(OBJDIR)/style_.c
+
+$(OBJDIR)/style.o:	$(OBJDIR)/style_.c $(OBJDIR)/style.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c
+
+style.h:	$(OBJDIR)/headers
+$(OBJDIR)/sync_.c:	$(SRCDIR)/sync.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/sync.c >$(OBJDIR)/sync_.c
+
+$(OBJDIR)/sync.o:	$(OBJDIR)/sync_.c $(OBJDIR)/sync.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/sync.o -c $(OBJDIR)/sync_.c
+
+sync.h:	$(OBJDIR)/headers
+$(OBJDIR)/tag_.c:	$(SRCDIR)/tag.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/tag.c >$(OBJDIR)/tag_.c
+
+$(OBJDIR)/tag.o:	$(OBJDIR)/tag_.c $(OBJDIR)/tag.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/tag.o -c $(OBJDIR)/tag_.c
+
+tag.h:	$(OBJDIR)/headers
+$(OBJDIR)/tar_.c:	$(SRCDIR)/tar.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/tar.c >$(OBJDIR)/tar_.c
+
+$(OBJDIR)/tar.o:	$(OBJDIR)/tar_.c $(OBJDIR)/tar.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/tar.o -c $(OBJDIR)/tar_.c
+
+tar.h:	$(OBJDIR)/headers
+$(OBJDIR)/th_main_.c:	$(SRCDIR)/th_main.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/th_main.c >$(OBJDIR)/th_main_.c
+
+$(OBJDIR)/th_main.o:	$(OBJDIR)/th_main_.c $(OBJDIR)/th_main.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/th_main.o -c $(OBJDIR)/th_main_.c
+
+th_main.h:	$(OBJDIR)/headers
+$(OBJDIR)/timeline_.c:	$(SRCDIR)/timeline.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/timeline.c >$(OBJDIR)/timeline_.c
+
+$(OBJDIR)/timeline.o:	$(OBJDIR)/timeline_.c $(OBJDIR)/timeline.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/timeline.o -c $(OBJDIR)/timeline_.c
+
+timeline.h:	$(OBJDIR)/headers
+$(OBJDIR)/tkt_.c:	$(SRCDIR)/tkt.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/tkt.c >$(OBJDIR)/tkt_.c
+
+$(OBJDIR)/tkt.o:	$(OBJDIR)/tkt_.c $(OBJDIR)/tkt.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/tkt.o -c $(OBJDIR)/tkt_.c
+
+tkt.h:	$(OBJDIR)/headers
+$(OBJDIR)/tktsetup_.c:	$(SRCDIR)/tktsetup.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/tktsetup.c >$(OBJDIR)/tktsetup_.c
+
+$(OBJDIR)/tktsetup.o:	$(OBJDIR)/tktsetup_.c $(OBJDIR)/tktsetup.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/tktsetup.o -c $(OBJDIR)/tktsetup_.c
+
+tktsetup.h:	$(OBJDIR)/headers
+$(OBJDIR)/undo_.c:	$(SRCDIR)/undo.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/undo.c >$(OBJDIR)/undo_.c
+
+$(OBJDIR)/undo.o:	$(OBJDIR)/undo_.c $(OBJDIR)/undo.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/undo.o -c $(OBJDIR)/undo_.c
+
+undo.h:	$(OBJDIR)/headers
+$(OBJDIR)/update_.c:	$(SRCDIR)/update.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/update.c >$(OBJDIR)/update_.c
+
+$(OBJDIR)/update.o:	$(OBJDIR)/update_.c $(OBJDIR)/update.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/update.o -c $(OBJDIR)/update_.c
+
+update.h:	$(OBJDIR)/headers
+$(OBJDIR)/url_.c:	$(SRCDIR)/url.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/url.c >$(OBJDIR)/url_.c
+
+$(OBJDIR)/url.o:	$(OBJDIR)/url_.c $(OBJDIR)/url.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/url.o -c $(OBJDIR)/url_.c
+
+url.h:	$(OBJDIR)/headers
+$(OBJDIR)/user_.c:	$(SRCDIR)/user.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/user.c >$(OBJDIR)/user_.c
+
+$(OBJDIR)/user.o:	$(OBJDIR)/user_.c $(OBJDIR)/user.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/user.o -c $(OBJDIR)/user_.c
+
+user.h:	$(OBJDIR)/headers
+$(OBJDIR)/verify_.c:	$(SRCDIR)/verify.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/verify.c >$(OBJDIR)/verify_.c
+
+$(OBJDIR)/verify.o:	$(OBJDIR)/verify_.c $(OBJDIR)/verify.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/verify.o -c $(OBJDIR)/verify_.c
+
+verify.h:	$(OBJDIR)/headers
+$(OBJDIR)/vfile_.c:	$(SRCDIR)/vfile.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/vfile.c >$(OBJDIR)/vfile_.c
+
+$(OBJDIR)/vfile.o:	$(OBJDIR)/vfile_.c $(OBJDIR)/vfile.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/vfile.o -c $(OBJDIR)/vfile_.c
+
+vfile.h:	$(OBJDIR)/headers
+$(OBJDIR)/wiki_.c:	$(SRCDIR)/wiki.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/wiki.c >$(OBJDIR)/wiki_.c
+
+$(OBJDIR)/wiki.o:	$(OBJDIR)/wiki_.c $(OBJDIR)/wiki.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/wiki.o -c $(OBJDIR)/wiki_.c
+
+wiki.h:	$(OBJDIR)/headers
+$(OBJDIR)/wikiformat_.c:	$(SRCDIR)/wikiformat.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/wikiformat.c >$(OBJDIR)/wikiformat_.c
+
+$(OBJDIR)/wikiformat.o:	$(OBJDIR)/wikiformat_.c $(OBJDIR)/wikiformat.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/wikiformat.o -c $(OBJDIR)/wikiformat_.c
+
+wikiformat.h:	$(OBJDIR)/headers
+$(OBJDIR)/winhttp_.c:	$(SRCDIR)/winhttp.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/winhttp.c >$(OBJDIR)/winhttp_.c
+
+$(OBJDIR)/winhttp.o:	$(OBJDIR)/winhttp_.c $(OBJDIR)/winhttp.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/winhttp.o -c $(OBJDIR)/winhttp_.c
+
+winhttp.h:	$(OBJDIR)/headers
+$(OBJDIR)/xfer_.c:	$(SRCDIR)/xfer.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/xfer.c >$(OBJDIR)/xfer_.c
+
+$(OBJDIR)/xfer.o:	$(OBJDIR)/xfer_.c $(OBJDIR)/xfer.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/xfer.o -c $(OBJDIR)/xfer_.c
+
+xfer.h:	$(OBJDIR)/headers
+$(OBJDIR)/zip_.c:	$(SRCDIR)/zip.c $(OBJDIR)/translate
+	$(TRANSLATE) $(SRCDIR)/zip.c >$(OBJDIR)/zip_.c
+
+$(OBJDIR)/zip.o:	$(OBJDIR)/zip_.c $(OBJDIR)/zip.h  $(SRCDIR)/config.h
+	$(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
+
+zip.h:	$(OBJDIR)/headers
+$(OBJDIR)/sqlite3.o:	$(SRCDIR)/sqlite3.c
+	$(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT2 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
+
+$(OBJDIR)/shell.o:	$(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
+	$(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
+
+$(OBJDIR)/th.o:	$(SRCDIR)/th.c
+	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
+
+$(OBJDIR)/th_lang.o:	$(SRCDIR)/th_lang.c
+	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
+
+ifdef FOSSIL_ENABLE_TCL
+$(OBJDIR)/th_tcl.o:	$(SRCDIR)/th_tcl.c
+	$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
+endif
+