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