duke@1: # ohair@158: # Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. duke@1: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: # duke@1: # This code is free software; you can redistribute it and/or modify it duke@1: # under the terms of the GNU General Public License version 2 only, as ohair@158: # published by the Free Software Foundation. Oracle designates this duke@1: # particular file as subject to the "Classpath" exception as provided ohair@158: # by Oracle in the LICENSE file that accompanied this code. duke@1: # duke@1: # This code is distributed in the hope that it will be useful, but WITHOUT duke@1: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: # version 2 for more details (a copy is included in the LICENSE file that duke@1: # accompanied this code). duke@1: # duke@1: # You should have received a copy of the GNU General Public License version duke@1: # 2 along with this work; if not, write to the Free Software Foundation, duke@1: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: # ohair@158: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@158: # or visit www.oracle.com if you need additional information or have any ohair@158: # questions. duke@1: # duke@1: duke@1: # duke@1: # Defnitions for all platforms. duke@1: # duke@1: # Normally the convention is that these alternate definitions of duke@1: # primary make variables are never defined inside the Makefiles anywhere duke@1: # but are defined via environment variables or set on the make command duke@1: # line. So you should never see an ALT_* variable defined in any duke@1: # makefiles, just used. This is the convention and there are some duke@1: # exceptions, either mistakes or unusual circumstances. duke@1: # duke@1: # The naming convention for the default value of one of these variables duke@1: # that has an ALT_* override capability is to name the default value with a duke@1: # leading underscore (_). So for XXX you would have: duke@1: # _XXX default value duke@1: # ALT_XXX any override the user is providing if any duke@1: # XXX the final value, either the default _XXX or the ALT_XXX value. duke@1: # duke@1: duke@1: # On Directory names. In very rare cases should the Windows directory duke@1: # names use the backslash, please use the C:/ style of windows paths. duke@1: # Avoid duplicating the // characters in paths, this has known to cause duke@1: # strange problems with jar and other utilities, e.g. /a//b/ != /a/b/. duke@1: # Some of these variables have an explicit trailing / character, but in duke@1: # general, they should NOT have the trailing / character. duke@1: duke@1: # Get shared system utilities macros defined duke@1: include $(BUILDDIR)/common/shared/Defs-utils.gmk duke@1: duke@1: # Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, etc. have been defined. duke@1: duke@1: # Simple pwd path duke@1: define PwdPath duke@1: $(shell cd $1 2> $(DEV_NULL) && pwd) duke@1: endef duke@1: duke@1: # Checks an ALT value for spaces (should be one word), duke@1: # warns and returns Check_ALT_$1 if spaces duke@1: define AltCheckSpaces duke@1: $(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1)) duke@1: endef duke@1: duke@1: # Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty duke@1: define AltCheckValue duke@1: $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1) duke@1: endef duke@1: duke@1: # Checks any value for empty, warns and returns $2 if empty duke@1: define CheckValue duke@1: $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2) duke@1: endef duke@1: duke@1: # Prefix for a utility prefix path, if empty leave alone, otherwise end with a / duke@1: define PrefixPath duke@1: $(if $1,$(subst //,/,$1/),) duke@1: endef duke@1: duke@1: # Select a directory if it exists, or the alternate 2 or the alternate 3 duke@1: define DirExists duke@1: $(shell \ duke@1: if [ -d "$1" ]; then \ duke@1: echo "$1"; \ duke@1: elif [ -d "$2" ]; then \ duke@1: echo "$2"; \ duke@1: else \ duke@1: echo "$3"; \ duke@1: fi) duke@1: endef duke@1: duke@1: # Select a writable directory if it exists and is writable, or the alternate duke@1: define WriteDirExists duke@1: $(shell \ duke@1: if [ -d "$1" -a -w "$1" ]; then \ duke@1: echo "$1"; \ duke@1: else \ duke@1: echo "$2"; \ duke@1: fi) duke@1: endef duke@1: duke@1: # Select a file if it exists, or the alternate 1, or the alternate 2 duke@1: define FileExists duke@1: $(shell \ duke@1: if [ -r "$1" ]; then \ duke@1: echo "$1"; \ duke@1: elif [ -r "$2" ]; then \ duke@1: echo "$2"; \ duke@1: else \ duke@1: echo "NO_FILE_EXISTS"; \ duke@1: fi) duke@1: endef duke@1: duke@1: # Given a line of text, get the major.minor version number from it duke@1: define GetVersion duke@1: $(shell echo $1 | sed -e 's@[^1-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*@\1@' ) duke@1: endef duke@1: duke@1: # Given a major.minor.micro version, return the major, minor, or micro number duke@1: define MajorVersion duke@1: $(if $(word 1, $(subst ., ,$1)),$(word 1, $(subst ., ,$1)),0) duke@1: endef duke@1: define MinorVersion duke@1: $(if $(word 2, $(subst ., ,$1)),$(word 2, $(subst ., ,$1)),0) duke@1: endef duke@1: define MicroVersion duke@1: $(if $(word 3, $(subst ., ,$1)),$(word 3, $(subst ., ,$1)),0) duke@1: endef duke@1: duke@1: # Macro that returns missing, same, newer, or older $1=version $2=required duke@1: # (currently does not check the micro number) duke@1: define CheckVersions duke@1: $(shell \ duke@1: if [ "$1" = "" -o "$2" = "" ]; then \ duke@1: echo missing; \ duke@1: else \ duke@1: if [ "$1" = "$2" ]; then \ duke@1: echo same; \ duke@1: else \ duke@1: if [ $(call MajorVersion,$1) -lt $(call MajorVersion,$2) ] ; then \ duke@1: echo older; \ duke@1: else \ duke@1: if [ $(call MajorVersion,$1) -eq $(call MajorVersion,$2) -a \ duke@1: $(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \ duke@1: echo older; \ duke@1: else \ duke@1: echo newer; \ duke@1: fi; \ duke@1: fi; \ duke@1: fi; \ duke@1: fi) duke@1: endef duke@1: duke@1: # Make sure certain variables are non-empty at this point duke@1: _check_values:=\ duke@1: $(call CheckValue,ARCH,),\ duke@1: $(call CheckValue,ARCH_DATA_MODEL,),\ duke@1: $(call CheckValue,ARCH_VM_SUBDIR,),\ duke@1: $(call CheckValue,VARIANT,),\ duke@1: $(call CheckValue,PLATFORM,) duke@1: duke@1: # Misc common settings for all workspaces duke@1: # This determines the version of the product, and the previous version or boot duke@1: ifndef JDK_MAJOR_VERSION duke@1: JDK_MAJOR_VERSION = 1 duke@1: PREVIOUS_MAJOR_VERSION = 1 duke@1: endif duke@1: duke@1: ifndef JDK_MINOR_VERSION duke@1: JDK_MINOR_VERSION = 7 duke@1: PREVIOUS_MINOR_VERSION = 6 duke@1: endif duke@1: duke@1: ifndef JDK_MICRO_VERSION duke@1: JDK_MICRO_VERSION = 0 duke@1: PREVIOUS_MICRO_VERSION = 0 duke@1: endif duke@1: duke@1: ifndef MILESTONE duke@1: MILESTONE = internal duke@1: endif duke@1: duke@1: ifndef BUILD_NUMBER duke@1: JDK_BUILD_NUMBER = b00 duke@1: else duke@1: ifndef JDK_BUILD_NUMBER duke@1: JDK_BUILD_NUMBER = $(BUILD_NUMBER) duke@1: endif duke@1: endif duke@1: duke@1: # Default variant is the optimized version of everything duke@1: # can be OPT or DBG, default is OPT duke@1: # Determine the extra pattern to add to the release name for debug/fastdebug. duke@1: # Determine the JDK_IMPORT_VARIANT, so we get the right VM files copied over. duke@1: # Determine suffix for obj directory or OBJDIR, for .o files. duke@1: # (by keeping .o files separate, just .o files, they don't clobber each duke@1: # other, however, the library files will clobber each other). duke@1: # duke@1: ifeq ($(VARIANT), DBG) duke@1: BUILD_VARIANT_RELEASE=-debug duke@1: OBJDIRNAME_SUFFIX=_g duke@1: else duke@1: BUILD_VARIANT_RELEASE= duke@1: OBJDIRNAME_SUFFIX= duke@1: endif duke@1: ifeq ($(FASTDEBUG), true) duke@1: VARIANT=DBG duke@1: BUILD_VARIANT_RELEASE=-fastdebug duke@1: OBJDIRNAME_SUFFIX=_gO duke@1: _JDK_IMPORT_VARIANT=/fastdebug duke@1: endif duke@1: duke@1: # Depending on the flavor of the build, add a -debug or -fastdebug to the name duke@1: ifdef DEBUG_NAME duke@1: BUILD_VARIANT_RELEASE=-$(DEBUG_NAME) duke@1: endif duke@1: duke@1: JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION) duke@1: JDK_UNDERSCORE_VERSION = $(subst .,_,$(JDK_VERSION)) duke@1: duke@1: # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set duke@1: ifneq ($(MILESTONE),fcs) duke@1: RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE) duke@1: else duke@1: RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE) duke@1: endif duke@1: duke@1: # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set ohair@114: ifndef FULL_VERSION ohair@114: ifdef BUILD_NUMBER ohair@114: FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER) ohair@114: else ohair@114: BUILD_NUMBER = b00 ohair@114: USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`) ohair@114: FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER) ohair@114: endif ohair@114: export FULL_VERSION duke@1: endif duke@1: duke@1: # Promoted build location duke@1: PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted duke@1: PROMOTED_BUILD_LATEST = latest duke@1: PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST) duke@1: PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries duke@1: duke@1: # OPT: Changes what the optimizations settings (in _OPT) duke@1: POPT = $(_OPT$(ALT_OPT))$(ALT_OPT) duke@1: duke@1: # PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel. duke@1: # If the user sets ALT_PARALLEL_COMPILE_JOBS, then COMPILE_APPROACH is set duke@1: # to parallel. duke@1: # duke@1: # Recommended setting: 2 seems to be ideal for single cpu machines, duke@1: # 2 times the number of CPU's is a basic formula, duke@1: # but probably not more than 4 if the machine is duke@1: # being shared by others, or the machine is limited duke@1: # in RAM or swap. duke@1: # duke@1: ifdef ALT_PARALLEL_COMPILE_JOBS duke@1: PARALLEL_COMPILE_JOBS=$(ALT_PARALLEL_COMPILE_JOBS) duke@1: else duke@1: PARALLEL_COMPILE_JOBS=2 duke@1: endif duke@1: duke@1: # Previous JDK release (version of BOOTDIR version) duke@1: ifdef ALT_PREVIOUS_JDK_VERSION duke@1: PREVIOUS_JDK_VERSION = $(ALT_PREVIOUS_JDK_VERSION) duke@1: else duke@1: PREVIOUS_JDK_VERSION = $(PREVIOUS_MAJOR_VERSION).$(PREVIOUS_MINOR_VERSION).$(PREVIOUS_MICRO_VERSION) duke@1: endif duke@1: export PREVIOUS_JDK_VERSION duke@1: PREVIOUS_JDK_VERSION:=$(call AltCheckSpaces,PREVIOUS_JDK_VERSION) duke@1: PREVIOUS_JDK_VERSION:=$(call AltCheckValue,PREVIOUS_JDK_VERSION) duke@1: duke@1: # Version with _ instead of . in number duke@1: ifeq ($(PREVIOUS_MINOR_VERSION),5) duke@1: PREVIOUS_JDK_UNDERSCORE_VERSION = $(subst .,_,$(PREVIOUS_JDK_VERSION)) duke@1: else duke@1: PREVIOUS_JDK_UNDERSCORE_VERSION = $(PREVIOUS_MINOR_VERSION) duke@1: endif duke@1: duke@1: # Get platform specific settings duke@1: include $(BUILDDIR)/common/shared/Defs-$(PLATFORM).gmk duke@1: ohair@4: # Components ohair@4: ifdef ALT_LANGTOOLS_DIST ohair@4: LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST)) ohair@4: else ohair@4: LANGTOOLS_DIST = ohair@4: endif ohair@4: duke@1: # These are the same on all platforms but require the above platform include 1st duke@1: duke@1: # BOOTDIR: Bootstrap JDK, previous released JDK. duke@1: # _BOOTDIR1 and _BOOTDIR2 picked by platform duke@1: ifdef ALT_BOOTDIR duke@1: BOOTDIR =$(ALT_BOOTDIR) duke@1: else duke@1: BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR) duke@1: endif duke@1: export BOOTDIR duke@1: BOOTDIR:=$(call AltCheckSpaces,BOOTDIR) duke@1: BOOTDIR:=$(call AltCheckValue,BOOTDIR) duke@1: duke@1: # OUTPUTDIR: Location of all output for the build duke@1: _BACKUP_OUTPUTDIR = $(TEMP_DISK)/$(USER)/jdk-outputdir duke@1: ifdef ALT_OUTPUTDIR duke@1: _POSSIBLE_OUTPUTDIR =$(subst \,/,$(ALT_OUTPUTDIR)) duke@1: else duke@1: ifndef _OUTPUTDIR duke@1: _OUTPUTDIR = $(_BACKUP_OUTPUTDIR) duke@1: endif duke@1: _POSSIBLE_OUTPUTDIR =$(_OUTPUTDIR) duke@1: endif duke@1: _create_outputdir1:=$(shell mkdir -p $(_POSSIBLE_OUTPUTDIR) > $(DEV_NULL) 2>&1) duke@1: OUTPUTDIR:=$(call WriteDirExists,$(_POSSIBLE_OUTPUTDIR),$(_BACKUP_OUTPUTDIR)) duke@1: _create_outputdir2:=$(shell mkdir -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1) duke@1: ifeq "$(OUTPUTDIR)" "$(_BACKUP_OUTPUTDIR)" duke@1: _outputdir_warning:=$(warning "WARNING: OUTPUTDIR '$(_POSSIBLE_OUTPUTDIR)' not writable, will use '$(_BACKUP_OUTPUTDIR)'") duke@1: endif duke@1: OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR) duke@1: OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR) duke@1: duke@1: # Bin directory duke@1: # NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64 duke@1: BINDIR = $(OUTPUTDIR)/bin$(ISA_DIR) duke@1: duke@1: # Absolute path to output directory duke@1: ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR)) duke@1: duke@1: # Get shared compiler settings duke@1: include $(BUILDDIR)/common/shared/Compiler.gmk duke@1: