Defs-internal.gmk 11.1 KB
Newer Older
D
duke 已提交
1
#
O
ohair 已提交
2
# Copyright (c) 1995, 2010, 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
#

#
# Common variables used by all the Java makefiles.  This file should
# not contain rules.
#

O
ohrstrom 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# The build times report is turned off by setting REPORT_BUILD_TIMES to nothing.
# This is necessary for the target clobber/clean which will erase the
# directories where the buildtimes are stored.
REPORT_BUILD_TIMES=1
# Store the build times in this directory.
BUILDTIMESDIR=$(ABS_OUTPUTDIR)/tmp/buildtimes

# Record starting time for build of a sub repository.
define RecordStartTime
$(MKDIR) -p $(BUILDTIMESDIR)
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
endef

# Indicate that we started to build a sub repository and record starting time. 
46
define MakeStart
O
ohrstrom 已提交
47 48
$(call RecordStartTime,$1)
$(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \
49 50
"########################################################################" \
"########################################################################" \
O
ohrstrom 已提交
51
"Entering $1 for target(s) $2" \
52 53 54
"########################################################################"
endef

O
ohrstrom 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# Record ending time and calculate the difference and store it in a
# easy to read format. Handles builds that cross midnight. Expects
# that a build will never take 24 hours or more. 
define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
  $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
             M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
  > $(BUILDTIMESDIR)/build_time_diff_$1
endef

# Indicate that we are done.
# Record ending time and print out the total time it took to build.
define MakeFinish 
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),) 
$(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \
72
"########################################################################" \
O
ohrstrom 已提交
73
"Leaving $1 for target(s) $2" \
74
"########################################################################" \
O
ohrstrom 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87
$(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \
"########################################################################" 
endef

# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
$(PRINTF) "-- Build times ----------\nTarget %s\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
$1 \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
88 89
endef

90 91 92 93 94 95
ifdef OPENJDK
  ifneq ($(OPENJDK),true)
    x:=$(error "OPENJDK (if defined) can only be set to true")
  endif
endif

D
duke 已提交
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 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
# Define absolute paths to TOPDIRs
ABS_LANGTOOLS_TOPDIR:=$(call OptFullPath,"$(LANGTOOLS_TOPDIR)")
ABS_CORBA_TOPDIR:=$(call OptFullPath,"$(CORBA_TOPDIR)")
ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)")
ABS_JAXWS_TOPDIR:=$(call OptFullPath,"$(JAXWS_TOPDIR)")
ABS_JDK_TOPDIR:=$(call OptFullPath,"$(JDK_TOPDIR)")
ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)")
ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)")
ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)")
ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)")

# Macro to return true or false if a file exists and is readable
define MkExists
$(shell if [ -r $1 ]; then $(ECHO) true; else $(ECHO) false; fi)
endef

HOTSPOT_SRC_AVAILABLE := $(call MkExists,$(HOTSPOT_TOPDIR)/make/Makefile)
ifndef BUILD_HOTSPOT
  ifdef ALT_HOTSPOT_IMPORT_PATH
    BUILD_HOTSPOT := false
  else
    BUILD_HOTSPOT := $(HOTSPOT_SRC_AVAILABLE)
  endif
endif

LANGTOOLS_SRC_AVAILABLE := $(call MkExists,$(LANGTOOLS_TOPDIR)/make/Makefile)
ifndef BUILD_LANGTOOLS
  ifdef ALT_LANGTOOLS_DIST
    BUILD_LANGTOOLS := false
  else
    BUILD_LANGTOOLS := $(LANGTOOLS_SRC_AVAILABLE)
  endif
endif

CORBA_SRC_AVAILABLE := $(call MkExists,$(CORBA_TOPDIR)/make/Makefile)
ifndef BUILD_CORBA
  ifdef ALT_CORBA_DIST
    BUILD_CORBA := false
  else
    BUILD_CORBA := $(CORBA_SRC_AVAILABLE)
  endif
endif

JAXP_SRC_AVAILABLE := $(call MkExists,$(JAXP_TOPDIR)/make/Makefile)
ifndef BUILD_JAXP
  ifdef ALT_JAXP_DIST
    BUILD_JAXP := false
  else
    BUILD_JAXP := $(JAXP_SRC_AVAILABLE)
  endif
endif

JAXWS_SRC_AVAILABLE := $(call MkExists,$(JAXWS_TOPDIR)/make/Makefile)
ifndef BUILD_JAXWS
  ifdef ALT_JAXWS_DIST
    BUILD_JAXWS := false
  else
    BUILD_JAXWS := $(JAXWS_SRC_AVAILABLE)
  endif
endif

JDK_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/make/Makefile)
ifndef BUILD_JDK
  BUILD_JDK := $(JDK_SRC_AVAILABLE)
endif
ifeq ($(JDK_SRC_AVAILABLE),true)
  JDK_CLOSED_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/src/closed)
163 164
  ifeq ($(JDK_CLOSED_SRC_AVAILABLE),false)
    OPENJDK = true
D
duke 已提交
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
  endif
endif

DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile)
ifndef BUILD_DEPLOY
  BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE)
endif

INSTALL_SRC_AVAILABLE := $(call MkExists,$(INSTALL_TOPDIR)/make/Makefile)
ifndef BUILD_INSTALL
  ifdef DEV_ONLY
    BUILD_INSTALL := false
  else
    BUILD_INSTALL := $(INSTALL_SRC_AVAILABLE)
  endif
endif

SPONSORS_SRC_AVAILABLE := $(call MkExists,$(SPONSORS_TOPDIR)/make/Makefile)
ifndef BUILD_SPONSORS
  ifdef DEV_ONLY
    BUILD_SPONSORS := false
  else
    BUILD_SPONSORS := $(SPONSORS_SRC_AVAILABLE)
  endif
endif


192
# Do we build the source bundles?
D
duke 已提交
193
BUNDLE_RULES = $(JDK_TOPDIR)/make/closed/bundles.gmk
194 195 196 197 198
ifeq ($(SKIP_BUNDLES_BUILD), true)
  BUNDLE_RULES_AVAILABLE := false
else 
  BUNDLE_RULES_AVAILABLE := $(call MkExists,$(BUNDLE_RULES))
endif
D
duke 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216

# Current things we do NOT build for OPENJDK
ifdef OPENJDK
  BUILD_DEPLOY = false
  BUILD_INSTALL = false
  BUILD_SPONSORS = false
  BUNDLE_RULES_AVAILABLE := false
  # These could be over-ridden on the command line or in environment
  ifndef SKIP_FASTDEBUG_BUILD
    SKIP_FASTDEBUG_BUILD = true
  endif
  ifndef SKIP_DEBUG_BUILD
    SKIP_DEBUG_BUILD = true
  endif
  ifndef SKIP_COMPARE_IMAGES
    SKIP_COMPARE_IMAGES = true
  endif
else
217 218 219 220 221 222 223 224 225 226 227 228 229 230
  
  # Various non-OPENJDK reasons to NOT build the deploy repository
  ifeq ($(ARCH), ia64)
    BUILD_DEPLOY=false
  endif
  ifeq ($(ARCH), sparcv9)
    BUILD_DEPLOY=false
  endif
  ifeq ($(ARCH), amd64)
    ifeq ($(PLATFORM), solaris)
      BUILD_DEPLOY=false
    endif
  endif

D
duke 已提交
231
endif
232 233 234
ifndef SKIP_PRODUCT_BUILD
  SKIP_PRODUCT_BUILD = false
endif
D
duke 已提交
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256

# Many reasons why we would want to skip the comparison to previous jdk
ifndef SKIP_COMPARE_IMAGES
  ifeq ($(BUILD_JDK), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifeq ($(BUILD_DEPLOY), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifeq ($(BUILD_INSTALL), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifdef DEV_ONLY
    SKIP_COMPARE_IMAGES = true
  endif
endif

# Select defaults if these are not set to true or false
ifndef SKIP_DEBUG_BUILD
  SKIP_DEBUG_BUILD=true
endif
ifndef SKIP_FASTDEBUG_BUILD
257
  SKIP_FASTDEBUG_BUILD=true
D
duke 已提交
258 259
endif

260 261 262 263
# Select javadoc setting GENERATE_DOCS
ifndef NO_DOCS
  # Default value (we want javadoc run)
  GENERATE_DOCS=true
264 265 266 267 268
  # No DOCS build when JDK_UPDATE_VERSION set on non-OPENJDK builds
  ifndef OPENJDK
    ifdef JDK_UPDATE_VERSION
      GENERATE_DOCS=false
    endif
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
  endif
  # If langtools, corba, jaxp, and jaxws are not being built, 
  #   a full jdk javadoc is not possible
  ifneq ($(BUILD_LANGTOOLS), true)
    GENERATE_DOCS=false
  endif
  ifneq ($(BUILD_CORBA), true)
    GENERATE_DOCS=false
  endif
  ifneq ($(BUILD_JAXP), true)
    GENERATE_DOCS=false
  endif
  ifneq ($(BUILD_JAXWS), true)
    GENERATE_DOCS=false
  endif
  ifeq ($(GENERATE_DOCS),false)
    NO_DOCS=true
  endif
else
  GENERATE_DOCS=false
endif

D
duke 已提交
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
# Output directory for hotspot build
HOTSPOT_DIR = $(ABS_OUTPUTDIR)/hotspot

# If we are building components
ifndef ALT_LANGTOOLS_DIST
  LANGTOOLS_OUTPUTDIR = $(ABS_OUTPUTDIR)/langtools
  ABS_LANGTOOLS_DIST = $(LANGTOOLS_OUTPUTDIR)/dist
endif
ifndef ALT_CORBA_DIST
  CORBA_OUTPUTDIR = $(ABS_OUTPUTDIR)/corba
  ABS_CORBA_DIST = $(CORBA_OUTPUTDIR)/dist
endif
ifndef ALT_JAXP_DIST
  JAXP_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxp
  ABS_JAXP_DIST = $(JAXP_OUTPUTDIR)/dist
endif
ifndef ALT_JAXWS_DIST
  JAXWS_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxws
  ABS_JAXWS_DIST = $(JAXWS_OUTPUTDIR)/dist
endif

# Common make arguments (supplied to all component builds)
COMMON_BUILD_ARGUMENTS = \
    JDK_TOPDIR=$(ABS_JDK_TOPDIR) \
    JDK_MAKE_SHARED_DIR=$(ABS_JDK_TOPDIR)/make/common/shared \
    EXTERNALSANITYCONTROL=true \
317
    SOURCE_LANGUAGE_VERSION=$(SOURCE_LANGUAGE_VERSION) \
D
duke 已提交
318 319 320 321 322 323 324 325 326 327
    TARGET_CLASS_VERSION=$(TARGET_CLASS_VERSION) \
    MILESTONE=$(MILESTONE) \
    BUILD_NUMBER=$(BUILD_NUMBER) \
    JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER) \
    FULL_VERSION=$(FULL_VERSION) \
    PREVIOUS_JDK_VERSION=$(PREVIOUS_JDK_VERSION) \
    JDK_VERSION=$(JDK_VERSION) \
    JDK_MKTG_VERSION=$(JDK_MKTG_VERSION) \
    JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) \
    JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) \
328 329 330 331
    JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) \
    PREVIOUS_MAJOR_VERSION=$(PREVIOUS_MAJOR_VERSION) \
    PREVIOUS_MINOR_VERSION=$(PREVIOUS_MINOR_VERSION) \
    PREVIOUS_MICRO_VERSION=$(PREVIOUS_MICRO_VERSION)
D
duke 已提交
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356

ifdef ARCH_DATA_MODEL
  COMMON_BUILD_ARGUMENTS += ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)
endif

ifeq ($(DEBUG_NAME), debug)
  COMMON_BUILD_ARGUMENTS += VARIANT=DBG DEBUG_CLASSFILES=true
endif

ifeq ($(DEBUG_NAME), fastdebug)
  COMMON_BUILD_ARGUMENTS += VARIANT=DBG FASTDEBUG=true DEBUG_CLASSFILES=true
endif

ifdef COOKED_JDK_UPDATE_VERSION
  COMMON_BUILD_ARGUMENTS += COOKED_JDK_UPDATE_VERSION=$(COOKED_JDK_UPDATE_VERSION)
endif

ifdef COOKED_BUILD_NUMBER
  COMMON_BUILD_ARGUMENTS += COOKED_BUILD_NUMBER=$(COOKED_BUILD_NUMBER)
endif

ifdef ANT_HOME
  COMMON_BUILD_ARGUMENTS += ANT_HOME="$(ANT_HOME)"
endif