Defs.gmk 20.9 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6
# 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
7
# published by the Free Software Foundation.  Oracle designates this
D
duke 已提交
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
D
duke 已提交
10 11 12 13 14 15 16 17 18 19 20
#
# 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.
#
21 22 23
# 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.
D
duke 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#

#
# Definitions for all platforms.
#
# Normally the convention is that these alternate definitions of
#   primary make variables are never defined inside the Makefiles anywhere
#   but are defined via environment variables or set on the make command
#   line. So you should never see an ALT_* variable defined in any
#   makefiles, just used. This is the convention and there are some
#   exceptions, either mistakes or unusual circumstances.
#
# The naming convention for the default value of one of these variables
#   that has an ALT_* override capability is to name the default value with a
#   leading underscore (_). So for XXX you would have:
#      _XXX      default value
#      ALT_XXX   any override the user is providing if any
#      XXX       the final value, either the default _XXX or the ALT_XXX value.
#

# On Directory names. In very rare cases should the Windows directory
#    names use the backslash, please use the C:/ style of windows paths.
#    Avoid duplicating the // characters in paths, this has known to cause
#    strange problems with jar and other utilities, e.g. /a//b/ != /a/b/.
#    Some of these variables have an explicit trailing / character, but in
#    general, they should NOT have the trailing / character.

# Get shared system utilities macros defined
include $(JDK_MAKE_SHARED_DIR)/Defs-utils.gmk

# Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, JDK_TOPDIR, etc. have been defined.

# Simple pwd path
define PwdPath
58 59 60 61
$(shell $(CD) $1 2> $(DEV_NULL) && $(PWD))
endef
define AbsPwdPathCheck
$(shell $(CD) .. 2> $(DEV_NULL) && $(CD) $1 2> $(DEV_NULL) && $(PWD))
D
duke 已提交
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
endef

# Checks an ALT value for spaces (should be one word), 
#       warns and returns Check_ALT_$1 if spaces
define AltCheckSpaces
$(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1))
endef

# Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty
define AltCheckValue
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1)
endef

# Checks any value for empty, warns and returns $2 if empty
define CheckValue
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2)
endef

# Prefix for a utility prefix path, if empty leave alone, otherwise end with a /
define PrefixPath
$(if $1,$(subst //,/,$1/),)
endef

# Select a directory if it exists, or the alternate 2 or the alternate 3
define DirExists
$(shell \
  if [ -d "$1" ]; then  \
    echo "$1"; \
  elif [ -d "$2" ]; then \
    echo "$2"; \
  else \
    echo "$3"; \
  fi)
endef

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
define DirExists4
$(shell \
  if [ -d "$1" ]; then  \
    echo "$1"; \
  elif [ -d "$2" ]; then \
    echo "$2"; \
  elif [ -d "$3" ]; then \
    echo "$3"; \
  else \
    echo "$4"; \
  fi)
endef


D
duke 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
# Select a writable directory if it exists and is writable, or the alternate
define WriteDirExists
$(shell \
  if [ -d "$1" -a -w "$1" ]; then  \
    echo "$1"; \
  else \
    echo "$2"; \
  fi)
endef

# Select a file if it exists, or the alternate 1, or the alternate 2
define FileExists
$(shell \
  if [ -r "$1" ]; then \
    echo "$1"; \
  elif [ -r "$2" ]; then \
    echo "$2"; \
  else \
    echo "NO_FILE_EXISTS"; \
  fi)
endef

134
# Given a line of text, get the version number from it
D
duke 已提交
135
define GetVersion
136
$(shell echo $1 | sed -e 's@[^0-9]*\([0-9][0-9]*\.[0-9][.0-9]*\).*@\1@' )
D
duke 已提交
137 138
endef

139 140 141 142 143
# Return one part of the version numbers, watch out for non digits.
define VersionWord # Number Version
$(word $1,$(subst ., ,$(subst -, ,$2)))
endef

D
duke 已提交
144 145
# Given a major.minor.micro version, return the major, minor, or micro number
define MajorVersion
146
$(if $(call VersionWord,1,$1),$(call VersionWord,1,$1),0)
D
duke 已提交
147 148
endef
define MinorVersion
149
$(if $(call VersionWord,2,$1),$(call VersionWord,2,$1),0)
D
duke 已提交
150 151
endef
define MicroVersion
152
$(if $(call VersionWord,3,$1),$(call VersionWord,3,$1),0)
D
duke 已提交
153 154 155 156 157 158 159
endef

# Macro that returns missing, same, newer, or older $1=version $2=required
define CheckVersions
$(shell \
  if [ "$1" = "" -o "$2" = "" ]; then \
    echo missing; \
160 161 162 163 164 165 166 167 168 169 170 171 172 173
  elif [ "$1" = "$2" ]; then \
    echo same; \
  elif [ $(call MajorVersion,$1) -lt $(call MajorVersion,$2) ] ; then \
    echo older; \
  elif [ $(call MajorVersion,$1) -gt $(call MajorVersion,$2) ] ; then \
    echo newer; \
  elif [ $(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \
    echo older; \
  elif [ $(call MinorVersion,$1) -gt $(call MinorVersion,$2) ]; then \
    echo newer; \
  elif [ $(call MicroVersion,$1) -lt $(call MicroVersion,$2) ]; then \
    echo older; \
  elif [ $(call MicroVersion,$1) -gt $(call MicroVersion,$2) ]; then \
    echo newer; \
D
duke 已提交
174
  else \
175
    echo same; \
D
duke 已提交
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
  fi)
endef

# Make sure certain variables are non-empty at this point
_check_values:=\
$(call CheckValue,ARCH,),\
$(call CheckValue,ARCH_DATA_MODEL,),\
$(call CheckValue,ARCH_VM_SUBDIR,),\
$(call CheckValue,JDK_TOPDIR,),\
$(call CheckValue,JDK_MAKE_SHARED_DIR,),\
$(call CheckValue,VARIANT,),\
$(call CheckValue,PLATFORM,)

# Misc common settings for all workspaces
#   This determines the version of the product, and the previous version or boot
ifndef JDK_MAJOR_VERSION
  JDK_MAJOR_VERSION      = 1
  PREVIOUS_MAJOR_VERSION = 1
endif

ifndef JDK_MINOR_VERSION
  JDK_MINOR_VERSION      = 7
  PREVIOUS_MINOR_VERSION = 6
endif

ifndef JDK_MICRO_VERSION
  JDK_MICRO_VERSION      = 0
  PREVIOUS_MICRO_VERSION = 0
endif

ifndef MILESTONE
  MILESTONE = internal
endif

# Default names
ifdef OPENJDK
  LAUNCHER_NAME = openjdk
  PRODUCT_NAME = OpenJDK
  PRODUCT_SUFFIX = Runtime Environment
215 216 217 218 219 220 221
  JDK_RC_PLATFORM_NAME = Platform
  COMPANY_NAME = N/A
else
  LAUNCHER_NAME = java
  PRODUCT_NAME = Java(TM)
  PRODUCT_SUFFIX = SE Runtime Environment
  JDK_RC_PLATFORM_NAME = Platform SE
222
  COMPANY_NAME = Oracle Corporation
D
duke 已提交
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
endif

RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)

ifndef BUILD_NUMBER
  JDK_BUILD_NUMBER = b00
else
  ifndef JDK_BUILD_NUMBER
    JDK_BUILD_NUMBER = $(BUILD_NUMBER)
  endif
endif

# Default variant is the optimized version of everything
#    can be OPT or DBG,  default is OPT
#    Determine the extra pattern to add to the release name for debug/fastdebug.
#    Determine the JDK_IMPORT_VARIANT, so we get the right VM files copied over.
#    Determine suffix for obj directory or OBJDIR, for .o files.
#    (by keeping .o files separate, just .o files, they don't clobber each
#     other, however, the library files will clobber each other).
#
ifeq ($(VARIANT), DBG)
  BUILD_VARIANT_RELEASE=-debug
  OBJDIRNAME_SUFFIX=_g
else
  BUILD_VARIANT_RELEASE=
  OBJDIRNAME_SUFFIX=
endif
ifeq ($(FASTDEBUG), true)
  VARIANT=DBG
  BUILD_VARIANT_RELEASE=-fastdebug
  OBJDIRNAME_SUFFIX=_gO
  _JDK_IMPORT_VARIANT=/fastdebug
endif

# Depending on the flavor of the build, add a -debug or -fastdebug to the name
ifdef DEBUG_NAME
  BUILD_VARIANT_RELEASE=-$(DEBUG_NAME)
endif

# These default values are redefined during a release build.
#    CTE can set JDK_UPDATE_VERSION during the update release
ifdef JDK_UPDATE_VERSION
  JDK_VERSION  = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)_$(JDK_UPDATE_VERSION)
  MARKETING_NUMBER := $(shell \
	$(ECHO) $(JDK_UPDATE_VERSION) | $(NAWK) '{if (substr($$0,1,1)=="0") print substr($$0, 2); else print $$0;}')
  MARKET_NAME= $(shell $(ECHO) " Update $(MARKETING_NUMBER)")
  JDK_MKTG_VERSION  = $(JDK_MINOR_VERSION)u$(MARKETING_NUMBER)
else
  JDK_VERSION  = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
  JDK_MKTG_VERSION  = $(JDK_MINOR_VERSION)
  MARKET_NAME=
endif
JDK_UNDERSCORE_VERSION =  $(subst .,_,$(JDK_VERSION))
JDK_MKTG_UNDERSCORE_VERSION =  $(subst .,_,$(JDK_MKTG_VERSION))

# RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
ifneq ($(MILESTONE),fcs)
  RELEASE      = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
else
  RELEASE      = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
endif

# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
ifdef BUILD_NUMBER
  FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
else
  BUILD_NUMBER = b00
290 291 292
  BUILD_DATE := $(shell $(DATE) '+%Y_%m_%d_%H_%M')
  CLEAN_USERNAME := $(shell $(ECHO) "$(USER)" | $(TR) -d -c '[:alnum:]')
  USER_RELEASE_SUFFIX := $(shell $(ECHO) "$(CLEAN_USERNAME)_$(BUILD_DATE)" | $(TR) '[:upper:]' '[:lower:]' )
D
duke 已提交
293 294 295 296 297 298 299
  FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
endif

# Promoted build location
PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted
PROMOTED_BUILD_LATEST = latest
PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST)
300
PROMOTED_BUILD_DISTDIR = $(PROMOTED_BUILD_BASEDIR)/dist/$(PLATFORM)-$(ARCH)
D
duke 已提交
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries

# PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel.
#  If the user sets ALT_PARALLEL_COMPILE_JOBS, then COMPILE_APPROACH is set
#  to parallel.
#
#  Recommended setting: 2 seems to be ideal for single cpu machines,
#                       2 times the number of CPU's is a basic formula, 
#                       but probably not more than 4 if the machine is 
#                       being shared by others, or the machine is limited 
#                       in RAM or swap.
#
ifdef ALT_PARALLEL_COMPILE_JOBS
  PARALLEL_COMPILE_JOBS=$(ALT_PARALLEL_COMPILE_JOBS)
else
  PARALLEL_COMPILE_JOBS=2
endif

# Previous JDK release (version of BOOTDIR version)
ifdef ALT_PREVIOUS_JDK_VERSION
  PREVIOUS_JDK_VERSION = $(ALT_PREVIOUS_JDK_VERSION)
else
  PREVIOUS_JDK_VERSION  = $(PREVIOUS_MAJOR_VERSION).$(PREVIOUS_MINOR_VERSION).$(PREVIOUS_MICRO_VERSION)
endif
export PREVIOUS_JDK_VERSION
PREVIOUS_JDK_VERSION:=$(call AltCheckSpaces,PREVIOUS_JDK_VERSION)
PREVIOUS_JDK_VERSION:=$(call AltCheckValue,PREVIOUS_JDK_VERSION)

# Version with _ instead of . in number
ifeq ($(PREVIOUS_MINOR_VERSION),5)
  PREVIOUS_JDK_UNDERSCORE_VERSION =  $(subst .,_,$(PREVIOUS_JDK_VERSION))
else
  PREVIOUS_JDK_UNDERSCORE_VERSION = $(PREVIOUS_MINOR_VERSION)
endif

# Include any private definitions for this set of workspaces
_PRIVATE_DEFS_FILE=$(JDK_MAKE_SHARED_DIR)/PrivateDefs.gmk
USING_PRIVATE_DEFS:=$(shell if [ -f $(_PRIVATE_DEFS_FILE) ]; then echo true; else echo false; fi)
ifeq ($(USING_PRIVATE_DEFS),true)
dummy:=$(warning "WARNING: Using definitions from $(_PRIVATE_DEFS_FILE)")
include $(_PRIVATE_DEFS_FILE)
endif

344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
# OUTPUTDIR: Location of all output for the build
ifdef ALT_OUTPUTDIR
  OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
  # Assumes this is absolute (checks later)
  ABS_OUTPUTDIR:=$(OUTPUTDIR)
else
  ifndef _OUTPUTDIR
    # Default:  Get "build" parent directory, which should always exist
    ifndef BUILD_PARENT_DIRECTORY
      BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
    endif
    ifdef OPENJDK
      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
    else
      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
    endif
    _OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
  endif
  OUTPUTDIR:=$(_OUTPUTDIR)
endif
# Check for spaces and null value
OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)

D
duke 已提交
368
# Get platform specific settings
369 370
# NB: OUTPUTDIR must be defined. Otherwise hotspot import detection will not work correctly
# On other hand this must be included early as it provides platform specific defines such as FullPath
D
duke 已提交
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
include $(JDK_MAKE_SHARED_DIR)/Defs-$(PLATFORM).gmk

# Components
ifdef ALT_LANGTOOLS_DIST
  LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST))
else
  LANGTOOLS_DIST =
endif
ifdef ALT_CORBA_DIST
  CORBA_DIST :=$(call FullPath,$(ALT_CORBA_DIST))
else
  CORBA_DIST =
endif
ifdef ALT_JAXP_DIST
  JAXP_DIST :=$(call FullPath,$(ALT_JAXP_DIST))
else
  JAXP_DIST =
endif
ifdef ALT_JAXWS_DIST
  JAXWS_DIST :=$(call FullPath,$(ALT_JAXWS_DIST))
else
  JAXWS_DIST =
endif

# HOTSPOT_DOCS_IMPORT_PATH: Path to hotspot docs files to import into the docs generation
ifdef ALT_HOTSPOT_DOCS_IMPORT_PATH
  HOTSPOT_DOCS_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_DOCS_IMPORT_PATH))
else
  HOTSPOT_DOCS_IMPORT_PATH :=$(call DirExists,$(HOTSPOT_IMPORT_PATH)/docs,$(PROMOTED_BUILD_BASEDIR)/docs,/NO_DOCS_DIR)
endif

# These are the same on all platforms but require the above platform include 1st

# BOOTDIR: Bootstrap JDK, previous released JDK.
#   _BOOTDIR1 and _BOOTDIR2 picked by platform
406
#   Platform may optionally define _BOOTDIR3 as well.
D
duke 已提交
407 408 409
ifdef ALT_BOOTDIR
  BOOTDIR =$(ALT_BOOTDIR)
else
410 411 412 413 414
  ifdef _BOOTDIR3
    BOOTDIR  :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR)
  else
    BOOTDIR  :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
  endif
D
duke 已提交
415 416 417 418 419
endif
export BOOTDIR
BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)
BOOTDIR:=$(call AltCheckValue,BOOTDIR)

420 421
# PREVIOUS_FCS_RE_AREA: re path to where previous release binaries/bundles are
PREVIOUS_FCS_RE_AREA = $(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs
D
duke 已提交
422 423 424

# PREVIOUS_RELEASE_IMAGE: Previous install image to compare against
ifdef ALT_PREVIOUS_RELEASE_IMAGE
425 426
  
  # Explicit image provided, no bundle access needed
D
duke 已提交
427
  PREVIOUS_RELEASE_IMAGE :=$(call FullPath,$(ALT_PREVIOUS_RELEASE_IMAGE))
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483

else
  
  # PREVIOUS_RELEASE_PATH: path to where previous release bundles are
  ifdef ALT_PREVIOUS_RELEASE_PATH
    PREVIOUS_RELEASE_PATH :=$(call OptFullPath,$(ALT_PREVIOUS_RELEASE_PATH))
  else
    PREVIOUS_RELEASE_PATH := \
	$(call DirExists,$(PREVIOUS_FCS_RE_AREA)/bundles/$(PLATFORM)-$(ARCH),,)
  endif

  # Depending on if we have access to these bundles
  ifeq ($(PREVIOUS_RELEASE_PATH),)
    # Use images in re area or BOOTDIR (which is normally the previous release)
    PREVIOUS_RELEASE_IMAGE := \
         $(call DirExists,$(PREVIOUS_FCS_RE_AREA)/binaries/$(PLATFORM)-$(ARCH),$(BOOTDIR),)
  else
    # Get names of and paths to bundles
    PREVIOUS_RELEASE_PATH:=$(call AltCheckSpaces,PREVIOUS_RELEASE_PATH)
    PREVIOUS_RELEASE_PATH:=$(call AltCheckValue,PREVIOUS_RELEASE_PATH)
    export PREVIOUS_RELEASE_PATH
  
    # PREVIOUS_JDK_FILE: filename of install bundle for previous JDK
    ifdef ALT_PREVIOUS_JDK_FILE
      PREVIOUS_JDK_FILE  =$(ALT_PREVIOUS_JDK_FILE)
    else
      PREVIOUS_JDK_FILE = \
	  jdk-$(PREVIOUS_JDK_UNDERSCORE_VERSION)-$(PLATFORM)-$(ARCH)$(BUNDLE_FILE_SUFFIX)
    endif
    export PREVIOUS_JDK_FILE
    PREVIOUS_JDK_FILE:=$(call AltCheckSpaces,PREVIOUS_JDK_FILE)
    PREVIOUS_JDK_FILE:=$(call AltCheckValue,PREVIOUS_JDK_FILE)

    # PREVIOUS_JRE_FILE: filename of install bundle for previous JRE
    ifdef ALT_PREVIOUS_JRE_FILE
      PREVIOUS_JRE_FILE  =$(ALT_PREVIOUS_JRE_FILE)
    else
      PREVIOUS_JRE_FILE = \
	  jre-$(PREVIOUS_JDK_UNDERSCORE_VERSION)-$(PLATFORM)-$(ARCH)$(BUNDLE_FILE_SUFFIX)
    endif
    export PREVIOUS_JRE_FILE
    PREVIOUS_JRE_FILE:=$(call AltCheckSpaces,PREVIOUS_JRE_FILE)
    PREVIOUS_JRE_FILE:=$(call AltCheckValue,PREVIOUS_JRE_FILE)
   
    # Paths to these bundles
    PREVIOUS_JRE_BUNDLE = $(PREVIOUS_RELEASE_PATH)/$(PREVIOUS_JRE_FILE)
    PREVIOUS_JDK_BUNDLE = $(PREVIOUS_RELEASE_PATH)/$(PREVIOUS_JDK_FILE)
  endif

endif

# Indicate we are using an image comparison
ifneq ($(PREVIOUS_RELEASE_IMAGE),)
    PREVIOUS_RELEASE_PATH = USING-PREVIOUS_RELEASE_IMAGE
    PREVIOUS_JRE_BUNDLE   = USING-PREVIOUS_RELEASE_IMAGE
    PREVIOUS_JDK_BUNDLE   = USING-PREVIOUS_RELEASE_IMAGE
D
duke 已提交
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
endif

# CACERTS_FILE: if OPENJDK is false and the internal version of the file 
#		(that is, non-empty) is available, use it, otherwise use an 
#		empty keystore.
#
# We put this variable here for sanity checks and in case another
# components will need to know which cacerts file is being used.
#
ifdef ALT_CACERTS_FILE
  CACERTS_FILE = $(ALT_CACERTS_FILE)
else
  CACERTS_EXT   = $(SHARE_SRC)/lib/security/cacerts
  ifdef OPENJDK
    CACERTS_FILE  :=$(CACERTS_EXT)
  else # (!OPENJDK)
    CACERTS_INT   = $(CLOSED_SHARE_SRC)/lib/security/cacerts.internal
    CACERTS_FILE  :=$(call FileExists,$(CACERTS_INT),$(CACERTS_EXT))
  endif # (OPENJDK)
endif
CACERTS_FILE:=$(call AltCheckSpaces,CACERTS_FILE)
CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE)

507 508 509 510 511 512
#
# When signing the JCE framework and provider, we could be using built
# bits on a read-only filesystem.  If so, this test will fail and crash
# the build.
#
ifndef IGNORE_WRITABLE_OUTPUTDIR_TEST
513 514 515 516 517
# Create the output directory and make sure it exists and is writable
_create_outputdir:=$(shell $(MKDIR) -p "$(OUTPUTDIR)" > $(DEV_NULL) 2>&1)
ifeq ($(call WriteDirExists,$(OUTPUTDIR),/dev/null),/dev/null)
  _outputdir_error:=$(error "ERROR: OUTPUTDIR '$(OUTPUTDIR)' not created or not writable")
endif
518 519
endif

520 521
# Define absolute path if needed and check for spaces and null value
ifndef ABS_OUTPUTDIR
522 523 524 525 526 527 528
  ifdef _OUTPUTDIRNAME
    #Could not define this at the same time as _OUTPUTDIRNAME as FullPath is not defined at that point
    ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
    ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
  else
    ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
  endif
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
endif
ABS_OUTPUTDIR:=$(call AltCheckSpaces,ABS_OUTPUTDIR)
ABS_OUTPUTDIR:=$(call AltCheckValue,ABS_OUTPUTDIR)
# Make doubly sure this is a full path
ifeq ($(call AbsPwdPathCheck,$(ABS_OUTPUTDIR)), )
  ifdef ALT_OUTPUTDIR
    _outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)', was ALT_OUTPUTDIR '$(ALT_OUTPUTDIR)' an absolute path?")
  else
    _outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)'")
  endif
endif
_dir1:=$(call FullPath,$(ABS_OUTPUTDIR))
_dir2:=$(call FullPath,$(OUTPUTDIR))
ifneq ($(_dir1),$(_dir2))
  _outputdir_error:=$(error "ERROR: ABS_OUTPUTDIR '$(ABS_OUTPUTDIR)' is not the same directory as OUTPUTDIR '$(OUTPUTDIR)', '$(_dir1)'!='$(_dir2)'")
endif
D
duke 已提交
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563

# Bin directory
#   NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64
BINDIR      = $(OUTPUTDIR)/bin$(ISA_DIR)
  
# MOZILLA_HEADERS_PATH: path to mozilla header files for plugin
ifdef ALT_MOZILLA_HEADERS_PATH
  MOZILLA_HEADERS_PATH :=$(call FullPath,$(ALT_MOZILLA_HEADERS_PATH))
else
  MOZILLA_HEADERS_PATH  =$(JDK_DEVTOOLS_DIR)/share/plugin
endif
MOZILLA_HEADERS_PATH:=$(call AltCheckSpaces,MOZILLA_HEADERS_PATH)
MOZILLA_HEADERS_PATH:=$(call AltCheckValue,MOZILLA_HEADERS_PATH)

# CUPS_HEADERS_PATH: path to Cups headers files for Unix printing
ifneq ($(PLATFORM), windows)
JDK_CUPS_HEADERS_PATH=$(JDK_DEVTOOLS_DIR)/share/cups/include
  ifdef ALT_CUPS_HEADERS_PATH
     CUPS_HEADERS_PATH:=$(call FullPath,$(ALT_CUPS_HEADERS_PATH))
P
peterz 已提交
564
     CUPS_HEADERS_PATH:=$(call AltCheckValue,CUPS_HEADERS_PATH)
D
duke 已提交
565 566 567 568 569 570 571 572 573 574
  else 
    CUPS_HEADERS_PATH:= \
      $(shell if [ -d "$(JDK_CUPS_HEADERS_PATH)" ]; then \
        echo "$(JDK_CUPS_HEADERS_PATH)"; \
      else \
         echo "$(_CUPS_HEADERS_PATH)";\
      fi)
  endif
endif

575 576 577 578 579
# Utilities ant
ifeq ($(PLATFORM), windows)
  ifeq ($(ANT_HOME),)
    ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,)
  endif
580
endif
581 582 583 584 585 586 587 588 589 590 591 592 593

# There are few problems with ant we need to workaround:
#  1) ant is using temporary directory java.io.tmpdir
#     However, this directory is not unique enough and two separate ant processes
#     can easily end up using the exact same temp directory. This may lead to weird build failures
#     To workaround this we will define tmp dir explicitly
#  2) ant attempts to detect JDK location based on java.exe location
#     This is fragile as developer may have JRE first on the PATH. 
#     To workaround this we will specify JAVA_HOME explicitly

ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp
ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)'

594
ifeq ($(ANT_HOME),)
595
  ANT = $(ANT_WORKAROUNDS) ant
596
else
597
  ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant
598 599
endif

D
duke 已提交
600 601 602 603 604 605
ifdef ALT_COPYRIGHT_YEAR
  COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
else
  COPYRIGHT_YEAR = $(shell $(DATE) '+%Y')
endif

606 607 608 609 610 611 612 613 614
# Windows uses Microsoft compilers by default
ifeq ($(PLATFORM), windows)
  override CC_VERSION = msvc
endif

# Solaris uses Sun Studio compilers by default
ifeq ($(PLATFORM), solaris)
  override CC_VERSION = sun
endif
D
duke 已提交
615

616 617 618 619 620 621
# Linux uses GNU compilers by default
ifeq ($(PLATFORM), linux)
  override CC_VERSION = gcc
endif

# Get the REQUIRED versions (needs CC_VERSION set)
622 623
include $(JDK_MAKE_SHARED_DIR)/Defs-versions.gmk

624 625 626
# Get the compiler specific settings
include $(JDK_MAKE_SHARED_DIR)/Compiler-$(CC_VERSION).gmk