                             DEPENDENCIES
                             ============

                              ---*nix---

The following dependencies must be in the path:

  OCaml
  OMake
  flex
  bison
  diff
  perl

                            ---Windows---

Teyjus can be compiled with either the Cygwin toolchain or the MS
toolchain.

Cygwin:
  The following software must be installed.

    OCaml for the MinGW toolchain   http://caml.inria.fr/
    OMake                           http://omake.metaprl.org/
    Cygwin                          http://www.cygwin.com/

  When installing Cygwin, you must select the following packages
    Devel: bison
    Devel: gcc
    Devel: flex

  After Cygwin is installed, you must put Cygwin's binary directory
  in your path. For example, 'C:\cygwin\bin'


Microsoft Visual Studio 2008:
  The following dependencies must be in the path.  Listed is a place
  to get either the actual dependency, or information on procuring it.
  
  OCaml                           http://caml.inria.fr/
  Microsoft Visual Studio 2008    http://msdn.microsoft.com/vstudio/
  ocamake                         /util/ocamake.ml  (included)
  flex                            http://gnuwin32.sourceforge.net/
  bison                           http://gnuwin32.sourceforge.net/
  diff                            http://gnuwin32.sourceforge.net/
  perl                            http://www.activestate.com/


                             BUILD SYSTEM
                             ============

                        ---*nix and Cygwin---

  To build the system in a *nix or Cygwin environment, use omake:

  component                 command                    path
  -----------------------------------------------------------------
  compiler                  omake tjcc                 teyjus/source
  
  simulator                 omake tjsim                teyjus/source
  
  disassembler              omake tjdis                teyjus/source
  
  linker                    omake tjlink               teyjus/source

  dependency analyzer       omake tjdepend             teyjus/source  
  
  parser                    omake tjparse              teyjus/source
  
  all                       omake all                  teyjus/source


             ---Windows: Microsoft Visual Studio 2008---

  Installing dependencies:
    Make sure that O'Caml is installed and in your path.

    Make sure that flex and bison are in your path.

    Build ocamake and make sure it is in your path.  To build ocamake,
    run this command in the /util directory of the distribution:
      ocamlc unix.cma str.cma ocamake.ml -o ocamake.exe
    Then, copy that file into your ocaml/bin directory, or alternatively
    modify your path.  Be sure to use the provided version of ocamake.ml, as
    it has been patched to work with Visual Studio 2008 project files.

  Building the System:
    To build the system in a Windows environment, use the provided
    Microsoft Visual Studio 2008 solution file, (/source/VisualStudio/Teyjus.sln).

    Then, simply click "Build\Rebuild Solution", or type Ctrl + Alt + F7.

    The result should be "9 succeeded, 0 failed, 0 skipped."  The produced
    binaries will be written to /source/VisualStudio/Debug, to /bin, and to
    /source.  In addition, the file /source/prebuilt will be created; this will
    allow the tests to run correctly.

    Note that there is no support for building Teyjus using omake on Windows as
    of yet.

  Testing:
    The testing harness only partially works on Windows.  The test "maps" fails
    due to ActivePerl's method of calling other programs through cmd.exe.


                             SYSTEM USAGE
                             ============

  1. compiler (teyjus/source/tjcc)
  --------------------------------
  
  Usage: tjcc [options] <module-names>
  options are:
    -o         Specifies the name of the output bytecode file
    --output   Specifies the name of the output bytecode file
    -p         Add PATH to the search path.
    --path     Add PATH to the search path.
    -v         Return the system version
    --version  Return the system version
    -help      Display this list of options
    --help     Display this list of options
  
  
  2. simulator (tejus/source/tjsim)
  ---------------------------------
  
  Usage: tjsim [options] <module-name>
  options are:
    -p         Add PATH to the search path.
    --path     Add PATH to the search path.
    -s         Solve the given query on startup. Several queries may be specified
    --solve    Solve the given query on startup. Several queries may be specified
    -e         Expect at least this many solutions from each query;
                  error if fewer. Valid only in batch mode
    --expect   Expect at least this many solutions from each query;
                  error if fewer. Valid only in batch mode
    -m         Halt after this many solutions to the query have been found.
                  Valid only in batch mode
    --maximum  Halt after this many solutions to the query have been found.
                  Valid only in batch mode
    -q         Suppress all non-error output from the system,
                  except variable bindings on query success
    --quiet    Suppress all non-error output from the system,
                  except variable bindings on query success
    -b         Suppress system interaction; send all output without stopping
    --batch    Suppress system interaction; send all output without stopping
    -k         Allocate a heap of the given size (K)
    --heap     Allocate a heap of the given size (K)
    -v         Return the system version
    --version  Return the system version
    -help      Display this list of options
    --help     Display this list of options
  
  3. disassembler (teyjus/source/tjdis)
  -------------------------------------
  
  Usage: tjdis [options] <object-file>
  options are:
    -t         Only print tables
    --table    Only print tables
    -i         Only print instructions
    --instr    Only print instructions
    -v         Return the system version
    --version  Return the system version
    -help      Display this list of options
    --help     Display this list of options
  
  
  4. linker (teyjus/source/tjlink)
  --------------------------------
  
  Usage: tjlink [options] <module-name>
  -V         Produce verbose output - use multiple times to increase verbosity
  --verbose  Produce verbose output - use multiple times to increase verbosity
  -v         Return the system version
  --version  Return the system version
  -help      Display this list of options
  --help     Display this list of options

  
  5. dependency analyzer (teyjus/source/tjdepend)
  -----------------------------------------------
  
  Usage: tjdepend [options] <module-files>
  options are:
    -v         Return the system version
    --version  Return the system version
    -help      Display this list of options
    --help     Display this list of options
  

  6. parser (teyjus/source/tjparse)
  -----------------------------------------------

  Usage: tjparse [options] <file>
  options are:
    -o         Specifies the name of the output module
    --output   Specifies the name of the output module
    -v         Return the system version
    --version  Return the system version
    -help      Display this list of options
    --help     Display this list of options

                               TESTING
                               =======

                        ---*nix and Cygwin---

  All tests reside in teyjus/source/test.

  1. testing compiler:

    a. all test cases:
       use "omake compiler-test" under teyjus/source/test

    b. individual test case:
       use "omake compiler-test" under the directory containing a test case


  2. testing linker:

    a. all test cases:
       use "omake linker-test" under teyjus/source/test

    b. individual test case:
       use "omake linker-test" under the directory containing a test case


  3. system test:

     use "omake system-test" under teyjus/source/test

     
  4. all the above tests:

     use "omake test" under teyjus/source/test


             ---Windows: Microsoft Visual Studio 2008---

  All of the above applies, however the file /source/prebuilt must exist in
  order to run the tests.  The file can contain anything (or nothing) at all;
  its existence is used by the build system to determine whether or not to
  attempt to rebuild the Teyjus binaries.

                            DOCUMENTATION
                            =============
  See also:
    /source/compiler/README
    /source/front/README
    /source/include/README
    /source/linker/README
    /source/loader/README
    /source/simulator/README
    /source/system/README
    /source/tables/README
    
