view control/make/Makefile @ 7:807dfe9c366c trunk

[svn] Load openjdk/jdk7/b19 into jdk/trunk.
author xiomara
date Fri, 31 Aug 2007 00:44:13 +0000
parents 5937f8212f93
children 37f131a4a8e7
line wrap: on
line source

#
# Copyright 1995-2007 Sun Microsystems, Inc.  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.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

TOPDIR=../..
include ./common/Defs.gmk

all::
	@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`

# Rules for SCM (Source Code Management)
include ./common/Defs-scm.gmk

# Rules for sanity checks
include ./sanity-rules.gmk

# Rules for various components
include ./control-rules.gmk
include ./hotspot-rules.gmk
include ./motif-rules.gmk
include ./j2se-rules.gmk
include ./install-rules.gmk
include ./sponsors-rules.gmk
include ./deploy-rules.gmk

all:: setup build

setup:
	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
	$(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image
	$(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image
	$(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image

build:: sanity 

clobber::

ifeq ($(BUILD_HOTSPOT), true)
  build:: $(HOTSPOT) 
  clobber:: hotspot-clobber
endif

ifeq ($(BUILD_MOTIF), true)
  build:: $(MOTIF)
  clobber:: motif-clobber
endif

ifeq ($(BUILD_J2SE), true)
  build:: $(J2SE)
  clobber:: j2se-clobber
endif

ifeq ($(BUILD_DEPLOY), true)
  build:: $(DEPLOY)
  clobber:: deploy-clobber
endif

#
# Generic debug build, fastdebug or debug. Needs special handling.
#  Note that debug builds do NOT do INSTALL steps, but must be done
#  after the product build and before the INSTALL step of the product build.
#
#   DEBUG_NAME is fastdebug or debug
#   ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
#   The resulting j2sdk-image is used by the install makefiles to create a
#     debug install bundle jdk-*-debug-** bundle (tar or zip) 
#     which will install in the debug or fastdebug subdirectory of the
#     normal product install area.
#     The install process needs to know what the DEBUG_NAME is, so
#     look for INSTALL_DEBUG_NAME in the install rules.
#

COMMON_DEBUG_FLAGS= \
	DEBUG_NAME=$(DEBUG_NAME) \
	ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \
	NO_DOCS=true

product_build: setup
	@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
	$(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all
	@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`

generic_debug_build:
	@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
	$(MAKE) $(COMMON_DEBUG_FLAGS) setup build
	@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`

debug_build: setup
	$(MAKE) DEBUG_NAME=debug generic_debug_build

fastdebug_build: setup
	$(MAKE) DEBUG_NAME=fastdebug generic_debug_build

ifeq ($(SKIP_FASTDEBUG_BUILD), false)
  all:: fastdebug_build
endif

ifeq ($(SKIP_DEBUG_BUILD), false)
  all:: debug_build
endif

ifeq ($(BUILD_J2SE), true)
  ifeq ($(BUNDLE_RULES_AVAILABLE), true)
    all:: openjdk-binary-plugs-bundles
  endif
endif

ifeq ($(BUILD_INSTALL), true)
  all :: $(INSTALL)
  clobber:: install-clobber
endif

ifeq ($(BUILD_SPONSORS), true)
  all :: $(SPONSORS)
  clobber:: sponsors-clobber
endif

ifneq ($(SKIP_COMPARE_IMAGES), true)
  all :: compare-images
endif

clobber:: clean-check
	$(RM) -r $(OUTPUTDIR)/*
	$(RM) -r $(OUTPUTDIR)-debug/*
	$(RM) -r $(OUTPUTDIR)-fastdebug/*
	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))

clean: clobber

freshen: control-freshen hotspot-freshen motif-freshen j2se-freshen \
	 install-freshen deploy-freshen sponsors-freshen

all:: 
	@$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'`

