defs.make 10.0 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 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
# published by the Free Software Foundation.
#
# 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.
#
19 20 21
# 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.
S
sla 已提交
22
#
D
duke 已提交
23 24
#

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# The common definitions for hotspot builds.

# Optionally include SPEC file generated by configure.
ifneq ($(SPEC),)
  include $(SPEC)
endif

# Directory paths and user name
# Unless GAMMADIR is set on the command line, search upward from
# the current directory for a parent directory containing "src/share/vm".
# If that fails, look for $GAMMADIR in the environment.
# When the tree of subdirs is built, this setting is stored in each flags.make.
GAMMADIR := $(shell until ([ -d dev ]&&echo $${GAMMADIR:-/GAMMADIR/}) || ([ -d src/share/vm ]&&pwd); do cd ..; done)
HS_SRC_DIR=$(GAMMADIR)/src
HS_MAKE_DIR=$(GAMMADIR)/make
HS_BUILD_DIR=$(GAMMADIR)/build

ifeq ($(USER),)
  USER=$(USERNAME)
endif

46 47 48 49 50 51 52 53
ifeq ($(HS_ALT_MAKE),)
  ifneq ($(OPENJDK),true)
    HS_ALT_MAKE=$(GAMMADIR)/make/closed
  else
    HS_ALT_MAKE=NO_SUCH_PATH
  endif
endif

54 55 56 57
#
# Include alternate defs.make if it exists
#
-include $(HS_ALT_MAKE)/defs.make
58

D
duke 已提交
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
# Default to verbose build logs (show all compile lines):
MAKE_VERBOSE=y

# Make macros for install files or preparing targets
CD=cd
CP=cp
ECHO=echo
GREP=grep
MKDIR=mkdir
MV=mv
PWD=pwd
RM=rm -f
SED=sed
TAR=tar
ZIPEXE=zip

define install-file
@$(MKDIR) -p $(@D)
@$(RM) $@
$(CP) $< $@
endef
80 81 82 83 84 85 86 87 88 89

# MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead.
# May need to have a MacOS X specific definition of install-dir
# sometime in the future.
define install-dir
@$(MKDIR) -p $(@D)
@$(RM) -r $@
$(CP) -r $< $@
endef

D
duke 已提交
90 91 92 93 94
define prep-target
@$(MKDIR) -p $(@D)
@$(RM) $@
endef

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
# Default values for JVM_VARIANT* variables if configure hasn't set
# it already.
ifeq ($(JVM_VARIANTS),)
  ifeq ($(ZERO_BUILD), true)
    ifeq ($(SHARK_BUILD), true)
      JVM_VARIANTS:=zeroshark
      JVM_VARIANT_ZEROSHARK:=true
    else
      JVM_VARIANTS:=zero
      JVM_VARIANT_ZERO:=true
    endif
  else
    # A default is needed
    ifeq ($(BUILD_CLIENT_ONLY), true)
      JVM_VARIANTS:=client
      JVM_VARIANT_CLIENT:=true
    endif
    # Further defaults are platform and arch specific
  endif
endif

D
duke 已提交
116 117 118
# hotspot version definitions
include $(GAMMADIR)/make/hotspot_version

119 120 121 122 123 124 125 126 127 128 129 130
# When config parameter --with-update-version is defined,
# Hotspot minor version should be set to that
ifneq ($(JDK_UPDATE_VERSION),)
  HS_MINOR_VER=$(JDK_UPDATE_VERSION)
endif

# When config parameter --with-build-number is defined,
# Hotspot build number should be set to that
ifneq ($(JDK_BUILD_NUMBER),)
  HS_BUILD_NUMBER=$(subst b,,$(JDK_BUILD_NUMBER))
endif

D
duke 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
# Java versions needed
ifeq ($(PREVIOUS_JDK_VERSION),)
  PREVIOUS_JDK_VERSION=$(JDK_PREVIOUS_VERSION)
endif
ifeq ($(JDK_MAJOR_VERSION),)
  JDK_MAJOR_VERSION=$(JDK_MAJOR_VER)
endif
ifeq ($(JDK_MINOR_VERSION),)
  JDK_MINOR_VERSION=$(JDK_MINOR_VER)
endif
ifeq ($(JDK_MICRO_VERSION),)
  JDK_MICRO_VERSION=$(JDK_MICRO_VER)
endif
ifeq ($(JDK_MKTG_VERSION),)
  JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
endif
ifeq ($(JDK_VERSION),)
  JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
endif
ifeq ($(FULL_VERSION),)
  FULL_VERSION="$(JDK_VERSION)"
endif

# FULL_VERSION is only used to define JRE_RELEASE_VERSION which is used
# as JRE version in VM -Xinternalversion output.
ifndef JRE_RELEASE_VERSION
  JRE_RELEASE_VERSION=$(FULL_VERSION)
endif

ifndef HOTSPOT_RELEASE_VERSION
  HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
endif

ifdef HOTSPOT_BUILD_VERSION
165
# specified in command line
D
duke 已提交
166
else
167
  ifdef COOKED_BUILD_NUMBER
D
duke 已提交
168
# JRE build
169 170 171 172
    HOTSPOT_BUILD_VERSION=
  else
    ifdef USER_RELEASE_SUFFIX
      HOTSPOT_BUILD_VERSION=internal-$(USER_RELEASE_SUFFIX)
D
duke 已提交
173 174 175 176 177 178 179 180 181
    else
      HOTSPOT_BUILD_VERSION=internal
    endif
  endif
endif

# Windows should have OS predefined
ifeq ($(OS),)
  OS   := $(shell uname -s)
N
never 已提交
182 183 184 185 186 187
  ifneq ($(findstring BSD,$(OS)),)
    OS=bsd
  endif
  ifeq ($(OS), Darwin)
    OS=bsd
  endif
D
duke 已提交
188 189 190
  HOST := $(shell uname -n)
endif

191
# If not SunOS, not Linux not BSD and not AIX, assume Windows
D
duke 已提交
192 193
ifneq ($(OS), Linux)
  ifneq ($(OS), SunOS)
N
never 已提交
194
    ifneq ($(OS), bsd)
195 196 197 198 199
      ifneq ($(OS), AIX)
        OSNAME=windows
      else
        OSNAME=aix
      endif
N
never 已提交
200 201 202
    else
      OSNAME=bsd
    endif
D
duke 已提交
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
  else
    OSNAME=solaris
  endif
else
  OSNAME=linux
endif

# Determinations of default make arguments and platform specific settings
MAKE_ARGS=

# ARCH_DATA_MODEL==64 is equivalent to LP64=1
ifeq ($(ARCH_DATA_MODEL), 64)
  ifndef LP64
    LP64 := 1
  endif
endif

# Defaults set for product build
EXPORT_SUBDIR=

# Change default /java path if requested
ifneq ($(ALT_SLASH_JAVA),)
  SLASH_JAVA=$(ALT_SLASH_JAVA)
endif

# Default OUTPUTDIR
OUTPUTDIR=$(HS_BUILD_DIR)/$(OSNAME)
ifneq ($(ALT_OUTPUTDIR),)
  OUTPUTDIR=$(ALT_OUTPUTDIR)
endif

# Find latest promoted JDK area
JDK_IMPORT_PATH=$(SLASH_JAVA)/re/j2se/$(JDK_VERSION)/promoted/latest/binaries/$(PLATFORM)
ifneq ($(ALT_JDK_IMPORT_PATH),)
  JDK_IMPORT_PATH=$(ALT_JDK_IMPORT_PATH)
endif

240 241 242 243 244 245 246
# Other parts of JDK build may require an import JDK that can be executed
# on the build host. For cross-compile builds we also need an import JDK
# that matches the target arch, so for that we set ALT_JDK_TARGET_IMPORT_PATH
ifneq ($(ALT_JDK_TARGET_IMPORT_PATH),)
  JDK_IMPORT_PATH=$(ALT_JDK_TARGET_IMPORT_PATH)
endif

D
duke 已提交
247 248 249 250 251 252
# Find JDK used for javac compiles
BOOTDIR=$(SLASH_JAVA)/re/j2se/$(PREVIOUS_JDK_VERSION)/latest/binaries/$(PLATFORM)
ifneq ($(ALT_BOOTDIR),)
  BOOTDIR=$(ALT_BOOTDIR)
endif

253 254 255 256 257 258 259 260
# Select name of the export directory and honor ALT overrides
EXPORT_PATH=$(OUTPUTDIR)/export-$(PLATFORM)$(EXPORT_SUBDIR)
ifneq ($(ALT_EXPORT_PATH),)
  EXPORT_PATH=$(ALT_EXPORT_PATH)
endif

# Default jdk image if one is created for you with create_jdk
JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-$(PLATFORM)
261 262 263
ifneq ($(ALT_JDK_IMAGE_DIR),)
  JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
endif
264

S
sla 已提交
265
# The platform dependent defs.make defines platform specific variable such
D
duke 已提交
266
# as ARCH, EXPORT_LIST etc. We must place the include here after BOOTDIR is defined.
267
include $(GAMMADIR)/make/$(OSNAME)/makefiles/defs.make
D
duke 已提交
268 269

# We are trying to put platform specific defintions
270
# files to make/$(OSNAME)/makefiles dictory. However
D
duke 已提交
271 272 273
# some definitions are common for both linux and solaris,
# so we put them here.
ifneq ($(OSNAME),windows)
274
  ABS_OUTPUTDIR     := $(shell mkdir -p $(OUTPUTDIR); $(CD) $(OUTPUTDIR); $(PWD))
D
duke 已提交
275 276
  ABS_BOOTDIR       := $(shell $(CD) $(BOOTDIR); $(PWD))
  ABS_GAMMADIR      := $(shell $(CD) $(GAMMADIR); $(PWD))
277
  ABS_OS_MAKEFILE   := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME); $(PWD))/Makefile
D
duke 已提交
278 279 280 281 282 283 284 285 286

  # uname, HotSpot source directory, build directory and JDK use different names
  # for CPU architectures.
  #   ARCH      - uname output
  #   SRCARCH   - where to find HotSpot cpu and os_cpu source files
  #   BUILDARCH - build directory
  #   LIBARCH   - directory name in JDK/JRE

  # Use uname output for SRCARCH, but deal with platform differences. If ARCH
S
sla 已提交
287
  # is not explicitly listed below, it is treated as x86.
288
  SRCARCH    ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 zero,$(ARCH)))
D
duke 已提交
289 290 291 292 293 294
  ARCH/       = x86
  ARCH/sparc  = sparc
  ARCH/sparc64= sparc
  ARCH/ia64   = ia64
  ARCH/amd64  = x86
  ARCH/x86_64 = x86
295
  ARCH/ppc64  = ppc
296
  ARCH/ppc    = ppc
297
  ARCH/zero   = zero
D
duke 已提交
298 299

  # BUILDARCH is usually the same as SRCARCH, except for sparcv9
300
  BUILDARCH ?= $(SRCARCH)
D
duke 已提交
301 302 303 304 305 306 307 308 309 310 311 312
  ifeq ($(BUILDARCH), x86)
    ifdef LP64
      BUILDARCH = amd64
    else
      BUILDARCH = i486
    endif
  endif
  ifeq ($(BUILDARCH), sparc)
    ifdef LP64
      BUILDARCH = sparcv9
    endif
  endif
313 314 315 316 317
  ifeq ($(BUILDARCH), ppc)
    ifdef LP64
      BUILDARCH = ppc64
    endif
  endif
D
duke 已提交
318 319

  # LIBARCH is 1:1 mapping from BUILDARCH
320
  LIBARCH        ?= $(LIBARCH/$(BUILDARCH))
D
duke 已提交
321 322 323 324 325
  LIBARCH/i486    = i386
  LIBARCH/amd64   = amd64
  LIBARCH/sparc   = sparc
  LIBARCH/sparcv9 = sparcv9
  LIBARCH/ia64    = ia64
326
  LIBARCH/ppc64   = ppc64
327
  LIBARCH/zero    = $(ZERO_LIBARCH)
D
duke 已提交
328

329
  LP64_ARCH += sparcv9 amd64 ia64 ppc64 zero
D
duke 已提交
330 331 332
endif

# Required make macro settings for all platforms
333
MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
334
MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
D
duke 已提交
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)

# Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile
# to overwrite the default definition since OS specific Makefile also
# includes this make/defs.make file.
MAKE_ARGS += HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION)

# Various export sub directories
EXPORT_INCLUDE_DIR = $(EXPORT_PATH)/include
EXPORT_DOCS_DIR = $(EXPORT_PATH)/docs
EXPORT_LIB_DIR = $(EXPORT_PATH)/lib
EXPORT_JRE_DIR = $(EXPORT_PATH)/jre
EXPORT_JRE_BIN_DIR = $(EXPORT_JRE_DIR)/bin
EXPORT_JRE_LIB_DIR = $(EXPORT_JRE_DIR)/lib
EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)/$(LIBARCH)

D
dcubed 已提交
354 355 356 357 358 359 360
# non-universal macosx builds need to appear universal
ifeq ($(OS_VENDOR), Darwin)
  ifneq ($(MACOSX_UNIVERSAL), true)
    EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)
  endif
endif

D
duke 已提交
361 362
# Common export list of files
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmti.h
363
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmticmlr.h
D
duke 已提交
364 365 366
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
367

368
.PHONY: $(HS_ALT_MAKE)/defs.make
S
sla 已提交
369