Skip to main content

JDK6 Build Cheat Sheet

Posted by kellyohair on December 15, 2006 at 11:04 AM PST


JDK6 Build Cheat Sheet

Just thought I'd list a few ways that the JDK can be built.
These apply to JDK6 and JDK7, JDK5 building is a little different
but has some of the same settings.
The gnumake used here is the GNU make 3.78.1 or newer.

  • On Solaris systems with the Companion CD installed, it can
    usually be found
    with the name gmake in /usr/sfw/bin/ or
    /opt/sfw/bin/.
  • On Linux just use make from /usr/bin/
  • On Windows and using CYGWIN, just use make from CYGWIN's
    /usr/bin/
    (but make sure it's not 3.81, which seems to have taken away the ability
    to use paths with the ':' character, like C:/anything.)
  • On Windows with MKS, you will need a GNU make built for MKS.

See

the JDK build instructions for more information.



NOTE: Any variables described below that start with
ALT_ can be set on the gnumake
command line, or be set in your environment. None of the Makefiles
should be setting these variables internally, so no internal
make variable setting should change your environment variable
setting of them. The command line variable settings will override
any setting inside the Makefiles.

Control Builds

From the control/make/Makefile:

  • Build everything for a developer:

    gnumake dev

    OR

    gnumake DEV_ONLY=true
  • Skip the fastdebug build (just builds the product bits):

    gnumake SKIP_FASTDEBUG_BUILD=true DEV_ONLY=true
  • Don't build the fastdebug bits, and skip the hotspot and deploy areas:

    gnumake BUILD_HOTSPOT=false BUILD_DEPLOY=false ALT_JDK_IMPORT=/jdk1.6.0 SKIP_FASTDEBUG_BUILD=true DEV_ONLY=true
  • Build just the j2se debug image:

    gnumake BUILD_HOTSPOT=false BUILD_DEPLOY=false ALT_JDK_IMPORT=/jdk1.6.0 SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=false DEV_ONLY=true debug_build

Here is a short list of the make variables that can be set on the
gnumake command line:

  • BUILD_HOTSPOT

    Set to false to avoid building the hotspot VM, but you will
    need to also set ALT_JDK_IMPORT_PATH to a built jdk
    product of the same version you are building.
    I recommend setting this to false
    all the time, unless you are changing the hotspot VM.

  • BUILD_DEPLOY

    Set to false to avoid building javaws or the plugins.
    I recommend setting this to false all the time.

  • BUILD_INSTALL

    Set to false to avoid building install bundles
    (you should never need to do this).
    I recommend setting this to false all the time.

  • BUILD_J2SE

    Set to false to avoid the core j2se, which is unlikely
    you'd want to do this. I'd leave this one alone, unless you are
    only working on the hotspot VM.

  • BUILD_MOTIF

    Set to false to avoid building the Motif libraries,
    but you would need to then set
    ALT_MOTIF_DIR to where to get the built Motif libraries.
    This doesn't take long to build so I have never played with this,
    and I'm not even sure it's necessary

  • NO_DOCS

    Set to true to avoid any javadoc generation.

  • NO_IMAGES

    Set to true to avoid any images generation.
    This means the creation of the more formal JDK install-like image
    with the rt.jar and tools.jar files.
    When the images are not built, the JDK is left in the
    OUTPUTDIR area as a simple set of bin,
    lib, include, and classes
    directories. Which can be run as-is, but do not represent the
    form that a JDK install image will take.
    The creation of the images is mostly a disk movement activity, and
    on some machines this is very fast, and with others it can be slow.

  • SKIP_FASTDEBUG_BUILD

    Set to true to skip building any fastdebug bits
    (a set of -g -O built images with full runtime assert checking enabled).

  • SKIP_DEBUG_BUILD

    Set to false to build the debug images (-g with full
    runtime assert checking).

  • DEV_ONLY

    Set to true to get the settings:
    SKIP_COMPARE_IMAGES=true BUILD_INSTALL=false NO_DOCS=true.

  • SKIP_COMPARE_IMAGES

    Set to true to avoid a comparison of previous release
    build bundles with the ones you have created.
    You normally won't want this, so always set this to true.

  • ALT_OUTPUTDIR

    Alternative output directory rather than
    control/build.
    I recommend that the sources and this output directory be on your
    build machines local disk, for best build time performance.

  • ALT_BOOTDIR

    Alternative location for a bootstrap JDK, or install image of the
    previously released JDK (e.g. jdk1.5.0 for building jdk1.6.0).
    You really should set this all the time, just to make sure you get a
    local disk copy, for best build time performance.
    In theory, this doesn't have to be jak1.5.0, but could be a
    newer JDK, even the same version being built. But normally
    it's the previously release JDK.

  • ALT_JDK_IMPORT_PATH

    Alternative location for a JDK build of the same release as what
    you are building.
    If you skip building some components, the Makefiles will try and
    copy over the pre-built bits from this location, e.g.
    if you use BUILD_HOTSPOT=false (or don't have a hotspot
    directory), then the hotspot built images will be copied from this
    location.

Also try running gnumake help for more help
on building options.

J2SE Builds

If you only want to work with the j2se and not the VM, you might
consider just going into the j2se/make directory
and running gnumake from there.
Just run gnumake help for some help.

I'd recommend setting ALT_BOOTDIR and
ALT_JDK_IMPORT_DIR (as described above).

Hotspot Builds

If you only want to work with the hotspot and not the VM, you might
consider just going into the hotspot/make directory
and running gnumake from there.
Just run gnumake help for some help.

I'd recommend setting ALT_BOOTDIR and
ALT_JDK_IMPORT_DIR (as described above).

Traditionally the hotspot build procedure have differed greatly
from the rest of the JDK. This is mostly
due to the fact that for the most part, it's more like building
a large C++ library rather than anything else.
Building each of the platforms was slightly different,
for example on Windows the tool NMAKE.EXE
was used instead of gnumake.
It's the Makefiles and build scripts in the hotspot/build
directory that contain the "real" hotspot build procedures.
In JDK6 a gnumake Makefile was added at
hotspot/make/Makefile which will use the Makefiles
in the hotspot/build area, providing you a more
generic hotspot building experience.
More experienced hotspot builders may prefer to dive into
the hotspot/build area.

Summary

So as you can see, some similarities, some differences between
these build rules.

Hope this was helpful, if you have more questions please post comments.

-kto


Related Topics >>