Makefile 20.2 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 2005, 2012, 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.
D
duke 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#  
#

# Top level gnumake file for hotspot builds
#
# Default is to build the both product images and construct an export dir.
#  The default export directory name is `pwd`/export-$(PLATFORM).
#
#   Use: 'gnumake help' for more information.
#
# This makefile uses the default settings for where to find compilers and
#    tools, and obeys the ALT_* variable settings used by the other JDK
#    workspaces.
#

# Expected/optional make variables defined on make command line:
#  LP64=1 or ARCH_DATA_MODEL=64 for 64bit build
#
# Expected/optional make variables or environment variables:
#  ALT_SLASH_JAVA             Location of /java or J:
#  ALT_BOOTDIR                Previous JDK home directory for javac compiler
#  ALT_OUTPUTDIR              Output directory to use for hotspot build
#  ALT_EXPORT_PATH            Directory to export hotspot build to
#  ALT_JDK_IMPORT_PATH        Current JDK build (only for create_jdk rules)
46
#  ALT_JDK_TARGET_IMPORT_PATH Current JDK build when cross-compiling
D
duke 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
#  ALT_BUILD_WIN_SA           Building SA on Windows is disabled by default.
#                             Set ALT_BUILD_WIN_SA=1 to enable building SA on
#                             Windows.
# Version strings and numbers:
#  JDK_VERSION                Current JDK version (e.g. 1.6.0)
#  PREVIOUS_JDK_VERSION       Previous (bootdir) JDK version (e.g. 1.5.0)
#  FULL_VERSION               Full version string to use (e.g. "1.6.0-ea-b42")
#
# Version strings and numbers especially needed on Windows:
#  COOKED_JDK_UPDATE_VERSION  Just the update release number (e.g. 02)
#  COOKED_BUILD_NUMBER        Just the build number (e.g. 42)
#  JDK_MKTG_VERSION           Marketing JDK version (e.g. 6.0)
#  JDK_MAJOR_VERSION          Major number for version (e.g. 1) always 1?
#  JDK_MINOR_VERSION          Minor number for version (e.g. 6)
#  JDK_MICRO_VERSION          Micro number for version (e.g. 0)
#

# Default is build both product fastdebug and create export area

# Allow to build HotSpot in local directory from sources specified by GAMMADIR.
# After make/defs.make GAMMADIR is defined.
ifdef GAMMADIR
  ifndef ALT_OUTPUTDIR
    ALT_OUTPUTDIR := $(shell pwd)
  endif
  include $(GAMMADIR)/make/defs.make
else
  include defs.make
endif

77
include $(GAMMADIR)/make/altsrc.make
D
duke 已提交
78 79 80 81 82 83 84 85 86 87 88

ifneq ($(ALT_OUTPUTDIR),)
  ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR)
else
  ALT_OUT=
endif

# Typical C1/C2 targets made available with this Makefile
C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1
C2_VM_TARGETS=product  fastdebug  optimized  jvmg
KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel
89
ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero
90
SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark jvmgshark
D
duke 已提交
91

92 93 94 95
COMMON_VM_PRODUCT_TARGETS=product product1 productkernel docs export_product
COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
COMMON_VM_DEBUG_TARGETS=jvmg jvmg1 jvmgkernel docs export_debug

96 97 98
# JDK directory list
JDK_DIRS=bin include jre lib demo

D
duke 已提交
99
all:           all_product all_fastdebug
100 101

ifdef BUILD_CLIENT_ONLY
102 103 104
all_product:   product1 docs export_product
all_fastdebug: fastdebug1 docs export_fastdebug
all_debug:     jvmg1 docs export_debug
105 106 107 108 109 110 111 112 113
else
ifeq ($(MACOSX_UNIVERSAL),true)
all_product:   universal_product
all_fastdebug: universal_fastdebug
all_debug:     universal_debug
else
all_product:   $(COMMON_VM_PRODUCT_TARGETS)
all_fastdebug: $(COMMON_VM_FASTDEBUG_TARGETS)
all_debug:     $(COMMON_VM_DEBUG_TARGETS)
114
endif
115 116
endif

D
duke 已提交
117 118
all_optimized: optimized optimized1 optimizedkernel docs export_optimized

119 120 121 122 123 124
allzero:           all_productzero all_fastdebugzero
all_productzero:   productzero docs export_product
all_fastdebugzero: fastdebugzero docs export_fastdebug
all_debugzero:     jvmgzero docs export_debug
all_optimizedzero: optimizedzero docs export_optimized

125 126 127 128 129 130
allshark:           all_productshark all_fastdebugshark
all_productshark:   productshark docs export_product
all_fastdebugshark: fastdebugshark docs export_fastdebug
all_debugshark:     jvmgshark docs export_debug
all_optimizedshark: optimizedshark docs export_optimized

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
# Do everything
world:         all create_jdk

# Build or export docs
docs:
ifeq ($(OSNAME),windows)
	@$(ECHO) "No docs ($(VM_TARGET)) for windows"
else
	$(CD) $(OUTPUTDIR); \
	    $(MAKE) -f $(ABS_OS_MAKEFILE) \
		      $(MAKE_ARGS) docs
endif

# Build variation of hotspot
$(C1_VM_TARGETS):
	$(CD) $(GAMMADIR)/make; \
	$(MAKE) VM_TARGET=$@ generic_build1 $(ALT_OUT)

$(C2_VM_TARGETS):
	$(CD) $(GAMMADIR)/make; \
	$(MAKE) VM_TARGET=$@ generic_build2 $(ALT_OUT)

$(KERNEL_VM_TARGETS):
	$(CD) $(GAMMADIR)/make; \
	$(MAKE) VM_TARGET=$@ generic_buildkernel $(ALT_OUT)

157 158 159 160
$(ZERO_VM_TARGETS):
	$(CD) $(GAMMADIR)/make; \
	$(MAKE) VM_TARGET=$@ generic_buildzero $(ALT_OUT)

161 162 163 164
$(SHARK_VM_TARGETS):
	$(CD) $(GAMMADIR)/make; \
	$(MAKE) VM_TARGET=$@ generic_buildshark $(ALT_OUT)

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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
# Build compiler1 (client) rule, different for platforms
generic_build1:
	$(MKDIR) -p $(OUTPUTDIR)
ifeq ($(OSNAME),windows)
  ifeq ($(ARCH_DATA_MODEL), 32)
	$(CD) $(OUTPUTDIR); \
	    $(NMAKE) -f $(ABS_OS_MAKEFILE) \
		      Variant=compiler1 \
                      WorkSpace=$(ABS_GAMMADIR) \
		      BootStrapDir=$(ABS_BOOTDIR) \
                      BuildUser=$(USERNAME) \
		      $(MAKE_ARGS) $(VM_TARGET:%1=%)
  else
	@$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
  endif
else
  ifeq ($(ARCH_DATA_MODEL), 32)
	$(CD) $(OUTPUTDIR); \
	    $(MAKE) -f $(ABS_OS_MAKEFILE) \
		      $(MAKE_ARGS) $(VM_TARGET)
  else
	@$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
  endif
endif

# Build compiler2 (server) rule, different for platforms
generic_build2:
	$(MKDIR) -p $(OUTPUTDIR)
ifeq ($(OSNAME),windows)
	$(CD) $(OUTPUTDIR); \
	    $(NMAKE) -f $(ABS_OS_MAKEFILE) \
		      Variant=compiler2 \
                      WorkSpace=$(ABS_GAMMADIR) \
		      BootStrapDir=$(ABS_BOOTDIR) \
                      BuildUser=$(USERNAME) \
		      $(MAKE_ARGS) $(VM_TARGET)
else
	$(CD) $(OUTPUTDIR); \
	    $(MAKE) -f $(ABS_OS_MAKEFILE) \
		      $(MAKE_ARGS) $(VM_TARGET)
endif

generic_buildkernel:
	$(MKDIR) -p $(OUTPUTDIR)
ifeq ($(OSNAME),windows)
  ifeq ($(ARCH_DATA_MODEL), 32)
	$(CD) $(OUTPUTDIR); \
	    $(NMAKE) -f $(ABS_OS_MAKEFILE) \
		      Variant=kernel \
                      WorkSpace=$(ABS_GAMMADIR) \
		      BootStrapDir=$(ABS_BOOTDIR) \
                      BuildUser=$(USERNAME) \
		      $(MAKE_ARGS) $(VM_TARGET:%kernel=%)
  else
	@$(ECHO) "No kernel ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
  endif
else
	@$(ECHO) "No kernel ($(VM_TARGET)) for OS_NAME=$(OSNAME)"
