1 # 2 # Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # 27 # Definitions for all platforms. 28 # 29 # Normally the convention is that these alternate definitions of 30 # primary make variables are never defined inside the Makefiles anywhere 31 # but are defined via environment variables or set on the make command 32 # line. So you should never see an ALT_* variable defined in any 33 # makefiles, just used. This is the convention and there are some 34 # exceptions, either mistakes or unusual circumstances. 35 # 36 # The naming convention for the default value of one of these variables 37 # that has an ALT_* override capability is to name the default value with a 38 # leading underscore (_). So for XXX you would have: 39 # _XXX default value 40 # ALT_XXX any override the user is providing if any 41 # XXX the final value, either the default _XXX or the ALT_XXX value. 42 # 43 44 # On Directory names. In very rare cases should the Windows directory 45 # names use the backslash, please use the C:/ style of windows paths. 46 # Avoid duplicating the // characters in paths, this has known to cause 47 # strange problems with jar and other utilities, e.g. /a//b/ != /a/b/. 48 # Some of these variables have an explicit trailing / character, but in 49 # general, they should NOT have the trailing / character. 50 51 # Get shared system utilities macros defined 52 include $(JDK_MAKE_SHARED_DIR)/Defs-utils.gmk 53 54 # Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, JDK_TOPDIR, etc. have been defined. 55 56 # Simple pwd path 57 # NOTE: Just use the shell's cd and pwd here, more reliable at sanity time. 58 define PwdPath 59 $(shell cd $1 2> $(DEV_NULL) && pwd) 60 endef 61 define AbsPwdPathCheck 62 $(shell cd .. 2> $(DEV_NULL) && cd $1 2> $(DEV_NULL) && pwd) 63 endef 64 65 # Checks an ALT value for spaces (should be one word), 66 # warns and returns Check_ALT_$1 if spaces 67 define AltCheckSpaces 68 $(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1)) 69 endef 70 71 # Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty 72 define AltCheckValue 73 $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1) 74 endef 75 76 # Checks any value for empty, warns and returns $2 if empty 77 define CheckValue 78 $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2) 79 endef 80 81 # Prefix for a utility prefix path, if empty leave alone, otherwise end with a / 82 define PrefixPath 83 $(if $1,$(subst //,/,$1/),) 84 endef 85 86 # Select a directory if it exists, or the alternate 2 or the alternate 3 87 define DirExists 88 $(shell \ 89 if [ -d "$1" ]; then \ 90 echo "$1"; \ 91 elif [ -d "$2" ]; then \ 92 echo "$2"; \ 93 else \ 94 echo "$3"; \ 95 fi) 96 endef 97 98 # Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4 99 define DirExists4 100 $(shell \ 101 if [ -d "$1" ]; then \ 102 echo "$1"; \ 103 elif [ -d "$2" ]; then \ 104 echo "$2"; \ 105 elif [ -d "$3" ]; then \ 106 echo "$3"; \ 107 else \ 108 echo "$4"; \ 109 fi) 110 endef 111 112 113 # Select a writable directory if it exists and is writable, or the alternate 114 define WriteDirExists 115 $(shell \ 116 if [ -d "$1" -a -w "$1" ]; then \ 117 echo "$1"; \ 118 else \ 119 echo "$2"; \ 120 fi) 121 endef 122 123 # Select a file if it exists, or the alternate 1, or the alternate 2 124 define FileExists 125 $(shell \ 126 if [ -r "$1" ]; then \ 127 echo "$1"; \ 128 elif [ -r "$2" ]; then \ 129 echo "$2"; \ 130 else \ 131 echo "NO_FILE_EXISTS"; \ 132 fi) 133 endef 134 135 # Given a line of text, get the version number from it 136 define GetVersion 137 $(shell echo $1 | sed -e 's@[^0-9]*\([0-9][0-9]*\.[0-9][.0-9]*\).*@\1@' ) 138 endef 139 140 # Return one part of the version numbers, watch out for non digits. 141 define VersionWord # Number Version 142 $(word $1,$(subst ., ,$(subst -, ,$2))) 143 endef 144 145 # Given a major.minor.micro version, return the major, minor, or micro number 146 define MajorVersion 147 $(if $(call VersionWord,1,$1),$(call VersionWord,1,$1),0) 148 endef 149 define MinorVersion 150 $(if $(call VersionWord,2,$1),$(call VersionWord,2,$1),0) 151 endef 152 define MicroVersion 153 $(if $(call VersionWord,3,$1),$(call VersionWord,3,$1),0) 154 endef 155 156 # Macro that returns missing, same, newer, or older $1=version $2=required 157 define CheckVersions 158 $(shell \ 159 if [ "$1" = "" -o "$2" = "" ]; then \ 160 echo missing; \ 161 elif [ "$1" = "$2" ]; then \ 162 echo same; \ 163 elif [ $(call MajorVersion,$1) -lt $(call MajorVersion,$2) ] ; then \ 164 echo older; \ 165 elif [ $(call MajorVersion,$1) -gt $(call MajorVersion,$2) ] ; then \ 166 echo newer; \ 167 elif [ $(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \ 168 echo older; \ 169 elif [ $(call MinorVersion,$1) -gt $(call MinorVersion,$2) ]; then \ 170 echo newer; \ 171 elif [ $(call MicroVersion,$1) -lt $(call MicroVersion,$2) ]; then \ 172 echo older; \ 173 elif [ $(call MicroVersion,$1) -gt $(call MicroVersion,$2) ]; then \ 174 echo newer; \ 175 else \ 176 echo same; \ 177 fi) 178 endef 179 180 # Make sure certain variables are non-empty at this point 181 _check_values:=\ 182 $(call CheckValue,ARCH,),\ 183 $(call CheckValue,ARCH_DATA_MODEL,),\ 184 $(call CheckValue,ARCH_VM_SUBDIR,),\ 185 $(call CheckValue,JDK_TOPDIR,),\ 186 $(call CheckValue,JDK_MAKE_SHARED_DIR,),\ 187 $(call CheckValue,VARIANT,),\ 188 $(call CheckValue,PLATFORM,) 189 190 # Misc common settings for all workspaces 191 # This determines the version of the product, and the previous version or boot 192 ifndef JDK_MAJOR_VERSION 193 JDK_MAJOR_VERSION = 1 194 PREVIOUS_MAJOR_VERSION = 1 195 endif 196 197 ifndef JDK_MINOR_VERSION 198 JDK_MINOR_VERSION = 7 199 PREVIOUS_MINOR_VERSION = 6 200 endif 201 202 ifndef JDK_MICRO_VERSION 203 JDK_MICRO_VERSION = 0 204 PREVIOUS_MICRO_VERSION = 0 205 endif 206 207 ifndef MILESTONE 208 MILESTONE = internal 209 endif 210 211 # Default names 212 ifdef OPENJDK 213 LAUNCHER_NAME = openjdk 214 PRODUCT_NAME = OpenJDK 215 PRODUCT_SUFFIX = Runtime Environment 216 JDK_RC_PLATFORM_NAME = Platform 217 COMPANY_NAME = N/A 218 else 219 LAUNCHER_NAME = java 220 PRODUCT_NAME = Java(TM) 221 PRODUCT_SUFFIX = SE Runtime Environment 222 JDK_RC_PLATFORM_NAME = Platform SE 223 COMPANY_NAME = Oracle Corporation 224 endif 225 226 RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX) 227 228 ifndef BUILD_NUMBER 229 JDK_BUILD_NUMBER = b00 230 else 231 ifndef JDK_BUILD_NUMBER 232 JDK_BUILD_NUMBER = $(BUILD_NUMBER) 233 endif 234 endif 235 236 # Default variant is the optimized version of everything 237 # can be OPT or DBG, default is OPT 238 # Determine the extra pattern to add to the release name for debug/fastdebug. 239 # Determine the JDK_IMPORT_VARIANT, so we get the right VM files copied over. 240 # Determine suffix for obj directory or OBJDIR, for .o files. 241 # (by keeping .o files separate, just .o files, they don't clobber each 242 # other, however, the library files will clobber each other). 243 # 244 ifeq ($(VARIANT), DBG) 245 BUILD_VARIANT_RELEASE=-debug 246 OBJDIRNAME_SUFFIX=_g 247 else 248 BUILD_VARIANT_RELEASE= 249 OBJDIRNAME_SUFFIX= 250 endif 251 ifeq ($(FASTDEBUG), true) 252 VARIANT=DBG 253 BUILD_VARIANT_RELEASE=-fastdebug 254 OBJDIRNAME_SUFFIX=_gO 255 _JDK_IMPORT_VARIANT=/fastdebug 256 endif 257 258 # Depending on the flavor of the build, add a -debug or -fastdebug to the name 259 ifdef DEBUG_NAME 260 BUILD_VARIANT_RELEASE=-$(DEBUG_NAME) 261 endif 262 263 # These default values are redefined during a release build. 264 # CTE can set JDK_UPDATE_VERSION during the update release 265 ifdef JDK_UPDATE_VERSION 266 JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)_$(JDK_UPDATE_VERSION) 267 MARKETING_NUMBER := $(shell \ 268 $(ECHO) $(JDK_UPDATE_VERSION) | $(NAWK) '{if (substr($$0,1,1)=="0") print substr($$0, 2); else print $$0;}') 269 MARKET_NAME= $(shell $(ECHO) " Update $(MARKETING_NUMBER)") 270 JDK_MKTG_VERSION = $(JDK_MINOR_VERSION)u$(MARKETING_NUMBER) 271 else 272 JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION) 273 JDK_MKTG_VERSION = $(JDK_MINOR_VERSION) 274 MARKET_NAME= 275 endif 276 JDK_UNDERSCORE_VERSION = $(subst .,_,$(JDK_VERSION)) 277 JDK_MKTG_UNDERSCORE_VERSION = $(subst .,_,$(JDK_MKTG_VERSION)) 278 279 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set 280 ifneq ($(MILESTONE),fcs) 281 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE) 282 else 283 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE) 284 endif 285 286 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set 287 ifdef BUILD_NUMBER 288 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER) 289 else 290 BUILD_NUMBER = b00 291 ifndef USER_RELEASE_SUFFIX 292 BUILD_DATE := $(shell $(DATE) '+%Y_%m_%d_%H_%M') 293 CLEAN_USERNAME := $(shell $(ECHO) "$(USER)" | $(TR) -d -c '[:alnum:]') 294 USER_RELEASE_SUFFIX := $(shell $(ECHO) "$(CLEAN_USERNAME)_$(BUILD_DATE)" | $(TR) '[:upper:]' '[:lower:]' ) 295 endif 296 export USER_RELEASE_SUFFIX 297 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER) 298 endif 299 300 # Promoted build location 301 PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted 302 PROMOTED_BUILD_LATEST = latest 303 PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST) 304 PROMOTED_BUILD_DISTDIR = $(PROMOTED_BUILD_BASEDIR)/dist/$(PLATFORM)-$(ARCH) 305 PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries 306 307 # PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel. 308 # If the user sets ALT_PARALLEL_COMPILE_JOBS, then COMPILE_APPROACH is set 309 # to parallel. 310 # 311 # Recommended setting: 2 seems to be ideal for single cpu machines, 312 # 2 times the number of CPU's is a basic formula, 313 # but probably not more than 4 if the machine is 314 # being shared by others, or the machine is limited 315 # in RAM or swap. 316 # 317 ifdef ALT_PARALLEL_COMPILE_JOBS 318 PARALLEL_COMPILE_JOBS=$(ALT_PARALLEL_COMPILE_JOBS) 319 else 320 PARALLEL_COMPILE_JOBS=2 321 endif 322 323 # Previous JDK release (version of BOOTDIR version) 324 ifdef ALT_PREVIOUS_JDK_VERSION 325 PREVIOUS_JDK_VERSION = $(ALT_PREVIOUS_JDK_VERSION) 326 else 327 PREVIOUS_JDK_VERSION = $(PREVIOUS_MAJOR_VERSION).$(PREVIOUS_MINOR_VERSION).$(PREVIOUS_MICRO_VERSION) 328 endif 329 export PREVIOUS_JDK_VERSION 330 PREVIOUS_JDK_VERSION:=$(call AltCheckSpaces,PREVIOUS_JDK_VERSION) 331 PREVIOUS_JDK_VERSION:=$(call AltCheckValue,PREVIOUS_JDK_VERSION) 332 333 # Version with _ instead of . in number 334 ifeq ($(PREVIOUS_MINOR_VERSION),5) 335 PREVIOUS_JDK_UNDERSCORE_VERSION = $(subst .,_,$(PREVIOUS_JDK_VERSION)) 336 else 337 PREVIOUS_JDK_UNDERSCORE_VERSION = $(PREVIOUS_MINOR_VERSION) 338 endif 339 340 # Include any private definitions for this set of workspaces 341 _PRIVATE_DEFS_FILE=$(JDK_MAKE_SHARED_DIR)/PrivateDefs.gmk 342 ifeq ($(USING_PRIVATE_DEFS),) 343 USING_PRIVATE_DEFS:=$(shell if [ -f $(_PRIVATE_DEFS_FILE) ]; then echo true; else echo false; fi) 344 endif 345 ifeq ($(USING_PRIVATE_DEFS),true) 346 dummy:=$(warning "WARNING: Using definitions from $(_PRIVATE_DEFS_FILE)") 347 include $(_PRIVATE_DEFS_FILE) 348 endif 349 350 # OUTPUTDIR: Location of all output for the build 351 ifdef ALT_OUTPUTDIR 352 OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR)) 353 # Assumes this is absolute (checks later) 354 ABS_OUTPUTDIR:=$(OUTPUTDIR) 355 else 356 ifndef _OUTPUTDIR 357 # Default: Get "build" parent directory, which should always exist 358 ifndef BUILD_PARENT_DIRECTORY 359 BUILD_PARENT_DIRECTORY=$(BUILDDIR)/.. 360 endif 361 ifdef OPENJDK 362 _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX) 363 else 364 _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH) 365 endif 366 _OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME) 367 endif 368 OUTPUTDIR:=$(_OUTPUTDIR) 369 endif 370 # Check for spaces and null value 371 OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR) 372 OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR) 373 374 # Get platform specific settings 375 # NB: OUTPUTDIR must be defined. Otherwise hotspot import detection will not work correctly 376 # On other hand this must be included early as it provides platform specific defines such as FullPath 377 include $(JDK_MAKE_SHARED_DIR)/Defs-versions.gmk 378 379 # Get platform specific settings (defines COMPILER_PATH) 380 include $(JDK_MAKE_SHARED_DIR)/Defs-$(PLATFORM).gmk 381 382 # Components 383 ifdef ALT_LANGTOOLS_DIST 384 LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST)) 385 else 386 LANGTOOLS_DIST = 387 endif 388 ifdef ALT_CORBA_DIST 389 CORBA_DIST :=$(call FullPath,$(ALT_CORBA_DIST)) 390 else 391 CORBA_DIST = 392 endif 393 ifdef ALT_JAXP_DIST 394 JAXP_DIST :=$(call FullPath,$(ALT_JAXP_DIST)) 395 else 396 JAXP_DIST = 397 endif 398 ifdef ALT_JAXWS_DIST 399 JAXWS_DIST :=$(call FullPath,$(ALT_JAXWS_DIST)) 400 else 401 JAXWS_DIST = 402 endif 403 404 # HOTSPOT_DOCS_IMPORT_PATH: Path to hotspot docs files to import into the docs generation 405 ifdef ALT_HOTSPOT_DOCS_IMPORT_PATH 406 HOTSPOT_DOCS_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_DOCS_IMPORT_PATH)) 407 else 408 HOTSPOT_DOCS_IMPORT_PATH :=$(call DirExists,$(HOTSPOT_IMPORT_PATH)/docs,$(PROMOTED_BUILD_BASEDIR)/docs,/NO_DOCS_DIR) 409 endif 410 411 # These are the same on all platforms but require the above platform include 1st 412 413 # BOOTDIR: Bootstrap JDK, previous released JDK. 414 # _BOOTDIR1 and _BOOTDIR2 picked by platform 415 # Platform may optionally define _BOOTDIR3 as well. 416 ifdef ALT_BOOTDIR 417 BOOTDIR =$(ALT_BOOTDIR) 418 else 419 ifdef _BOOTDIR3 420 BOOTDIR :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR) 421 else 422 BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR) 423 endif 424 endif 425 export BOOTDIR 426 BOOTDIR:=$(call AltCheckSpaces,BOOTDIR) 427 BOOTDIR:=$(call AltCheckValue,BOOTDIR) 428 429 # PREVIOUS_FCS_RE_AREA: re path to where previous release binaries/bundles are 430 PREVIOUS_FCS_RE_AREA = $(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs 431 432 # PREVIOUS_RELEASE_IMAGE: Previous install image to compare against 433 ifdef ALT_PREVIOUS_RELEASE_IMAGE 434 435 # Explicit image provided, no bundle access needed 436 PREVIOUS_RELEASE_IMAGE :=$(call FullPath,$(ALT_PREVIOUS_RELEASE_IMAGE)) 437 438 else 439 440 # PREVIOUS_RELEASE_PATH: path to where previous release bundles are 441 ifdef ALT_PREVIOUS_RELEASE_PATH 442 PREVIOUS_RELEASE_PATH :=$(call OptFullPath,$(ALT_PREVIOUS_RELEASE_PATH)) 443 else 444 PREVIOUS_RELEASE_PATH := \ 445 $(call DirExists,$(PREVIOUS_FCS_RE_AREA)/bundles/$(PLATFORM)-$(ARCH),,) 446 endif 447 448 # Depending on if we have access to these bundles 449 ifeq ($(PREVIOUS_RELEASE_PATH),) 450 # Use images in re area or BOOTDIR (which is normally the previous release) 451 PREVIOUS_RELEASE_IMAGE := \ 452 $(call DirExists,$(PREVIOUS_FCS_RE_AREA)/binaries/$(PLATFORM)-$(ARCH),$(BOOTDIR),) 453 else 454 # Get names of and paths to bundles 455 PREVIOUS_RELEASE_PATH:=$(call AltCheckSpaces,PREVIOUS_RELEASE_PATH) 456 PREVIOUS_RELEASE_PATH:=$(call AltCheckValue,PREVIOUS_RELEASE_PATH) 457 export PREVIOUS_RELEASE_PATH 458 459 # PREVIOUS_JDK_FILE: filename of install bundle for previous JDK 460 ifdef ALT_PREVIOUS_JDK_FILE 461 PREVIOUS_JDK_FILE =$(ALT_PREVIOUS_JDK_FILE) 462 else 463 PREVIOUS_JDK_FILE = \ 464 jdk-$(PREVIOUS_JDK_UNDERSCORE_VERSION)-$(PLATFORM)-$(ARCH)$(BUNDLE_FILE_SUFFIX) 465 endif 466 export PREVIOUS_JDK_FILE 467 PREVIOUS_JDK_FILE:=$(call AltCheckSpaces,PREVIOUS_JDK_FILE) 468 PREVIOUS_JDK_FILE:=$(call AltCheckValue,PREVIOUS_JDK_FILE) 469 470 # PREVIOUS_JRE_FILE: filename of install bundle for previous JRE 471 ifdef ALT_PREVIOUS_JRE_FILE 472 PREVIOUS_JRE_FILE =$(ALT_PREVIOUS_JRE_FILE) 473 else 474 PREVIOUS_JRE_FILE = \ 475 jre-$(PREVIOUS_JDK_UNDERSCORE_VERSION)-$(PLATFORM)-$(ARCH)$(BUNDLE_FILE_SUFFIX) 476 endif 477 export PREVIOUS_JRE_FILE 478 PREVIOUS_JRE_FILE:=$(call AltCheckSpaces,PREVIOUS_JRE_FILE) 479 PREVIOUS_JRE_FILE:=$(call AltCheckValue,PREVIOUS_JRE_FILE) 480 481 # Paths to these bundles 482 PREVIOUS_JRE_BUNDLE = $(PREVIOUS_RELEASE_PATH)/$(PREVIOUS_JRE_FILE) 483 PREVIOUS_JDK_BUNDLE = $(PREVIOUS_RELEASE_PATH)/$(PREVIOUS_JDK_FILE) 484 endif 485 486 endif 487 488 # Indicate we are using an image comparison 489 ifneq ($(PREVIOUS_RELEASE_IMAGE),) 490 PREVIOUS_RELEASE_PATH = USING-PREVIOUS_RELEASE_IMAGE 491 PREVIOUS_JRE_BUNDLE = USING-PREVIOUS_RELEASE_IMAGE 492 PREVIOUS_JDK_BUNDLE = USING-PREVIOUS_RELEASE_IMAGE 493 endif 494 495 # CACERTS_FILE: if OPENJDK is false and the internal version of the file 496 # (that is, non-empty) is available, use it, otherwise use an 497 # empty keystore. 498 # 499 # We put this variable here for sanity checks and in case another 500 # components will need to know which cacerts file is being used. 501 # 502 ifdef ALT_CACERTS_FILE 503 CACERTS_FILE = $(ALT_CACERTS_FILE) 504 else 505 CACERTS_EXT = $(SHARE_SRC)/lib/security/cacerts 506 ifdef OPENJDK 507 CACERTS_FILE :=$(CACERTS_EXT) 508 else # (!OPENJDK) 509 CACERTS_INT = $(CLOSED_SHARE_SRC)/lib/security/cacerts.internal 510 CACERTS_FILE :=$(call FileExists,$(CACERTS_INT),$(CACERTS_EXT)) 511 endif # (OPENJDK) 512 endif 513 CACERTS_FILE:=$(call AltCheckSpaces,CACERTS_FILE) 514 CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE) 515 516 # 517 # When signing the JCE framework and provider, we could be using built 518 # bits on a read-only filesystem. If so, this test will fail and crash 519 # the build. 520 # 521 ifndef IGNORE_WRITABLE_OUTPUTDIR_TEST 522 # Create the output directory and make sure it exists and is writable 523 _create_outputdir:=$(shell $(MKDIR) -p "$(OUTPUTDIR)" > $(DEV_NULL) 2>&1) 524 ifeq ($(call WriteDirExists,$(OUTPUTDIR),/dev/null),/dev/null) 525 _outputdir_error:=$(error "ERROR: OUTPUTDIR '$(OUTPUTDIR)' not created or not writable") 526 endif 527 endif 528 529 # Define absolute path if needed and check for spaces and null value 530 ifndef ABS_OUTPUTDIR 531 ifdef _OUTPUTDIRNAME 532 #Could not define this at the same time as _OUTPUTDIRNAME as FullPath is not defined at that point 533 ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY)) 534 ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME) 535 else 536 ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR)) 537 endif 538 endif 539 ABS_OUTPUTDIR:=$(call AltCheckSpaces,ABS_OUTPUTDIR) 540 ABS_OUTPUTDIR:=$(call AltCheckValue,ABS_OUTPUTDIR) 541 # Make doubly sure this is a full path 542 ifeq ($(call AbsPwdPathCheck,$(ABS_OUTPUTDIR)), ) 543 ifdef ALT_OUTPUTDIR 544 _outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)', was ALT_OUTPUTDIR '$(ALT_OUTPUTDIR)' an absolute path?") 545 else 546 _outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)'") 547 endif 548 endif 549 _dir1:=$(call FullPath,$(ABS_OUTPUTDIR)) 550 _dir2:=$(call FullPath,$(OUTPUTDIR)) 551 ifneq ($(_dir1),$(_dir2)) 552 _outputdir_error:=$(error "ERROR: ABS_OUTPUTDIR '$(ABS_OUTPUTDIR)' is not the same directory as OUTPUTDIR '$(OUTPUTDIR)', '$(_dir1)'!='$(_dir2)'") 553 endif 554 555 # Bin directory 556 # NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64 557 BINDIR = $(OUTPUTDIR)/bin$(ISA_DIR) 558 559 # MOZILLA_HEADERS_PATH: path to mozilla header files for plugin 560 ifdef ALT_MOZILLA_HEADERS_PATH 561 MOZILLA_HEADERS_PATH :=$(call FullPath,$(ALT_MOZILLA_HEADERS_PATH)) 562 else 563 MOZILLA_HEADERS_PATH =$(JDK_DEVTOOLS_DIR)/share/plugin 564 endif 565 MOZILLA_HEADERS_PATH:=$(call AltCheckSpaces,MOZILLA_HEADERS_PATH) 566 MOZILLA_HEADERS_PATH:=$(call AltCheckValue,MOZILLA_HEADERS_PATH) 567 568 # CUPS_HEADERS_PATH: path to Cups headers files for Unix printing 569 ifneq ($(PLATFORM), windows) 570 JDK_CUPS_HEADERS_PATH=$(JDK_DEVTOOLS_DIR)/share/cups/include 571 ifdef ALT_CUPS_HEADERS_PATH 572 CUPS_HEADERS_PATH:=$(call FullPath,$(ALT_CUPS_HEADERS_PATH)) 573 CUPS_HEADERS_PATH:=$(call AltCheckValue,CUPS_HEADERS_PATH) 574 else 575 CUPS_HEADERS_PATH:= \ 576 $(shell if [ -d "$(JDK_CUPS_HEADERS_PATH)" ]; then \ 577 echo "$(JDK_CUPS_HEADERS_PATH)"; \ 578 else \ 579 echo "$(_CUPS_HEADERS_PATH)";\ 580 fi) 581 endif 582 endif 583 584 # Utilities ant 585 ifeq ($(PLATFORM), windows) 586 ifeq ($(ANT_HOME),) 587 ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,) 588 endif 589 endif 590 591 # There are few problems with ant we need to workaround: 592 # 1) ant is using temporary directory java.io.tmpdir 593 # However, this directory is not unique enough and two separate ant processes 594 # can easily end up using the exact same temp directory. This may lead to weird build failures 595 # To workaround this we will define tmp dir explicitly 596 # 2) ant attempts to detect JDK location based on java.exe location 597 # This is fragile as developer may have JRE first on the PATH. 598 # To workaround this we will specify JAVA_HOME explicitly 599 600 ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp 601 ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)' 602 603 ifeq ($(ANT_HOME),) 604 ANT = $(ANT_WORKAROUNDS) ant 605 else 606 ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant 607 endif 608 609 ifdef ALT_COPYRIGHT_YEAR 610 COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR) 611 else 612 COPYRIGHT_YEAR = $(shell $(DATE) '+%Y') 613 endif 614 615 # Create file with source information 616 SOURCE_TIPS=$(ABS_OUTPUTDIR)/source_tips 617 618 # The source tips can come from the Mercurial repository, or in the files 619 # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same 620 # directory as the original $(HGDIR) directory. 621 # These should not be := assignments, only used from the root Makefile. 622 HG_VERSION = $(shell $(HG) version 2> $(DEV_NULL)) 623 HG_DIRECTORY=.hg 624 HGTIP_FILENAME=.hgtip 625 HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO 626 REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \ 627 $(shell ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \ 628 $(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \ 629 2> $(DEV_NULL)))))) 630 631 # Emit the repo:tip pairs to $@ 632 define GetSourceTips 633 for i in $(REPO_LIST) IGNORE ; do \ 634 if [ "$${i}" = "IGNORE" ] ; then \ 635 continue; \ 636 elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \ 637 $(PRINTF) " %s:%s" \ 638 "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ 639 elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ 640 $(PRINTF) " %s:%s" \ 641 "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ 642 fi; \ 643 done >> $@ 644 $(PRINTF) "\n" >> $@ 645 endef 646 647 # Create the HGTIP_FILENAME file 648 define CreateHgTip 649 $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\ 650 $(ECHO) $1/$(HGTIP_FILENAME) 651 endef 652 653 # Get the compiler specific settings (will run the compiler to find out) 654 # NOTE: COMPILER_PATH must be set by this time. 655 # Up until we include this file, we don't know what specific compiler 656 # version is actually being used (i.e. what is in PATH or COMPILER_PATH). 657 include $(JDK_MAKE_SHARED_DIR)/Compiler-$(CC_VERSION).gmk 658