Copyright (c) 2007 Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
  
This code 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.  See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
 
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.

________________________________________________________________________________

__Introduction__________________________________________________________________

This readme file should provide all the information needed to build
the HotSpot VM for Windows 95/Windows NT from its teamware workspace.
It is intended as a starting point for people who want to learn how
to work with the current HotSpot source workspace and who need to
build the VM locally. It is not intended as a tutorial for licensees.

Last update: 03/28/05


__Platform______________________________________________________________________

The VM builds under the following platforms:
- Windows NT 4.0 on Intel x486 or greater
- x486 PC (or greater), 32MByte or more


__Tools_________________________________________________________________________

For building/testing the following tools need to be available:
- Microsoft Visual C++ 6.0 (with nmake version 1.62.7022 or greater)
- MKS Toolkit 6.1 or greater
  see: /net/reinstall/export/vol0/pc-archive/software/mks6.1 (NFS)
   or: \\reinstall\pc-archive\software\mks6.1                (NT)


__JDK___________________________________________________________________________

The workspace works with the following version of the JDK:
(NOTE: these are out of date)
- JDK1.2FCS "V" build
  see: /usr/local/java/jdk1.2/win32

and the following version(s) of HotJava:
- hjb1.1.4
- hjb1.1.5
  see /usr/local/java/hjb1.1.x/win32


__Environment variables_________________________________________________________

The following environment variables need to be set up for the IDE
build process.  For batch builds these do not need to be set.

HotSpotMksHome     points to the (NFS or PC-local) directory where the MKS
                   executables (like sh.exe and grep.exe) are installed

Optionally you may set the following variables in your environment and they
will be picked up by the create.bat script used to generate the vm.vcproj files.
See the section on building within MS Developer Studio for more details.

HotSpotWorkSpace   points to the (NFS) directory where the workspace is located
HotSpotBuildSpace  points to the (PC-local) directory where the vm is built
HotSpotReleaseBinDest points to the (NFS or PC-local) directory where the product DLL is
		      written
HotSpotDebugBinDest   points to the (NFS or PC-local) directory where the debug DLL is
		      written

NOTE: For both batch and IDE builds, java and javac must be in your
PATH, and the versions found by default must work. (If this turns out
to be a problem, we can define HotSpotJava and HotSpotJavaC for
bootstrapping...)

__Building the JVM from the command line________________________________________

1) choose a directory in which you want to build the vm
   (the build process will create a subdirectory)

2) To build the 'core' version (debug || optimized)
   %HotSpotWorkSpace%\build\windows\build <flavor> core %HotSpotWorkSpace% <jdk_dir>
   To build the 'compiler2' version (debug || optimized)
   %HotSpotWorkSpace%\build\windows\build <flavor> compiler2 %HotSpotWorkSpace% <jdk_dir>

   where <jdk_dir> is a full path to a JDK in which bin/java and
   bin/javac are present and working.

3) If you have problems with building, first try:
   vcvars32 <CR> (sets path for VC++)

4) In addition to jvm.dll, the Serviceability Agent (SA) based JDI connector 
   and command line tools are built if dbgeng.h and dbgeng.lib
   can be located, and BUILD_WIN_SA=1 is specified.   We look for dbgeng.h here:
        $(MSVCDIR)\PlatformSDK\Include
        $(SYSTEMROOT)\..\Program Files\Microsoft SDK\include

  The first directory is part of  Visual Studio VC .NET 2003.
  The second is used on Windows-amd64.


__Building the JVM from within MS Developer Studio______________________________

0) Set environment variables as described above

1) Run the following script:
   %HotSpotWorkSpace%\build\windows\create <type> { <workspace> <buildspace> <productbindest> <debugbindest> }
   where type is one of core, compiler1, compiler2.  If you leave off the
   "<workspace> <buildspace> <productbindest> <debugbindest>" part, the script expects to find their
   values in the HotSpotWorkSpace, HotSpotBuildSpace, HotSpotReleaseBinDest, and HotSpotDebugBinDest environment
   variables.  The resulting vm.vcproj does not depend on these values in the environment.

   This will populate the build space with the appropriate makefiles
   and run nmake in it. This builds and runs makedeps, which now
   generates the appropriate vm.vcproj into the build space. It also
   builds and runs adlc.

   To regenerate the .incl and .dsp files after changing the include
   databases, just run nmake in the build space.

   The build process now relies on java and javac. For the IDE builds,
   the full path to a JDK (in which bin/java and bin/javac are present
   and working) can be specified either explicitly with the
   ALT_BOOTDIR environment variable (like the JDK build process), via
   the JDK build's default BOOTDIR environment variable, via JAVA_HOME,
   or implicitly via the PATH.

   (Note that there are now many more command line options to MakeDeps
   on the Windows platform than before. These have been bundled into
   makefiles/makedeps.make, but it is still necessary to keep this in
   sync with the batch makefiles, in vm/generated.)

   If you have problems with building (i.e,. finding nmake), first try:
   vcvars32 <CR> (sets path for VC++)

2) Double-click the vm.vcproj file in the %HotSpotBuildSpace% directory
   to open MS Developer Studio.

3) build desired or all versions:
   menu Build -> Batch Build... -> Build (or Rebuild All)

4) jvm.dll is in the %HotSpotReleaseBinDest% or %HotSpotDebugBinDest% directory
   depending on which configuration you built (release or debug).

Note: do not edit any of the files (especially the vm.vcproj file) in the
build space, since they are all either autogenerated or copied from
the work space. If necessary, modify the original Makefiles in
%HotSpotWorkSpace%\build\windows\projectfiles, or the shared
makedeps arguments in
%HotSpotWorkSpace%\build\windows\makefiles\makedeps.make.

Note that it appears that some options set in the IDE (for example,
the default executable) show up not in the .dsp file, but in the .opt
file, so the automatic regeneration of the .dsp file should not
destroy the project settings. However, makedeps.make should be edited
to supply per-file compiler options.

To build adlc from within the IDE for debugging purposes:

1) in MS Developer Studio, open ADLCompiler.dsw:
   menu File -> Open Workspace...
   select & double-click ADLCompiler.dsw

2) rebuild all (debug mode is enough)
   menu Build -> Rebuild All (make sure Win32 Debug version is selected)


__Testing the VM________________________________________________________________

To test the VM using the Tonga Testsuite, use testlook. testlook is a very
simple testing framework on top of Tonga which allows us to use one (Tonga)
test file, that can be extended with attributes.

1) copy %HotSpotWorkSpace%\test\testlook.bat onto PC (preferably
   %HotSpotBuildSpace%\bin, which should ideally be in the path)

2) run testlook <cr> or testlook help <cr> for details

3) to run testlook you need to have Tonga mounted:
   net use T: \\tapas\export1\psqe


__HotJava under HotSpot_________________________________________________________

To run HotJava, use the .bat file %HotSpotWorkSpace%\test\h.bat. Copy
it into %HotSpotBuildSpace%/<flavor> (which ideally is in the path) and run
HotJava: h java <flags> (e.g., h java_g -Xint).


__Preferred directory setup under Windows NT____________________________________

Within the HotSpot group we are using the following directory setup:

D:\jdk1.2          - where we install the JDK

The following drives are mounted for testing/putbacks/etc.:

net use T: \\tapas\export1\psqe
net use Y: \\rschmidt\GammaBase
net use Z: \\animorphic\animorphic