endif

225 226 227 228 229 230
generic_buildzero:
	$(MKDIR) -p $(OUTPUTDIR)
	$(CD) $(OUTPUTDIR); \
		$(MAKE) -f $(ABS_OS_MAKEFILE) \
			$(MAKE_ARGS) $(VM_TARGET)

231 232 233 234 235 236
generic_buildshark:
	$(MKDIR) -p $(OUTPUTDIR)
	$(CD) $(OUTPUTDIR); \
		$(MAKE) -f $(ABS_OS_MAKEFILE) \
			$(MAKE_ARGS) $(VM_TARGET) 

D
duke 已提交
237 238 239 240 241 242 243 244 245 246
# Export file rule
generic_export: $(EXPORT_LIST)
export_product:
	$(MAKE) VM_SUBDIR=product                            generic_export
export_fastdebug:
	$(MAKE) VM_SUBDIR=fastdebug EXPORT_SUBDIR=/fastdebug generic_export
export_debug:
	$(MAKE) VM_SUBDIR=${VM_DEBUG} EXPORT_SUBDIR=/debug   generic_export
export_optimized:
	$(MAKE) VM_SUBDIR=optimized EXPORT_SUBDIR=/optimized generic_export
247
export_product_jdk::
D
duke 已提交
248 249
	$(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
		VM_SUBDIR=product                            generic_export
250
export_optimized_jdk::
D
duke 已提交
251 252
	$(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
		VM_SUBDIR=optimized                          generic_export
253
export_fastdebug_jdk::
D
duke 已提交
254 255
	$(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/fastdebug \
		VM_SUBDIR=fastdebug                          generic_export
256
export_debug_jdk::
D
duke 已提交
257 258 259 260 261 262 263 264 265
	$(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/debug \
		VM_SUBDIR=${VM_DEBUG}                        generic_export

# Export file copy rules
XUSAGE=$(HS_SRC_DIR)/share/vm/Xusage.txt
DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs
C1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1
C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel
266
ZERO_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_zero
267
SHARK_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_shark
D
duke 已提交
268 269 270
C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR)
C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR)
KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR)
271
ZERO_DIR=$(ZERO_BASE_DIR)/$(VM_SUBDIR)
272
SHARK_DIR=$(SHARK_BASE_DIR)/$(VM_SUBDIR)
D
duke 已提交
273 274

# Misc files and generated files need to come from C1 or C2 area
275
ifeq ($(ZERO_BUILD), true)
276 277 278 279
ifeq ($(SHARK_BUILD), true)
  MISC_DIR=$(SHARK_DIR)
  GEN_DIR=$(SHARK_BASE_DIR)/generated
else
280 281
  MISC_DIR=$(ZERO_DIR)
  GEN_DIR=$(ZERO_BASE_DIR)/generated
282
endif
283
else
D
duke 已提交
284 285 286 287 288 289 290
ifeq ($(ARCH_DATA_MODEL), 32)
  MISC_DIR=$(C1_DIR)
  GEN_DIR=$(C1_BASE_DIR)/generated
else
  MISC_DIR=$(C2_DIR)
  GEN_DIR=$(C2_BASE_DIR)/generated
endif
291
endif
D
duke 已提交
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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334

# Bin files (windows)
ifeq ($(OSNAME),windows)

# Get jvm.lib 
$(EXPORT_LIB_DIR)/%.lib:  $(MISC_DIR)/%.lib
	$(install-file)

# Other libraries (like SA)
$(EXPORT_JRE_BIN_DIR)/%.dll: $(MISC_DIR)/%.dll
	$(install-file)
$(EXPORT_JRE_BIN_DIR)/%.pdb: $(MISC_DIR)/%.pdb
	$(install-file)
$(EXPORT_JRE_BIN_DIR)/%.map: $(MISC_DIR)/%.map
	$(install-file)

# Client files always come from C1 area
$(EXPORT_CLIENT_DIR)/%.dll:  $(C1_DIR)/%.dll
	$(install-file)
$(EXPORT_CLIENT_DIR)/%.pdb:  $(C1_DIR)/%.pdb
	$(install-file)
$(EXPORT_CLIENT_DIR)/%.map:  $(C1_DIR)/%.map
	$(install-file)

# Server files always come from C2 area
$(EXPORT_SERVER_DIR)/%.dll:  $(C2_DIR)/%.dll
	$(install-file)
$(EXPORT_SERVER_DIR)/%.pdb:  $(C2_DIR)/%.pdb
	$(install-file)
$(EXPORT_SERVER_DIR)/%.map:  $(C2_DIR)/%.map
	$(install-file)

# Kernel files always come from kernel area
$(EXPORT_KERNEL_DIR)/%.dll:  $(KERNEL_DIR)/%.dll
	$(install-file)
$(EXPORT_KERNEL_DIR)/%.pdb:  $(KERNEL_DIR)/%.pdb
	$(install-file)
$(EXPORT_KERNEL_DIR)/%.map:  $(KERNEL_DIR)/%.map
	$(install-file)
endif

# Shared Library
ifneq ($(OSNAME),windows)
335
  ifeq ($(ZERO_BUILD), true)
336
    ifeq ($(SHARK_BUILD), true)
N
never 已提交
337
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
338
	$(install-file)
N
never 已提交
339
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
340 341
	$(install-file)
    else
N
never 已提交
342
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
343
	$(install-file)
N
never 已提交
344
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
345
	$(install-file)
346
    endif
347
  else
N
never 已提交
348
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX)
349
	$(install-file)
N
never 已提交
350
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX)
D
duke 已提交
351
	$(install-file)
N
never 已提交
352
$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX):       $(C1_DIR)/%.$(LIBRARY_SUFFIX)
D
duke 已提交
353
	$(install-file)
N
never 已提交
354
$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX):    $(C1_DIR)/%.$(LIBRARY_SUFFIX)
D
duke 已提交
355
	$(install-file)
N
never 已提交
356
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(C2_DIR)/%.$(LIBRARY_SUFFIX)
D
duke 已提交
357
	$(install-file)
N
never 已提交
358
$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX):    $(C2_DIR)/%.$(LIBRARY_SUFFIX)
D
duke 已提交
359
	$(install-file)
360 361 362 363 364 365 366 367 368 369 370 371 372 373

# Debug info for shared library
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C1_DIR)/%.debuginfo
	$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C2_DIR)/%.debuginfo
	$(install-file)
$(EXPORT_CLIENT_DIR)/%.debuginfo:       $(C1_DIR)/%.debuginfo
	$(install-file)
$(EXPORT_CLIENT_DIR)/64/%.debuginfo:    $(C1_DIR)/%.debuginfo
	$(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo:       $(C2_DIR)/%.debuginfo
	$(install-file)
$(EXPORT_SERVER_DIR)/64/%.debuginfo:    $(C2_DIR)/%.debuginfo
	$(install-file)
374
  endif
D
duke 已提交
375 376 377 378 379 380
endif

# Jar file (sa-jdi.jar)
$(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
	$(install-file)

381 382 383
$(EXPORT_JRE_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
	$(install-file)

384
# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
D
duke 已提交
385 386 387
$(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
	$(install-file)

388 389 390
$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/%
	$(install-file)

D
duke 已提交
391 392 393
$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/%
	$(install-file)

394 395
HS_JNI_ARCH_SRC=$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h)
$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC)
D
duke 已提交
396 397 398 399 400
	$(install-file)

$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%
	$(install-file)

401 402 403 404 405 406 407 408 409
JFR_EXISTS=$(shell if [ -d $(HS_ALT_SRC) ]; then echo 1; else echo 0; fi)
# export jfr.h
ifeq ($JFR_EXISTS,1)
$(EXPORT_INCLUDE_DIR)/%: $(HS_ALT_SRC)/share/vm/jfr/agent/%
	$(install-file)
else
$(EXPORT_INCLUDE_DIR)/jfr.h:
endif

D
duke 已提交
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
# Doc files (jvmti.html)
$(EXPORT_DOCS_DIR)/platform/jvmti/%: $(DOCS_DIR)/%
	$(install-file)

# Xusage file
$(EXPORT_SERVER_DIR)/Xusage.txt $(EXPORT_CLIENT_DIR)/Xusage.txt $(EXPORT_KERNEL_DIR)/Xusage.txt: $(XUSAGE)
	$(prep-target)
	$(RM) $@.temp
	$(SED) 's/\(separated by \)[;:]/\1$(PATH_SEP)/g' $< > $@.temp
	$(MV) $@.temp $@

#
# Clean rules
#
clobber clean: clean_build clean_export clean_jdk
clean_build:
	$(RM) -r $(C1_DIR)
	$(RM) -r $(C2_DIR)
	$(RM) -r $(KERNEL_DIR)
429
	$(RM) -r $(ZERO_DIR)
430
	$(RM) -r $(SHARK_DIR)
D
duke 已提交
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
clean_export:
	$(RM) -r $(EXPORT_PATH)
clean_jdk:
	$(RM) -r $(JDK_IMAGE_DIR)

#
# Create JDK and place this build into it
#
create_jdk: copy_jdk update_jdk

update_jdk: export_product_jdk export_fastdebug_jdk test_jdk

copy_jdk: $(JDK_IMAGE_DIR)/jre/lib/rt.jar

$(JDK_IMAGE_DIR)/jre/lib/rt.jar:
	$(RM) -r $(JDK_IMAGE_DIR)
	$(MKDIR) -p $(JDK_IMAGE_DIR)
	($(CD) $(JDK_IMPORT_PATH) && \
	 $(TAR) -cf - *) | \
	 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -)

test_jdk:
453
    ifeq ($(ARCH_DATA_MODEL), 32)
454 455 456 457 458 459 460 461 462 463
      ifneq ($(ZERO_BUILD), true)
	$(JDK_IMAGE_DIR)/bin/java -d32 -client -Xinternalversion
	$(JDK_IMAGE_DIR)/bin/java -d32 -client -version
      endif
	$(JDK_IMAGE_DIR)/bin/java -d32 -server -Xinternalversion
	$(JDK_IMAGE_DIR)/bin/java -d32 -server -version
    endif
    ifeq ($(ARCH_DATA_MODEL), 64)
	$(JDK_IMAGE_DIR)/bin/java -d64 -server -Xinternalversion
	$(JDK_IMAGE_DIR)/bin/java -d64 -server -version
464
    endif
D
duke 已提交
465

466
copy_product_jdk::
D
duke 已提交
467 468 469
	$(RM) -r $(JDK_IMAGE_DIR)
	$(MKDIR) -p $(JDK_IMAGE_DIR)
	($(CD) $(JDK_IMPORT_PATH) && \
470
	 $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
471 472
	 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -)

473
copy_fastdebug_jdk::
D
duke 已提交
474 475 476 477
	$(RM) -r $(JDK_IMAGE_DIR)/fastdebug
	$(MKDIR) -p $(JDK_IMAGE_DIR)/fastdebug
	if [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \
	  ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \
478
	   $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
479 480 481
	   ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \
	else \
	  ($(CD) $(JDK_IMPORT_PATH) && \
482
	   $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
483 484 485
	   ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \
	fi

486
copy_debug_jdk::
D
duke 已提交
487 488 489 490
	$(RM) -r $(JDK_IMAGE_DIR)/debug
	$(MKDIR) -p $(JDK_IMAGE_DIR)/debug
	if [ -d $(JDK_IMPORT_PATH)/debug ] ; then \
	  ($(CD) $(JDK_IMPORT_PATH)/debug && \
491
	   $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
492 493 494
	   ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
	elif [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \
	  ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \
495
	   $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
496 497 498
	   ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
	else \
	  ($(CD) $(JDK_IMPORT_PATH) && \
499
	   $(TAR) -cf - $(JDK_DIRS)) | \
D
duke 已提交
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
	   ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
	fi

#
# Check target
#
check: variable_check

#
# Help target
#
help: intro_help target_help variable_help notes_help examples_help

# Intro help message
intro_help:
	@$(ECHO) \
"Makefile for the Hotspot workspace." 
	@$(ECHO) \
"Default behavior is to build and create an export area for the j2se builds."

# Target help
target_help:
	@$(ECHO) "help:             This help message"
	@$(ECHO) "all:              Same as: all_product all_fastdebug"
	@$(ECHO) "world:            Same as: all create_jdk"
	@$(ECHO) "all_product:      Same as: product product1 export_product"
	@$(ECHO) "all_fastdebug:    Same as: fastdebug fastdebug1 export_fastdebug"
	@$(ECHO) "all_debug:        Same as: jvmg jvmg1 export_debug"
	@$(ECHO) "all_optimized:    Same as: optimized optimized1 export_optimized"
	@$(ECHO) "clean:            Clean all areas"
	@$(ECHO) "export_product:   Export product files to EXPORT_PATH"
	@$(ECHO) "export_fastdebug: Export fastdebug files to EXPORT_PATH"
	@$(ECHO) "export_debug:     Export debug files to EXPORT_PATH"
	@$(ECHO) "export_optimized: Export optimized files to EXPORT_PATH"
	@$(ECHO) "create_jdk:       Create JDK image, export all files into it"
	@$(ECHO) "update_jdk:       Update JDK image with fresh exported files"
	@$(ECHO) " "
	@$(ECHO) "Others targets are:"
	@$(ECHO) "   $(C1_VM_TARGETS)"
	@$(ECHO) "   $(C2_VM_TARGETS)"
	@$(ECHO) "   $(KERNEL_VM_TARGETS)"

# Variable help (only common ones used by this workspace)
variable_help: variable_help_intro variable_list variable_help_end
variable_help_intro:
	@$(ECHO) "--- Common Variables ---"
variable_help_end:
	@$(ECHO) " "
	@$(ECHO) "--- Make Arguments ---"
	@$(ECHO) "MAKE_ARGS=$(MAKE_ARGS)"

# One line descriptions for the variables
SLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
OUTPUTDIR.desc             = Output directory, default is build/<osname>
BOOTDIR.desc               = JDK used to compile agent java source and test with
JDK_IMPORT_PATH.desc       = Promoted JDK to copy for 'create_jdk'
556
JDK_IMAGE_DIR.desc         = Directory to place JDK to copy
D
duke 已提交
557 558 559 560 561 562 563 564
EXPORT_PATH.desc           = Directory to place files to export for JDK build

# Make variables to print out (description and value)
VARIABLE_PRINTVAL_LIST +=       \
    SLASH_JAVA                  \
    OUTPUTDIR                   \
    BOOTDIR                     \
    JDK_IMPORT_PATH             \
565
    JDK_IMAGE_DIR               \
D
duke 已提交
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
    EXPORT_PATH

# Make variables that should refer to directories that exist
VARIABLE_CHECKDIR_LIST +=       \
    SLASH_JAVA                  \
    BOOTDIR                     \
    JDK_IMPORT_PATH

# For pattern rules below, so all are treated the same
DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)

# Complete variable check
variable_check: $(DO_CHECKDIR_LIST)
variable_list: $(DO_PRINTVAL_LIST) variable_check

# Pattern rule for printing out a variable
%.printval:
	@$(ECHO) "  ALT_$* - $($*.desc)"
	@$(ECHO) "        $*=$($*)"

# Pattern rule for checking to see if a variable with a directory exists
%.checkdir:
	@if [ ! -d $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Pattern rule for checking to see if a variable with a file exists
%.checkfil:
	@if [ ! -f $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Misc notes on help
notes_help:
	@$(ECHO) \
"--- Notes --- "
	@$(ECHO) \
"- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted"
	@$(ECHO) \
"        builds or previous release JDK builds will work."
	@$(ECHO) \
"- The fastest builds have been when the workspace and the BOOTDIR are on"
	@$(ECHO) \
"        local disk."

examples_help:
	@$(ECHO) \
"--- Examples --- "
	@$(ECHO) \
"  $(MAKE) all"
	@$(ECHO) \
"  $(MAKE) world"
	@$(ECHO) \
"  $(MAKE) ALT_BOOTDIR=/opt/java/jdk$(PREVIOUS_JDK_VERSION)" 
	@$(ECHO) \
"  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk$(JDK_VERSION)"

624 625 626 627 628 629 630
# Universal build support
ifeq ($(OS_VENDOR), Darwin)
ifeq ($(MACOSX_UNIVERSAL),true)
include $(GAMMADIR)/make/$(OSNAME)/makefiles/universal.gmk
endif
endif

D
duke 已提交
631 632 633 634 635 636 637 638 639
# JPRT rule to build this workspace
include $(GAMMADIR)/make/jprt.gmk

.PHONY: all world clobber clean help $(C1_VM_TARGETS) $(C2_VM_TARGETS) \
        $(KERNEL_VM_TARGETS) \
	generic_build1 generic_build2 generic_buildkernel generic_export \
	export_product export_fastdebug export_debug export_optimized \
	export_jdk_product export_jdk_fastdebug export_jdk_debug \
	create_jdk copy_jdk update_jdk test_jdk \
640
	copy_product_jdk copy_fastdebug_jdk copy_debug_jdk