#
# Quick j2se verification build
#
j2se_only:
	$(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all


#
# Quick j2se verification fastdebug build
#
j2se_fastdebug_only:
	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build

#
# Quick deploy verification fastdebug build
#
deploy_fastdebug_only:
	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_J2SE=false \
	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build

#
# Product build (skip debug builds)
#
product_only:
	$(MAKE) SKIP_FASTDEBUG_BUILD=true all

#
# Check target
#

check: variable_check

#
# Help target
#
help: intro_help target_help variable_help notes_help examples_help

# Intro help message
intro_help:
	@$(ECHO) "\
Makefile for the JDK control builds (all the JDK). \n\
"

# Target help
target_help:
	@$(ECHO) "\
--- Common Targets ---  \n\
all               -- build the core JDK (default target) \n\
help              -- Print out help information \n\
check             -- Check make variable values for correctness \n\
sanity            -- Perform detailed sanity checks on system and settings \n\
fastdebug_build   -- build the core JDK in 'fastdebug' mode (-g -O) \n\
debug_build       -- build the core JDK in 'debug' mode (-g) \n\
clean             -- remove all built and imported files \n\
clobber           -- same as clean \n\
"

# Variable help (only common ones used by this Makefile)
variable_help: variable_help_intro variable_list variable_help_end
variable_help_intro:
	@$(ECHO) "--- Common Variables ---"
variable_help_end:
	@$(ECHO) " "

# One line descriptions for the variables
OUTPUTDIR.desc             = Output directory
PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
SLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
BOOTDIR.desc               = JDK used to boot the build
JDK_IMPORT_PATH.desc       = JDK used to import components of the build
COMPILER_PATH.desc         = Compiler install directory
CACERTS_FILE.desc          = Location of certificates file
DEVTOOLS_PATH.desc         = Directory containing zip and gnumake
MOTIF_DIR.desc             = Root directory for motif directories
CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
DXSDK_PATH.desc            = Root directory of DirectX SDK
MSDEVTOOLS_PATH.desc       = Root directory of VC++ tools (e.g. rc.exe)
MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll
UNICOWS_DLL_PATH.desc      = Directory containing unicows.dll
UNICOWS_LIB_PATH.desc      = Directory containing unicows.lib

# Make variables to print out (description and value)
VARIABLE_PRINTVAL_LIST +=       \
    OUTPUTDIR                   \
    PARALLEL_COMPILE_JOBS       \
    SLASH_JAVA                  \
    BOOTDIR                     \
    JDK_IMPORT_PATH             \
    COMPILER_PATH               \
    CACERTS_FILE                \
    DEVTOOLS_PATH               \
    MOTIF_DIR 

# Make variables that should refer to directories that exist
VARIABLE_CHECKDIR_LIST +=       \
    SLASH_JAVA                  \
    BOOTDIR                     \
    JDK_IMPORT_PATH             \
    COMPILER_PATH               \
    DEVTOOLS_PATH 

# Make variables that should refer to files that exist
VARIABLE_CHECKFIL_LIST +=       \
    CACERTS_FILE

# Some are windows specific
ifeq ($(PLATFORM), windows)

VARIABLE_PRINTVAL_LIST +=       \
    DXSDK_PATH                  \
    MSDEVTOOLS_PATH             \
    MSVCRT_DLL_PATH             \
    UNICOWS_DLL_PATH            \
    UNICOWS_LIB_PATH

VARIABLE_CHECKDIR_LIST +=       \
    DXSDK_PATH                  \
    MSDEVTOOLS_PATH             \
    MSVCRT_DLL_PATH             \
    UNICOWS_DLL_PATH            \
    UNICOWS_LIB_PATH

endif

# For pattern rules below, so all are treated the same
DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)

# Complete variable check
variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
variable_list: $(DO_PRINTVAL_LIST) variable_check

# Pattern rule for printing out a variable
%.printval:
	@$(ECHO) "  ALT_$* - $($*.desc)"
	@$(ECHO) "  \t $*=$($*)"

# Pattern rule for checking to see if a variable with a directory exists
%.checkdir:
	@if [ ! -d $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Pattern rule for checking to see if a variable with a file exists
%.checkfil:
	@if [ ! -f $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Misc notes on help
notes_help:
	@$(ECHO) "\
--- Notes --- \n\
- All builds use same output directory unless overridden with \n\
 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
 \t to use the clean target first. \n\
- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
 \t builds or previous release JDK builds will work. \n\
- The fastest builds have been when the sources and the BOOTDIR are on \n\
 \t local disk. \n\
"

examples_help:
	@$(ECHO) "\
--- Examples --- \n\
  $(MAKE) fastdebug_build \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
  $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
"

################################################################
# Source and binary plug bundling
################################################################
ifeq ($(BUNDLE_RULES_AVAILABLE), true)
  
  include $(BUNDLE_RULES)

# If we have bundle rules, we have a chance here to do a complete cycle
#   build, of closed and open build.
# FIXUP: We should create the openjdk source bundle and build that?
  
  ABS_OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/openjdk-plugs
  ABS_OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/openjdk
  
  both:
	$(MAKE) PLUG_EXPORT_DIR=$(ABS_OPENJDK_PLUGS) product_build
	$(MAKE) OPENJDK=true \
		ALT_OUTPUTDIR=$(ABS_OPENJDK_OUTPUTDIR) \
		ALT_BINARY_PLUGS_PATH=$(ABS_OPENJDK_PLUGS) \
		ALT_JDK_IMPORT_PATH=$(ABS_OUTPUTDIR)/j2sdk-image \
		product_build

endif

################################################################
# Cycle build. Build the jdk, use it to build the jdk again.
################################################################
  
ABS_BOOTJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
  
boot_cycle:
	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTJDK_OUTPUTDIR) product_build
	$(MAKE) ALT_BOOTDIR=$(ABS_BOOTJDK_OUTPUTDIR)/j2sdk-image product_build

################################################################
# JPRT rule to build
################################################################

include jprt.gmk

################################################################
#  Teamware commands (can be removed someday)
################################################################

bringover: freshen
control-bringover: control-freshen
hotspot-bringover: hotspot-freshen
motif-bringover: motif-freshen
j2se-bringover: j2se-freshen
install-bringover: install-freshen
deploy-bringover: deploy-freshen
sponsors-bringover: sponsors-freshen

.PHONY: bringover control-bringover hotspot-bringover motif-bringover \
        j2se-bringover install-bringover deploy-bringover sponsors-bringover

################################################################
#  PHONY
################################################################

.PHONY: all build what clobber insane freshen \
	fastdebug_build debug_build product_build setup