make/common/shared/Defs.gmk

Thu, 17 Jun 2010 16:27:56 -0700

author
mikejwre
date
Thu, 17 Jun 2010 16:27:56 -0700
changeset 171
95db968660e7
parent 158
91006f157c46
child 194
0f60cf26c5b5
permissions
-rw-r--r--

Added tag jdk7-b98 for changeset 3b99409057e4

duke@1 1 #
ohair@158 2 # Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
duke@1 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 #
duke@1 5 # This code is free software; you can redistribute it and/or modify it
duke@1 6 # under the terms of the GNU General Public License version 2 only, as
ohair@158 7 # published by the Free Software Foundation. Oracle designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
ohair@158 9 # by Oracle in the LICENSE file that accompanied this code.
duke@1 10 #
duke@1 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 # accompanied this code).
duke@1 16 #
duke@1 17 # You should have received a copy of the GNU General Public License version
duke@1 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 #
ohair@158 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 # or visit www.oracle.com if you need additional information or have any
ohair@158 23 # questions.
duke@1 24 #
duke@1 25
duke@1 26 #
duke@1 27 # Defnitions for all platforms.
duke@1 28 #
duke@1 29 # Normally the convention is that these alternate definitions of
duke@1 30 # primary make variables are never defined inside the Makefiles anywhere
duke@1 31 # but are defined via environment variables or set on the make command
duke@1 32 # line. So you should never see an ALT_* variable defined in any
duke@1 33 # makefiles, just used. This is the convention and there are some
duke@1 34 # exceptions, either mistakes or unusual circumstances.
duke@1 35 #
duke@1 36 # The naming convention for the default value of one of these variables
duke@1 37 # that has an ALT_* override capability is to name the default value with a
duke@1 38 # leading underscore (_). So for XXX you would have:
duke@1 39 # _XXX default value
duke@1 40 # ALT_XXX any override the user is providing if any
duke@1 41 # XXX the final value, either the default _XXX or the ALT_XXX value.
duke@1 42 #
duke@1 43
duke@1 44 # On Directory names. In very rare cases should the Windows directory
duke@1 45 # names use the backslash, please use the C:/ style of windows paths.
duke@1 46 # Avoid duplicating the // characters in paths, this has known to cause
duke@1 47 # strange problems with jar and other utilities, e.g. /a//b/ != /a/b/.
duke@1 48 # Some of these variables have an explicit trailing / character, but in
duke@1 49 # general, they should NOT have the trailing / character.
duke@1 50
duke@1 51 # Get shared system utilities macros defined
duke@1 52 include $(BUILDDIR)/common/shared/Defs-utils.gmk
duke@1 53
duke@1 54 # Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, etc. have been defined.
duke@1 55
duke@1 56 # Simple pwd path
duke@1 57 define PwdPath
duke@1 58 $(shell cd $1 2> $(DEV_NULL) && pwd)
duke@1 59 endef
duke@1 60
duke@1 61 # Checks an ALT value for spaces (should be one word),
duke@1 62 # warns and returns Check_ALT_$1 if spaces
duke@1 63 define AltCheckSpaces
duke@1 64 $(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1))
duke@1 65 endef
duke@1 66
duke@1 67 # Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty
duke@1 68 define AltCheckValue
duke@1 69 $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1)
duke@1 70 endef
duke@1 71
duke@1 72 # Checks any value for empty, warns and returns $2 if empty
duke@1 73 define CheckValue
duke@1 74 $(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2)
duke@1 75 endef
duke@1 76
duke@1 77 # Prefix for a utility prefix path, if empty leave alone, otherwise end with a /
duke@1 78 define PrefixPath
duke@1 79 $(if $1,$(subst //,/,$1/),)
duke@1 80 endef
duke@1 81
duke@1 82 # Select a directory if it exists, or the alternate 2 or the alternate 3
duke@1 83 define DirExists
duke@1 84 $(shell \
duke@1 85 if [ -d "$1" ]; then \
duke@1 86 echo "$1"; \
duke@1 87 elif [ -d "$2" ]; then \
duke@1 88 echo "$2"; \
duke@1 89 else \
duke@1 90 echo "$3"; \
duke@1 91 fi)
duke@1 92 endef
duke@1 93
duke@1 94 # Select a writable directory if it exists and is writable, or the alternate
duke@1 95 define WriteDirExists
duke@1 96 $(shell \
duke@1 97 if [ -d "$1" -a -w "$1" ]; then \
duke@1 98 echo "$1"; \
duke@1 99 else \
duke@1 100 echo "$2"; \
duke@1 101 fi)
duke@1 102 endef
duke@1 103
duke@1 104 # Select a file if it exists, or the alternate 1, or the alternate 2
duke@1 105 define FileExists
duke@1 106 $(shell \
duke@1 107 if [ -r "$1" ]; then \
duke@1 108 echo "$1"; \
duke@1 109 elif [ -r "$2" ]; then \
duke@1 110 echo "$2"; \
duke@1 111 else \
duke@1 112 echo "NO_FILE_EXISTS"; \
duke@1 113 fi)
duke@1 114 endef
duke@1 115
duke@1 116 # Given a line of text, get the major.minor version number from it
duke@1 117 define GetVersion
duke@1 118 $(shell echo $1 | sed -e 's@[^1-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*@\1@' )
duke@1 119 endef
duke@1 120
duke@1 121 # Given a major.minor.micro version, return the major, minor, or micro number
duke@1 122 define MajorVersion
duke@1 123 $(if $(word 1, $(subst ., ,$1)),$(word 1, $(subst ., ,$1)),0)
duke@1 124 endef
duke@1 125 define MinorVersion
duke@1 126 $(if $(word 2, $(subst ., ,$1)),$(word 2, $(subst ., ,$1)),0)
duke@1 127 endef
duke@1 128 define MicroVersion
duke@1 129 $(if $(word 3, $(subst ., ,$1)),$(word 3, $(subst ., ,$1)),0)
duke@1 130 endef
duke@1 131
duke@1 132 # Macro that returns missing, same, newer, or older $1=version $2=required
duke@1 133 # (currently does not check the micro number)
duke@1 134 define CheckVersions
duke@1 135 $(shell \
duke@1 136 if [ "$1" = "" -o "$2" = "" ]; then \
duke@1 137 echo missing; \
duke@1 138 else \
duke@1 139 if [ "$1" = "$2" ]; then \
duke@1 140 echo same; \
duke@1 141 else \
duke@1 142 if [ $(call MajorVersion,$1) -lt $(call MajorVersion,$2) ] ; then \
duke@1 143 echo older; \
duke@1 144 else \
duke@1 145 if [ $(call MajorVersion,$1) -eq $(call MajorVersion,$2) -a \
duke@1 146 $(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \
duke@1 147 echo older; \
duke@1 148 else \
duke@1 149 echo newer; \
duke@1 150 fi; \
duke@1 151 fi; \
duke@1 152 fi; \
duke@1 153 fi)
duke@1 154 endef
duke@1 155
duke@1 156 # Make sure certain variables are non-empty at this point
duke@1 157 _check_values:=\
duke@1 158 $(call CheckValue,ARCH,),\
duke@1 159 $(call CheckValue,ARCH_DATA_MODEL,),\
duke@1 160 $(call CheckValue,ARCH_VM_SUBDIR,),\
duke@1 161 $(call CheckValue,VARIANT,),\
duke@1 162 $(call CheckValue,PLATFORM,)
duke@1 163
duke@1 164 # Misc common settings for all workspaces
duke@1 165 # This determines the version of the product, and the previous version or boot
duke@1 166 ifndef JDK_MAJOR_VERSION
duke@1 167 JDK_MAJOR_VERSION = 1
duke@1 168 PREVIOUS_MAJOR_VERSION = 1
duke@1 169 endif
duke@1 170
duke@1 171 ifndef JDK_MINOR_VERSION
duke@1 172 JDK_MINOR_VERSION = 7
duke@1 173 PREVIOUS_MINOR_VERSION = 6
duke@1 174 endif
duke@1 175
duke@1 176 ifndef JDK_MICRO_VERSION
duke@1 177 JDK_MICRO_VERSION = 0
duke@1 178 PREVIOUS_MICRO_VERSION = 0
duke@1 179 endif
duke@1 180
duke@1 181 ifndef MILESTONE
duke@1 182 MILESTONE = internal
duke@1 183 endif
duke@1 184
duke@1 185 ifndef BUILD_NUMBER
duke@1 186 JDK_BUILD_NUMBER = b00
duke@1 187 else
duke@1 188 ifndef JDK_BUILD_NUMBER
duke@1 189 JDK_BUILD_NUMBER = $(BUILD_NUMBER)
duke@1 190 endif
duke@1 191 endif
duke@1 192
duke@1 193 # Default variant is the optimized version of everything
duke@1 194 # can be OPT or DBG, default is OPT
duke@1 195 # Determine the extra pattern to add to the release name for debug/fastdebug.
duke@1 196 # Determine the JDK_IMPORT_VARIANT, so we get the right VM files copied over.
duke@1 197 # Determine suffix for obj directory or OBJDIR, for .o files.
duke@1 198 # (by keeping .o files separate, just .o files, they don't clobber each
duke@1 199 # other, however, the library files will clobber each other).
duke@1 200 #
duke@1 201 ifeq ($(VARIANT), DBG)
duke@1 202 BUILD_VARIANT_RELEASE=-debug
duke@1 203 OBJDIRNAME_SUFFIX=_g
duke@1 204 else
duke@1 205 BUILD_VARIANT_RELEASE=
duke@1 206 OBJDIRNAME_SUFFIX=
duke@1 207 endif
duke@1 208 ifeq ($(FASTDEBUG), true)
duke@1 209 VARIANT=DBG
duke@1 210 BUILD_VARIANT_RELEASE=-fastdebug
duke@1 211 OBJDIRNAME_SUFFIX=_gO
duke@1 212 _JDK_IMPORT_VARIANT=/fastdebug
duke@1 213 endif
duke@1 214
duke@1 215 # Depending on the flavor of the build, add a -debug or -fastdebug to the name
duke@1 216 ifdef DEBUG_NAME
duke@1 217 BUILD_VARIANT_RELEASE=-$(DEBUG_NAME)
duke@1 218 endif
duke@1 219
duke@1 220 JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
duke@1 221 JDK_UNDERSCORE_VERSION = $(subst .,_,$(JDK_VERSION))
duke@1 222
duke@1 223 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
duke@1 224 ifneq ($(MILESTONE),fcs)
duke@1 225 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
duke@1 226 else
duke@1 227 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
duke@1 228 endif
duke@1 229
duke@1 230 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
ohair@114 231 ifndef FULL_VERSION
ohair@114 232 ifdef BUILD_NUMBER
ohair@114 233 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
ohair@114 234 else
ohair@114 235 BUILD_NUMBER = b00
ohair@114 236 USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
ohair@114 237 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
ohair@114 238 endif
ohair@114 239 export FULL_VERSION
duke@1 240 endif
duke@1 241
duke@1 242 # Promoted build location
duke@1 243 PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted
duke@1 244 PROMOTED_BUILD_LATEST = latest
duke@1 245 PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST)
duke@1 246 PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries
duke@1 247
duke@1 248 # OPT: Changes what the optimizations settings (in _OPT)
duke@1 249 POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)
duke@1 250
duke@1 251 # PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel.
duke@1 252 # If the user sets ALT_PARALLEL_COMPILE_JOBS, then COMPILE_APPROACH is set
duke@1 253 # to parallel.
duke@1 254 #
duke@1 255 # Recommended setting: 2 seems to be ideal for single cpu machines,
duke@1 256 # 2 times the number of CPU's is a basic formula,
duke@1 257 # but probably not more than 4 if the machine is
duke@1 258 # being shared by others, or the machine is limited
duke@1 259 # in RAM or swap.
duke@1 260 #
duke@1 261 ifdef ALT_PARALLEL_COMPILE_JOBS
duke@1 262 PARALLEL_COMPILE_JOBS=$(ALT_PARALLEL_COMPILE_JOBS)
duke@1 263 else
duke@1 264 PARALLEL_COMPILE_JOBS=2
duke@1 265 endif
duke@1 266
duke@1 267 # Previous JDK release (version of BOOTDIR version)
duke@1 268 ifdef ALT_PREVIOUS_JDK_VERSION
duke@1 269 PREVIOUS_JDK_VERSION = $(ALT_PREVIOUS_JDK_VERSION)
duke@1 270 else
duke@1 271 PREVIOUS_JDK_VERSION = $(PREVIOUS_MAJOR_VERSION).$(PREVIOUS_MINOR_VERSION).$(PREVIOUS_MICRO_VERSION)
duke@1 272 endif
duke@1 273 export PREVIOUS_JDK_VERSION
duke@1 274 PREVIOUS_JDK_VERSION:=$(call AltCheckSpaces,PREVIOUS_JDK_VERSION)
duke@1 275 PREVIOUS_JDK_VERSION:=$(call AltCheckValue,PREVIOUS_JDK_VERSION)
duke@1 276
duke@1 277 # Version with _ instead of . in number
duke@1 278 ifeq ($(PREVIOUS_MINOR_VERSION),5)
duke@1 279 PREVIOUS_JDK_UNDERSCORE_VERSION = $(subst .,_,$(PREVIOUS_JDK_VERSION))
duke@1 280 else
duke@1 281 PREVIOUS_JDK_UNDERSCORE_VERSION = $(PREVIOUS_MINOR_VERSION)
duke@1 282 endif
duke@1 283
duke@1 284 # Get platform specific settings
duke@1 285 include $(BUILDDIR)/common/shared/Defs-$(PLATFORM).gmk
duke@1 286
ohair@4 287 # Components
ohair@4 288 ifdef ALT_LANGTOOLS_DIST
ohair@4 289 LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST))
ohair@4 290 else
ohair@4 291 LANGTOOLS_DIST =
ohair@4 292 endif
ohair@4 293
duke@1 294 # These are the same on all platforms but require the above platform include 1st
duke@1 295
duke@1 296 # BOOTDIR: Bootstrap JDK, previous released JDK.
duke@1 297 # _BOOTDIR1 and _BOOTDIR2 picked by platform
duke@1 298 ifdef ALT_BOOTDIR
duke@1 299 BOOTDIR =$(ALT_BOOTDIR)
duke@1 300 else
duke@1 301 BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
duke@1 302 endif
duke@1 303 export BOOTDIR
duke@1 304 BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)
duke@1 305 BOOTDIR:=$(call AltCheckValue,BOOTDIR)
duke@1 306
duke@1 307 # OUTPUTDIR: Location of all output for the build
duke@1 308 _BACKUP_OUTPUTDIR = $(TEMP_DISK)/$(USER)/jdk-outputdir
duke@1 309 ifdef ALT_OUTPUTDIR
duke@1 310 _POSSIBLE_OUTPUTDIR =$(subst \,/,$(ALT_OUTPUTDIR))
duke@1 311 else
duke@1 312 ifndef _OUTPUTDIR
duke@1 313 _OUTPUTDIR = $(_BACKUP_OUTPUTDIR)
duke@1 314 endif
duke@1 315 _POSSIBLE_OUTPUTDIR =$(_OUTPUTDIR)
duke@1 316 endif
duke@1 317 _create_outputdir1:=$(shell mkdir -p $(_POSSIBLE_OUTPUTDIR) > $(DEV_NULL) 2>&1)
duke@1 318 OUTPUTDIR:=$(call WriteDirExists,$(_POSSIBLE_OUTPUTDIR),$(_BACKUP_OUTPUTDIR))
duke@1 319 _create_outputdir2:=$(shell mkdir -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1)
duke@1 320 ifeq "$(OUTPUTDIR)" "$(_BACKUP_OUTPUTDIR)"
duke@1 321 _outputdir_warning:=$(warning "WARNING: OUTPUTDIR '$(_POSSIBLE_OUTPUTDIR)' not writable, will use '$(_BACKUP_OUTPUTDIR)'")
duke@1 322 endif
duke@1 323 OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
duke@1 324 OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
duke@1 325
duke@1 326 # Bin directory
duke@1 327 # NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64
duke@1 328 BINDIR = $(OUTPUTDIR)/bin$(ISA_DIR)
duke@1 329
duke@1 330 # Absolute path to output directory
duke@1 331 ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
duke@1 332
duke@1 333 # Get shared compiler settings
duke@1 334 include $(BUILDDIR)/common/shared/Compiler.gmk
duke@1 335

mercurial