duke@2: # duke@2: # Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. duke@2: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@2: # duke@2: # This code is free software; you can redistribute it and/or modify it duke@2: # under the terms of the GNU General Public License version 2 only, as duke@2: # published by the Free Software Foundation. Sun designates this duke@2: # particular file as subject to the "Classpath" exception as provided duke@2: # by Sun in the LICENSE file that accompanied this code. duke@2: # duke@2: # This code is distributed in the hope that it will be useful, but WITHOUT duke@2: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@2: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@2: # version 2 for more details (a copy is included in the LICENSE file that duke@2: # accompanied this code). duke@2: # duke@2: # You should have received a copy of the GNU General Public License version duke@2: # 2 along with this work; if not, write to the Free Software Foundation, duke@2: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@2: # duke@2: # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@2: # CA 95054 USA or visit www.sun.com if you need additional information or duke@2: # have any questions. duke@2: # duke@2: duke@2: ifndef TOPDIR duke@2: TOPDIR:=$(shell \ duke@2: if [ -r ./j2se/make/Makefile -o -r ./jdk/make/Makefile ]; then \ duke@2: echo "."; \ duke@2: else \ duke@2: echo "../.."; \ duke@2: fi) duke@2: endif duke@2: duke@2: ifndef CONTROL_TOPDIR duke@2: CONTROL_TOPDIR=$(TOPDIR)/control duke@2: CONTROL_TOPDIR:=$(shell \ duke@2: if [ -r $(TOPDIR)/control/make/Makefile ]; then \ duke@2: echo "$(TOPDIR)/control"; \ duke@2: else \ duke@2: echo "$(TOPDIR)"; \ duke@2: fi) duke@2: endif duke@2: duke@2: ifndef JDK_TOPDIR duke@2: JDK_TOPDIR=$(TOPDIR)/jdk duke@2: endif duke@2: ifndef JDK_MAKE_SHARED_DIR duke@2: JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared duke@2: endif duke@2: duke@2: include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk duke@2: duke@2: include ./make/Defs-internal.gmk duke@2: duke@2: all:: duke@2: @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: duke@2: # Rules for sanity checks duke@2: include ./make/sanity-rules.gmk duke@2: duke@2: dev : dev-build duke@2: duke@2: dev-build: duke@2: $(MAKE) DEV_ONLY=true all duke@2: dev-sanity: duke@2: $(MAKE) DEV_ONLY=true sanity duke@2: dev-clobber: duke@2: $(MAKE) DEV_ONLY=true clobber duke@2: duke@2: # Rules for various components duke@2: include ./make/hotspot-rules.gmk duke@2: include ./make/langtools-rules.gmk duke@2: include ./make/corba-rules.gmk duke@2: include ./make/jaxp-rules.gmk duke@2: include ./make/jaxws-rules.gmk duke@2: include ./make/jdk-rules.gmk duke@2: include ./make/install-rules.gmk duke@2: include ./make/sponsors-rules.gmk duke@2: include ./make/deploy-rules.gmk duke@2: duke@2: all:: setup build duke@2: duke@2: setup: duke@2: $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image duke@2: $(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image duke@2: $(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image duke@2: $(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image duke@2: duke@2: build:: sanity duke@2: duke@2: clobber:: duke@2: duke@2: ifeq ($(BUILD_LANGTOOLS), true) duke@2: build:: langtools duke@2: clobber:: langtools-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_CORBA), true) duke@2: build:: corba duke@2: clobber:: corba-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_JAXP), true) duke@2: build:: jaxp duke@2: clobber:: jaxp-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_JAXWS), true) duke@2: build:: jaxws duke@2: clobber:: jaxws-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_HOTSPOT), true) duke@2: build:: $(HOTSPOT) duke@2: clobber:: hotspot-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_JDK), true) duke@2: build:: $(JDK_JAVA_EXE) duke@2: clobber:: jdk-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_DEPLOY), true) duke@2: build:: $(DEPLOY) duke@2: clobber:: deploy-clobber duke@2: endif duke@2: duke@2: # duke@2: # Generic debug build, fastdebug or debug. Needs special handling. duke@2: # Note that debug builds do NOT do INSTALL steps, but must be done duke@2: # after the product build and before the INSTALL step of the product build. duke@2: # duke@2: # DEBUG_NAME is fastdebug or debug duke@2: # ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix duke@2: # The resulting j2sdk-image is used by the install makefiles to create a duke@2: # debug install bundle jdk-*-debug-** bundle (tar or zip) duke@2: # which will install in the debug or fastdebug subdirectory of the duke@2: # normal product install area. duke@2: # The install process needs to know what the DEBUG_NAME is, so duke@2: # look for INSTALL_DEBUG_NAME in the install rules. duke@2: # duke@2: duke@2: COMMON_DEBUG_FLAGS= \ duke@2: DEBUG_NAME=$(DEBUG_NAME) \ duke@2: ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \ duke@2: NO_DOCS=true duke@2: duke@2: product_build: setup duke@2: @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: $(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all duke@2: @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: duke@2: generic_debug_build: duke@2: @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: $(MAKE) $(COMMON_DEBUG_FLAGS) setup build duke@2: @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: duke@2: debug_build: setup duke@2: $(MAKE) DEBUG_NAME=debug generic_debug_build duke@2: duke@2: fastdebug_build: setup duke@2: $(MAKE) DEBUG_NAME=fastdebug generic_debug_build duke@2: duke@2: ifeq ($(SKIP_FASTDEBUG_BUILD), false) duke@2: all:: fastdebug_build duke@2: endif duke@2: duke@2: ifeq ($(SKIP_DEBUG_BUILD), false) duke@2: all:: debug_build duke@2: endif duke@2: duke@2: ifeq ($(BUILD_JDK), true) duke@2: ifeq ($(BUNDLE_RULES_AVAILABLE), true) duke@2: all:: openjdk-binary-plugs-bundles duke@2: endif duke@2: endif duke@2: duke@2: ifeq ($(BUILD_INSTALL), true) duke@2: all :: $(INSTALL) duke@2: clobber:: install-clobber duke@2: endif duke@2: duke@2: ifeq ($(BUILD_SPONSORS), true) duke@2: all :: $(SPONSORS) duke@2: clobber:: sponsors-clobber duke@2: endif duke@2: duke@2: ifneq ($(SKIP_COMPARE_IMAGES), true) duke@2: all :: compare-image duke@2: endif duke@2: duke@2: ifeq ($(SKIP_OPENJDK_BUILD), false) duke@2: ifeq ($(BUILD_JDK), true) duke@2: ifeq ($(BUNDLE_RULES_AVAILABLE), true) duke@2: # If we have bundle rules, we have a chance here to do a complete cycle duke@2: # build, of closed and open build. duke@2: # FIXUP: We should create the openjdk source bundle and build that? duke@2: ABS_OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) duke@2: ABS_OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/openjdk duke@2: OPENJDK_BUILD_NAME_PREFIX \ duke@2: = $(J2SDK_NAME)-$(JDK_MKTG_UNDERSCORE_VERSION)-$(MILESTONE) duke@2: OPENJDK_BUILD_NAME_SUFFIX \ duke@2: = $(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE) duke@2: OPENJDK_BUILD_NAME \ duke@2: = $(OPENJDK_BUILD_NAME_PREFIX)-openjdk-$(OPENJDK_BUILD_NAME_SUFFIX) duke@2: OPENJDK_BUILD_BINARY_ZIP \ duke@2: = $(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip duke@2: all :: openjdk-build duke@2: openjdk-build: duke@2: @$(ECHO) " " duke@2: @$(ECHO) "=================================================" duke@2: @$(ECHO) "Starting openjdk build" duke@2: @$(ECHO) "=================================================" duke@2: @$(ECHO) " " duke@2: $(RM) -r $(ABS_OPENJDK_OUTPUTDIR) duke@2: $(MKDIR) -p $(ABS_OPENJDK_OUTPUTDIR) duke@2: $(MAKE) OPENJDK=true \ duke@2: BUILD_LANGTOOLS=$(BUILD_LANGTOOLS) \ duke@2: BUILD_CORBA=$(BUILD_CORBA) \ duke@2: BUILD_JAXP=$(BUILD_JAXP) \ duke@2: BUILD_JAXWS=$(BUILD_JAXWS) \ duke@2: BUILD_HOTSPOT=$(BUILD_HOTSPOT) \ duke@2: ALT_OUTPUTDIR=$(ABS_OPENJDK_OUTPUTDIR) \ duke@2: ALT_BINARY_PLUGS_PATH=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) \ duke@2: ALT_BOOTDIR=$(ABS_OUTPUTDIR)/j2sdk-image \ duke@2: ALT_JDK_IMPORT_PATH=$(ABS_OUTPUTDIR)/j2sdk-image \ duke@2: product_build duke@2: $(RM) $(OPENJDK_BUILD_BINARY_ZIP) duke@2: ( $(CD) $(ABS_OPENJDK_OUTPUTDIR)/j2sdk-image && \ duke@2: $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .) duke@2: $(RM) -r $(ABS_OPENJDK_OUTPUTDIR) duke@2: endif duke@2: endif duke@2: endif duke@2: duke@2: clobber:: duke@2: $(RM) -r $(OUTPUTDIR)/* duke@2: $(RM) -r $(OUTPUTDIR)-debug/* duke@2: $(RM) -r $(OUTPUTDIR)-fastdebug/* duke@2: -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) duke@2: duke@2: clean: clobber duke@2: duke@2: all:: duke@2: @$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'` duke@2: duke@2: # duke@2: # Quick jdk verification build duke@2: # duke@2: jdk_only: duke@2: $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all duke@2: duke@2: duke@2: # duke@2: # Quick jdk verification fastdebug build duke@2: # duke@2: jdk_fastdebug_only: duke@2: $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ duke@2: BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build duke@2: duke@2: # duke@2: # Quick deploy verification fastdebug build duke@2: # duke@2: deploy_fastdebug_only: duke@2: $(MAKE) \ duke@2: DEBUG_NAME=fastdebug \ duke@2: BUILD_HOTSPOT=false \ duke@2: BUILD_JDK=false \ duke@2: BUILD_LANGTOOLS=false \ duke@2: BUILD_CORBA=false \ duke@2: BUILD_JAXP=false \ duke@2: BUILD_JAXWS=false \ duke@2: BUILD_INSTALL=false \ duke@2: BUILD_SPONSORS=false \ duke@2: generic_debug_build duke@2: duke@2: # duke@2: # Product build (skip debug builds) duke@2: # duke@2: product_only: duke@2: $(MAKE) SKIP_FASTDEBUG_BUILD=true all duke@2: duke@2: # duke@2: # Check target duke@2: # duke@2: duke@2: check: variable_check duke@2: duke@2: # duke@2: # Help target duke@2: # duke@2: help: intro_help target_help variable_help notes_help examples_help duke@2: duke@2: # Intro help message duke@2: intro_help: duke@2: @$(ECHO) "\ duke@2: Makefile for the JDK builds (all the JDK). \n\ duke@2: " duke@2: duke@2: # Target help duke@2: target_help: duke@2: @$(ECHO) "\ duke@2: --- Common Targets --- \n\ duke@2: all -- build the core JDK (default target) \n\ duke@2: help -- Print out help information \n\ duke@2: check -- Check make variable values for correctness \n\ duke@2: sanity -- Perform detailed sanity checks on system and settings \n\ duke@2: fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ duke@2: debug_build -- build the core JDK in 'debug' mode (-g) \n\ duke@2: clean -- remove all built and imported files \n\ duke@2: clobber -- same as clean \n\ duke@2: " duke@2: duke@2: # Variable help (only common ones used by this Makefile) duke@2: variable_help: variable_help_intro variable_list variable_help_end duke@2: variable_help_intro: duke@2: @$(ECHO) "--- Common Variables ---" duke@2: variable_help_end: duke@2: @$(ECHO) " " duke@2: duke@2: # One line descriptions for the variables duke@2: OUTPUTDIR.desc = Output directory duke@2: PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count duke@2: SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: duke@2: BOOTDIR.desc = JDK used to boot the build duke@2: JDK_IMPORT_PATH.desc = JDK used to import components of the build duke@2: COMPILER_PATH.desc = Compiler install directory duke@2: CACERTS_FILE.desc = Location of certificates file duke@2: DEVTOOLS_PATH.desc = Directory containing zip and gnumake duke@2: CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files duke@2: DXSDK_PATH.desc = Root directory of DirectX SDK duke@2: MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe) duke@2: MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll duke@2: duke@2: # Make variables to print out (description and value) duke@2: VARIABLE_PRINTVAL_LIST += \ duke@2: OUTPUTDIR \ duke@2: PARALLEL_COMPILE_JOBS \ duke@2: SLASH_JAVA \ duke@2: BOOTDIR \ duke@2: JDK_IMPORT_PATH \ duke@2: COMPILER_PATH \ duke@2: CACERTS_FILE \ duke@2: DEVTOOLS_PATH duke@2: duke@2: # Make variables that should refer to directories that exist duke@2: VARIABLE_CHECKDIR_LIST += \ duke@2: SLASH_JAVA \ duke@2: BOOTDIR \ duke@2: JDK_IMPORT_PATH \ duke@2: COMPILER_PATH \ duke@2: DEVTOOLS_PATH duke@2: duke@2: # Make variables that should refer to files that exist duke@2: VARIABLE_CHECKFIL_LIST += \ duke@2: CACERTS_FILE duke@2: duke@2: # Some are windows specific duke@2: ifeq ($(PLATFORM), windows) duke@2: duke@2: VARIABLE_PRINTVAL_LIST += \ duke@2: DXSDK_PATH \ duke@2: MSDEVTOOLS_PATH \ duke@2: MSVCRT_DLL_PATH duke@2: duke@2: VARIABLE_CHECKDIR_LIST += \ duke@2: DXSDK_PATH \ duke@2: MSDEVTOOLS_PATH \ duke@2: MSVCRT_DLL_PATH duke@2: duke@2: endif duke@2: duke@2: # For pattern rules below, so all are treated the same duke@2: DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) duke@2: DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) duke@2: DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) duke@2: duke@2: # Complete variable check duke@2: variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) duke@2: variable_list: $(DO_PRINTVAL_LIST) variable_check duke@2: duke@2: # Pattern rule for printing out a variable duke@2: %.printval: duke@2: @$(ECHO) " ALT_$* - $($*.desc)" duke@2: @$(ECHO) " \t $*=$($*)" duke@2: duke@2: # Pattern rule for checking to see if a variable with a directory exists duke@2: %.checkdir: duke@2: @if [ ! -d $($*) ] ; then \ duke@2: $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ duke@2: fi duke@2: duke@2: # Pattern rule for checking to see if a variable with a file exists duke@2: %.checkfil: duke@2: @if [ ! -f $($*) ] ; then \ duke@2: $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ duke@2: fi duke@2: duke@2: # Misc notes on help duke@2: notes_help: duke@2: @$(ECHO) "\ duke@2: --- Notes --- \n\ duke@2: - All builds use same output directory unless overridden with \n\ duke@2: \t ALT_OUTPUTDIR=, changing from product to fastdebug you may want \n\ duke@2: \t to use the clean target first. \n\ duke@2: - JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ duke@2: \t builds or previous release JDK builds will work. \n\ duke@2: - The fastest builds have been when the sources and the BOOTDIR are on \n\ duke@2: \t local disk. \n\ duke@2: " duke@2: duke@2: examples_help: duke@2: @$(ECHO) "\ duke@2: --- Examples --- \n\ duke@2: $(MAKE) fastdebug_build \n\ duke@2: $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ duke@2: $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ duke@2: $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ duke@2: $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ duke@2: $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ duke@2: " duke@2: duke@2: ################################################################ duke@2: # Source and binary plug bundling duke@2: ################################################################ duke@2: ifeq ($(BUNDLE_RULES_AVAILABLE), true) duke@2: include $(BUNDLE_RULES) duke@2: endif duke@2: duke@2: ################################################################ duke@2: # Cycle build. Build the jdk, use it to build the jdk again. duke@2: ################################################################ duke@2: duke@2: ABS_BOOTJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk duke@2: duke@2: boot_cycle: duke@2: $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTJDK_OUTPUTDIR) product_build duke@2: $(MAKE) ALT_BOOTDIR=$(ABS_BOOTJDK_OUTPUTDIR)/j2sdk-image product_build duke@2: duke@2: ################################################################ duke@2: # JPRT rule to build duke@2: ################################################################ duke@2: duke@2: include ./make/jprt.gmk duke@2: duke@2: ################################################################ duke@2: # PHONY duke@2: ################################################################ duke@2: duke@2: .PHONY: all build what clobber insane \ duke@2: fastdebug_build debug_build product_build setup \ duke@2: dev dev-build dev-sanity dev-clobber duke@2: duke@2: # FIXUP: Old j2se targets duke@2: j2se_fastdebug_only: jdk_fastdebug_only duke@2: j2se_only: jdk_only duke@2: