1 # 2 # Copyright (c) 2011, 2022, 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 # This is the main makefile containing most actual top level targets. It needs 28 # to be called with a SPEC file defined. 29 ################################################################################ 30 31 # Declare default target 32 default: 33 34 ifeq ($(wildcard $(SPEC)),) 35 $(error Main.gmk needs SPEC set to a proper spec.gmk) 36 endif 37 38 # Now load the spec 39 include $(SPEC) 40 41 # Load the vital tools for all the makefiles. 42 include $(TOPDIR)/make/common/MakeBase.gmk 43 include $(TOPDIR)/make/common/Modules.gmk 44 include $(TOPDIR)/make/common/FindTests.gmk 45 46 include $(TOPDIR)/make/MainSupport.gmk 47 48 # Are we requested to ignore dependencies? 49 ifneq ($(findstring -only, $(MAKECMDGOALS)), ) 50 DEPS := none 51 endif 52 53 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all 54 # valid top level targets. It's used to declare them all as PHONY and to 55 # generate the -only targets. 56 ALL_TARGETS := 57 58 # Hook to include the corresponding custom file, if present. 59 $(eval $(call IncludeCustomExtension, Main.gmk)) 60 61 # All modules for the current target platform. 62 ALL_MODULES := $(call FindAllModules) 63 64 ################################################################################ 65 ################################################################################ 66 # 67 # Recipes for all targets. Only recipes, dependencies are declared later. 68 # 69 ################################################################################ 70 71 ################################################################################ 72 # Interim/build tools targets, compiling tools used during the build 73 74 $(eval $(call SetupTarget, buildtools-langtools, \ 75 MAKEFILE := ToolsLangtools, \ 76 )) 77 78 $(eval $(call SetupTarget, interim-langtools, \ 79 MAKEFILE := CompileInterimLangtools, \ 80 )) 81 82 $(eval $(call SetupTarget, interim-tzdb, \ 83 MAKEFILE := CopyInterimTZDB, \ 84 )) 85 86 $(eval $(call SetupTarget, buildtools-jdk, \ 87 MAKEFILE := CompileToolsJdk, \ 88 DEPS := interim-langtools interim-tzdb, \ 89 )) 90 91 $(eval $(call SetupTarget, buildtools-modules, \ 92 MAKEFILE := CompileModuleTools, \ 93 )) 94 95 $(eval $(call SetupTarget, buildtools-hotspot, \ 96 MAKEFILE := CompileToolsHotspot, \ 97 )) 98 99 ################################################################################ 100 # Special targets for certain modules 101 102 $(eval $(call SetupTarget, generate-exported-symbols, \ 103 MAKEFILE := BuildStatic, \ 104 DEPS := java.base-libs jdk.jdwp.agent-libs, \ 105 )) 106 107 ################################################################################ 108 # Gensrc targets, generating source before java compilation can be done 109 # 110 $(eval $(call DeclareRecipesForPhase, GENSRC, \ 111 TARGET_SUFFIX := gensrc-src, \ 112 FILE_PREFIX := Gensrc, \ 113 CHECK_MODULES := $(ALL_MODULES), \ 114 )) 115 116 $(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src)) 117 118 LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS)) 119 INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \ 120 $(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS)) 121 HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS)) 122 JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \ 123 $(HOTSPOT_GENSRC_TARGETS), $(GENSRC_TARGETS)) 124 125 GENSRC_MODULEINFO_MODULES := $(ALL_MODULES) 126 GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \ 127 $(GENSRC_MODULEINFO_MODULES)) 128 129 GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES) 130 GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \ 131 $(addsuffix -gensrc, $(GENSRC_MODULES))) 132 133 define DeclareModuleInfoRecipe 134 $1-gensrc-moduleinfo: 135 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 136 -f common/modules/GensrcModuleInfo.gmk MODULE=$1) 137 138 $1-gensrc: $1-gensrc-moduleinfo 139 endef 140 141 $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m))) 142 143 ALL_TARGETS += $(GENSRC_TARGETS) 144 145 ################################################################################ 146 # Generate data targets 147 $(eval $(call DeclareRecipesForPhase, GENDATA, \ 148 TARGET_SUFFIX := gendata, \ 149 FILE_PREFIX := Gendata, \ 150 CHECK_MODULES := $(ALL_MODULES), \ 151 )) 152 153 ALL_TARGETS += $(GENDATA_TARGETS) 154 155 ################################################################################ 156 # Copy files targets 157 $(eval $(call DeclareRecipesForPhase, COPY, \ 158 TARGET_SUFFIX := copy, \ 159 FILE_PREFIX := Copy, \ 160 CHECK_MODULES := $(ALL_MODULES), \ 161 )) 162 163 ALL_COPY_MODULES += $(COPY_MODULES) 164 ALL_COPY_TARGETS += $(COPY_TARGETS) 165 166 IMPORT_COPY_MODULES := $(call FindImportedModules) 167 IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES)) 168 ALL_COPY_MODULES += $(IMPORT_COPY_MODULES) 169 ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS) 170 171 define DeclareImportCopyRecipe 172 $1-copy: 173 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 174 -f CopyImportModules.gmk MODULE=$1) 175 endef 176 177 $(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m))) 178 179 ALL_TARGETS += $(ALL_COPY_TARGETS) 180 181 ################################################################################ 182 # Targets for compiling all java modules. 183 JAVA_MODULES := $(ALL_MODULES) 184 JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) 185 186 define DeclareCompileJavaRecipe 187 $1-java: 188 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 189 $(patsubst %,-I%/modules/$1,$(PHASE_MAKEDIRS)) \ 190 -f CompileJavaModules.gmk MODULE=$1) 191 endef 192 193 $(foreach m, $(JAVA_MODULES), $(eval $(call DeclareCompileJavaRecipe,$m))) 194 195 ALL_TARGETS += $(JAVA_TARGETS) 196 197 ################################################################################ 198 # Targets for compiling native libraries 199 $(eval $(call DeclareRecipesForPhase, LIBS, \ 200 TARGET_SUFFIX := libs, \ 201 FILE_PREFIX := Lib, \ 202 CHECK_MODULES := $(ALL_MODULES), \ 203 )) 204 205 ALL_TARGETS += $(LIBS_TARGETS) 206 207 ################################################################################ 208 # Targets for compiling static versions of certain native libraries. These do 209 # not end up in the jmods or the normal JDK image, but are instead bundled into 210 # a special deliverable. 211 $(eval $(call DeclareRecipesForPhase, STATIC_LIBS, \ 212 TARGET_SUFFIX := static-libs, \ 213 FILE_PREFIX := Lib, \ 214 CHECK_MODULES := $(ALL_MODULES), \ 215 EXTRA_ARGS := STATIC_LIBS=true, \ 216 )) 217 218 ALL_TARGETS += $(STATIC_LIBS_TARGETS) 219 220 ################################################################################ 221 # Targets for compiling native executables 222 $(eval $(call DeclareRecipesForPhase, LAUNCHER, \ 223 TARGET_SUFFIX := launchers, \ 224 FILE_PREFIX := Launcher, \ 225 CHECK_MODULES := $(ALL_MODULES), \ 226 )) 227 228 ALL_TARGETS += $(LAUNCHER_TARGETS) 229 230 ################################################################################ 231 # Build hotspot target 232 233 HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS)) 234 HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS)) 235 HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS)) 236 237 define DeclareHotspotGensrcRecipe 238 hotspot-$1-gensrc: 239 $$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)') 240 +($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f gensrc/GenerateSources.gmk \ 241 JVM_VARIANT=$1) 242 endef 243 244 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v))) 245 246 define DeclareHotspotLibsRecipe 247 hotspot-$1-libs: 248 +($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \ 249 JVM_VARIANT=$1) 250 endef 251 252 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v))) 253 254 $(eval $(call SetupTarget, hotspot-ide-project, \ 255 MAKEFILE := ide/visualstudio/hotspot/CreateVSProject, \ 256 DEPS := hotspot exploded-image, \ 257 ARGS := -I$(TOPDIR)/make/hotspot, \ 258 )) 259 260 $(eval $(call SetupTarget, eclipse-java-env, \ 261 MAKEFILE := ide/eclipse/CreateWorkspace, \ 262 ARGS := --always-make WORKSPACE=java SHARED=false, \ 263 )) 264 265 $(eval $(call SetupTarget, eclipse-hotspot-env, \ 266 MAKEFILE := ide/eclipse/CreateWorkspace, \ 267 ARGS := --always-make WORKSPACE=hotspot SHARED=false, \ 268 )) 269 270 $(eval $(call SetupTarget, eclipse-native-env, \ 271 MAKEFILE := ide/eclipse/CreateWorkspace, \ 272 ARGS := --always-make WORKSPACE=native SHARED=false, \ 273 )) 274 275 $(eval $(call SetupTarget, eclipse-mixed-env, \ 276 MAKEFILE := ide/eclipse/CreateWorkspace, \ 277 ARGS := --always-make SHARED=false, \ 278 )) 279 280 $(eval $(call SetupTarget, eclipse-shared-java-env, \ 281 MAKEFILE := ide/eclipse/CreateWorkspace, \ 282 ARGS := --always-make WORKSPACE=java SHARED=true, \ 283 )) 284 285 $(eval $(call SetupTarget, eclipse-shared-hotspot-env, \ 286 MAKEFILE := ide/eclipse/CreateWorkspace, \ 287 ARGS := --always-make WORKSPACE=hotspot SHARED=true, \ 288 )) 289 290 $(eval $(call SetupTarget, eclipse-shared-native-env, \ 291 MAKEFILE := ide/eclipse/CreateWorkspace, \ 292 ARGS := --always-make WORKSPACE=native SHARED=true, \ 293 )) 294 295 $(eval $(call SetupTarget, eclipse-shared-mixed-env, \ 296 MAKEFILE := ide/eclipse/CreateWorkspace, \ 297 ARGS := --always-make SHARED=true, \ 298 )) 299 300 ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \ 301 $(HOTSPOT_VARIANT_LIBS_TARGETS) 302 303 ################################################################################ 304 # Help and user support 305 306 $(eval $(call SetupTarget, doctor, \ 307 MAKEFILE := Doctor, \ 308 )) 309 310 ################################################################################ 311 # Generate libs and launcher targets for creating compile_commands.json fragments 312 define DeclareCompileCommandsRecipe 313 $1-compile-commands: 314 $$(call LogInfo, Generating compile_commands.json fragments for $1) 315 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \ 316 GENERATE_COMPILE_COMMANDS_ONLY=true) 317 318 COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands 319 endef 320 321 $(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \ 322 $(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \ 323 ) 324 325 $(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \ 326 $(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \ 327 ) 328 329 $(eval $(call SetupTarget, compile-commands, \ 330 MAKEFILE := CompileCommands, \ 331 )) 332 333 $(eval $(call SetupTarget, compile-commands-hotspot, \ 334 MAKEFILE := CompileCommands, \ 335 )) 336 337 ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK) 338 339 ################################################################################ 340 # VS Code projects 341 342 $(eval $(call SetupTarget, vscode-project, \ 343 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \ 344 ARGS := VSCODE_INDEXER=cpptools, \ 345 DEPS := compile-commands, \ 346 )) 347 348 $(eval $(call SetupTarget, vscode-project-clangd, \ 349 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \ 350 ARGS := VSCODE_INDEXER=clangd, \ 351 DEPS := compile-commands, \ 352 )) 353 354 $(eval $(call SetupTarget, vscode-project-rtags, \ 355 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \ 356 ARGS := VSCODE_INDEXER=rtags, \ 357 DEPS := compile-commands, \ 358 )) 359 360 $(eval $(call SetupTarget, vscode-project-ccls, \ 361 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \ 362 ARGS := VSCODE_INDEXER=ccls, \ 363 DEPS := compile-commands, \ 364 )) 365 366 ################################################################################ 367 # Build demos targets 368 369 # The demos are currently linking to libjvm and libjava, just like all other 370 # jdk libs, even though they don't need to. To avoid warnings, make sure they 371 # aren't built until after libjava and libjvm are available to link to. 372 $(eval $(call SetupTarget, demos-jdk, \ 373 MAKEFILE := CompileDemos, \ 374 DEPS := java.base-libs exploded-image buildtools-jdk, \ 375 )) 376 377 $(eval $(call SetupTarget, test-image-demos-jdk, \ 378 MAKEFILE := CompileDemos, \ 379 TARGET := images, \ 380 DEPS := demos-jdk, \ 381 )) 382 383 ################################################################################ 384 # Jigsaw specific data and analysis targets. 385 386 $(eval $(call SetupTarget, generate-summary, \ 387 MAKEFILE := GenerateModuleSummary, \ 388 DEPS := jmods buildtools-modules runnable-buildjdk, \ 389 )) 390 391 ################################################################################ 392 # Jmod targets 393 394 JMOD_MODULES := $(ALL_MODULES) 395 JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES)) 396 397 define DeclareJmodRecipe 398 $1-jmod: 399 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 400 MODULE=$1) 401 endef 402 403 $(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m))) 404 405 ALL_TARGETS += $(JMOD_TARGETS) 406 407 ################################################################################ 408 # Images targets 409 410 $(eval $(call SetupTarget, store-source-revision, \ 411 MAKEFILE := SourceRevision, \ 412 TARGET := store-source-revision, \ 413 )) 414 415 $(eval $(call SetupTarget, create-source-revision-tracker, \ 416 MAKEFILE := SourceRevision, \ 417 TARGET := create-source-revision-tracker, \ 418 )) 419 420 BOOTCYCLE_TARGET := product-images 421 bootcycle-images: 422 ifneq ($(COMPILE_TYPE), cross) 423 $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image) 424 $(call MakeDir, $(OUTPUTDIR)/bootcycle-build) 425 +$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ 426 LOG_PREFIX="[bootcycle] " JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main 427 else 428 $(call LogWarn, Boot cycle build disabled when cross compiling) 429 endif 430 431 $(eval $(call SetupTarget, zip-security, \ 432 MAKEFILE := ZipSecurity, \ 433 DEPS := buildtools-jdk java.base-java java.security.jgss-java java.security.jgss-libs, \ 434 )) 435 436 $(eval $(call SetupTarget, zip-source, \ 437 MAKEFILE := ZipSource, \ 438 DEPS := buildtools-jdk gensrc, \ 439 )) 440 441 $(eval $(call SetupTarget, jrtfs-jar, \ 442 MAKEFILE := JrtfsJar, \ 443 DEPS := interim-langtools, \ 444 )) 445 446 $(eval $(call SetupTarget, jdk-image, \ 447 MAKEFILE := Images, \ 448 TARGET := jdk, \ 449 DEPS := jmods zip-source demos release-file, \ 450 )) 451 452 $(eval $(call SetupTarget, legacy-jre-image, \ 453 MAKEFILE := Images, \ 454 TARGET := jre, \ 455 DEPS := jmods release-file, \ 456 )) 457 458 $(eval $(call SetupTarget, symbols-image, \ 459 MAKEFILE := Images, \ 460 TARGET := symbols, \ 461 )) 462 463 $(eval $(call SetupTarget, static-libs-image, \ 464 MAKEFILE := StaticLibsImage, \ 465 )) 466 467 $(eval $(call SetupTarget, mac-jdk-bundle, \ 468 MAKEFILE := MacBundles, \ 469 TARGET := jdk-bundle, \ 470 DEPS := jdk-image, \ 471 )) 472 473 $(eval $(call SetupTarget, mac-legacy-jre-bundle, \ 474 MAKEFILE := MacBundles, \ 475 TARGET := jre-bundle, \ 476 DEPS := legacy-jre-image, \ 477 )) 478 479 $(eval $(call SetupTarget, release-file, \ 480 MAKEFILE := ReleaseFile, \ 481 DEPS := create-source-revision-tracker, \ 482 )) 483 484 $(eval $(call SetupTarget, exploded-image-optimize, \ 485 MAKEFILE := ExplodedImageOptimize, \ 486 DEPS := java copy gendata java.base-libs java.base-launchers \ 487 buildtools-modules, \ 488 )) 489 490 $(eval $(call SetupTarget, graal-builder-image, \ 491 MAKEFILE := GraalBuilderImage, \ 492 DEPS := jdk-image static-libs-image, \ 493 )) 494 495 ifeq ($(JCOV_ENABLED), true) 496 $(eval $(call SetupTarget, jcov-image, \ 497 MAKEFILE := Coverage, \ 498 TARGET := jcov-image, \ 499 DEPS := jdk-image, \ 500 )) 501 endif 502 503 ALL_TARGETS += bootcycle-images 504 505 ################################################################################ 506 # Docs targets 507 508 # If building full docs, to complete docs-*-api we need both the javadoc and 509 # graphs targets. 510 $(eval $(call SetupTarget, docs-jdk-api-javadoc, \ 511 MAKEFILE := Docs, \ 512 TARGET := docs-jdk-api-javadoc, \ 513 )) 514 515 $(eval $(call SetupTarget, docs-jdk-api-graphs, \ 516 MAKEFILE := Docs, \ 517 TARGET := docs-jdk-api-graphs, \ 518 DEPS := buildtools-modules runnable-buildjdk, \ 519 )) 520 521 $(eval $(call SetupTarget, docs-javase-api-javadoc, \ 522 MAKEFILE := Docs, \ 523 TARGET := docs-javase-api-javadoc, \ 524 )) 525 526 $(eval $(call SetupTarget, docs-javase-api-graphs, \ 527 MAKEFILE := Docs, \ 528 TARGET := docs-javase-api-graphs, \ 529 DEPS := buildtools-modules runnable-buildjdk, \ 530 )) 531 532 $(eval $(call SetupTarget, docs-reference-api-javadoc, \ 533 MAKEFILE := Docs, \ 534 TARGET := docs-reference-api-javadoc, \ 535 )) 536 537 $(eval $(call SetupTarget, docs-reference-api-graphs, \ 538 MAKEFILE := Docs, \ 539 TARGET := docs-reference-api-graphs, \ 540 DEPS := buildtools-modules runnable-buildjdk, \ 541 )) 542 543 # The gensrc steps for jdk.jdi create html spec files. 544 $(eval $(call SetupTarget, docs-jdk-specs, \ 545 MAKEFILE := Docs, \ 546 TARGET := docs-jdk-specs, \ 547 DEPS := buildtools-jdk jdk.jdi-gensrc docs-jdk-index, \ 548 )) 549 550 $(eval $(call SetupTarget, docs-jdk-index, \ 551 MAKEFILE := Docs, \ 552 TARGET := docs-jdk-index, \ 553 )) 554 555 $(eval $(call SetupTarget, docs-zip, \ 556 MAKEFILE := Docs, \ 557 TARGET := docs-zip, \ 558 DEPS := docs-jdk buildtools-jdk, \ 559 )) 560 561 $(eval $(call SetupTarget, docs-specs-zip, \ 562 MAKEFILE := Docs, \ 563 TARGET := docs-specs-zip, \ 564 DEPS := docs-jdk-specs buildtools-jdk, \ 565 )) 566 567 $(eval $(call SetupTarget, update-build-docs, \ 568 MAKEFILE := UpdateBuildDocs, \ 569 )) 570 571 $(eval $(call SetupTarget, update-x11wrappers, \ 572 MAKEFILE := UpdateX11Wrappers, \ 573 DEPS := java.base-copy buildtools-jdk, \ 574 )) 575 576 ifneq ($(HSDIS_BACKEND), none) 577 $(eval $(call SetupTarget, build-hsdis, \ 578 MAKEFILE := Hsdis, \ 579 TARGET := build, \ 580 )) 581 582 $(eval $(call SetupTarget, install-hsdis, \ 583 MAKEFILE := Hsdis, \ 584 TARGET := install, \ 585 DEPS := jdk-image, \ 586 )) 587 endif 588 589 ################################################################################ 590 # Cross compilation support 591 592 ifeq ($(CREATING_BUILDJDK), true) 593 # This target is only called by the recursive call below. 594 create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \ 595 java.base-copy jdk.jdeps-launchers 596 endif 597 598 BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink $(INTERIM_IMAGE_MODULES), \ 599 $(call FindTransitiveDepsForModule, $m) $m)) 600 601 $(eval $(call SetupTarget, create-buildjdk-interim-image, \ 602 MAKEFILE := Main, \ 603 TARGET := create-buildjdk-interim-image-helper, \ 604 ARGS := SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 605 HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 606 CREATING_BUILDJDK=true \ 607 LOG_PREFIX="[buildjdk] " \ 608 JAVA_MODULES="$(BUILDJDK_MODULES)", \ 609 )) 610 611 ################################################################################ 612 # The interim-image is a small jlinked image that is used to generate artifacts 613 # at build time for use when linking the real images. 614 615 INTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES)) 616 617 define DeclareInterimJmodRecipe 618 $1-interim-jmod: 619 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 620 MODULE=$1 \ 621 JMODS_DIR=$(INTERIM_JMODS_DIR) \ 622 JMODS_SUPPORT_DIR=$(INTERIM_JMODS_DIR)/support \ 623 INTERIM_JMOD=true \ 624 ) 625 endef 626 627 $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m))) 628 629 $(eval $(call SetupTarget, interim-image, \ 630 MAKEFILE := InterimImage, \ 631 )) 632 633 ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 634 $(eval $(call SetupTarget, generate-link-opt-data, \ 635 MAKEFILE := GenerateLinkOptData, \ 636 )) 637 endif 638 639 ################################################################################ 640 # Generate test names for all JTReg test groups 641 # 642 643 define DeclareRunTestRecipe 644 test-$1: 645 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \ 646 TEST="$1") 647 648 exploded-test-$1: 649 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \ 650 TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR)) 651 endef 652 653 # ALL_NAMED_TESTS is defined in FindTests.gmk 654 $(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t))) 655 ALL_TEST_TARGETS := $(addprefix test-, $(ALL_NAMED_TESTS)) 656 657 # We only support the "exploded-test-gtest" shortcut 658 ALL_EXPLODED_TESTS := gtest 659 ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-test-, $(ALL_EXPLODED_TESTS)) 660 661 ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS) 662 663 ################################################################################ 664 # Build tests and microbenchmarks 665 # 666 667 $(eval $(call SetupTarget, prepare-test-image, \ 668 MAKEFILE := TestImage, \ 669 TARGET := prepare-test-image, \ 670 )) 671 672 $(eval $(call SetupTarget, build-test-hotspot-jtreg-native, \ 673 MAKEFILE := test/JtregNativeHotspot, \ 674 TARGET := build-test-hotspot-jtreg-native, \ 675 DEPS := buildtools-jdk, \ 676 )) 677 678 $(eval $(call SetupTarget, test-image-hotspot-jtreg-native, \ 679 MAKEFILE := test/JtregNativeHotspot, \ 680 TARGET := test-image-hotspot-jtreg-native, \ 681 DEPS := build-test-hotspot-jtreg-native, \ 682 )) 683 684 $(eval $(call SetupTarget, build-test-jdk-jtreg-native, \ 685 MAKEFILE := test/JtregNativeJdk, \ 686 TARGET := build-test-jdk-jtreg-native, \ 687 DEPS := buildtools-jdk java.base-libs, \ 688 )) 689 690 $(eval $(call SetupTarget, test-image-jdk-jtreg-native, \ 691 MAKEFILE := test/JtregNativeJdk, \ 692 TARGET := test-image-jdk-jtreg-native, \ 693 DEPS := build-test-jdk-jtreg-native, \ 694 )) 695 696 # Native files needed by the testlib 697 $(eval $(call SetupTarget, build-test-lib-native, \ 698 MAKEFILE := test/BuildTestLibNative, \ 699 TARGET := build-test-lib-native, \ 700 DEPS := buildtools-jdk java.base-libs, \ 701 )) 702 703 $(eval $(call SetupTarget, test-image-lib-native, \ 704 MAKEFILE := test/BuildTestLibNative, \ 705 TARGET := test-image-lib-native, \ 706 DEPS := build-test-lib-native, \ 707 )) 708 709 # Native files needed when testing the testlib itself 710 $(eval $(call SetupTarget, build-test-libtest-jtreg-native, \ 711 MAKEFILE := test/JtregNativeLibTest, \ 712 TARGET := build-test-libtest-jtreg-native, \ 713 DEPS := buildtools-jdk, \ 714 )) 715 716 $(eval $(call SetupTarget, test-image-libtest-jtreg-native, \ 717 MAKEFILE := test/JtregNativeLibTest, \ 718 TARGET := test-image-libtest-jtreg-native, \ 719 DEPS := build-test-libtest-jtreg-native, \ 720 )) 721 722 ifneq ($(GTEST_FRAMEWORK_SRC), ) 723 $(eval $(call SetupTarget, test-image-hotspot-gtest, \ 724 MAKEFILE := hotspot/test/GtestImage, \ 725 DEPS := hotspot, \ 726 )) 727 endif 728 729 $(eval $(call SetupTarget, build-test-lib, \ 730 MAKEFILE := test/BuildTestLib, \ 731 DEPS := exploded-image, \ 732 )) 733 734 ifeq ($(BUILD_FAILURE_HANDLER), true) 735 # Builds the failure handler jtreg extension 736 $(eval $(call SetupTarget, build-test-failure-handler, \ 737 MAKEFILE := test/BuildFailureHandler, \ 738 TARGET := build, \ 739 DEPS := interim-langtools, \ 740 )) 741 742 # Copies the failure handler jtreg extension into the test image 743 $(eval $(call SetupTarget, test-image-failure-handler, \ 744 MAKEFILE := test/BuildFailureHandler, \ 745 TARGET := images, \ 746 DEPS := build-test-failure-handler, \ 747 )) 748 endif 749 750 ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true) 751 # Builds the test thread factory jtreg extension 752 $(eval $(call SetupTarget, build-test-test-thread-factory, \ 753 MAKEFILE := test/BuildJtregTestThreadFactory, \ 754 TARGET := build, \ 755 DEPS := interim-langtools, \ 756 )) 757 758 # Copies the jtreg test thread factory into the test image 759 $(eval $(call SetupTarget, test-image-test-thread-factory, \ 760 MAKEFILE := test/BuildJtregTestThreadFactory, \ 761 TARGET := images, \ 762 DEPS := build-test-test-thread-factory, \ 763 )) 764 endif 765 766 $(eval $(call SetupTarget, build-microbenchmark, \ 767 MAKEFILE := test/BuildMicrobenchmark, \ 768 DEPS := interim-langtools exploded-image, \ 769 )) 770 771 ################################################################################ 772 # Run tests 773 774 $(eval $(call SetupTarget, test, \ 775 MAKEFILE := RunTests, \ 776 ARGS := TEST="$(TEST)", \ 777 DEPS := jdk-image test-image, \ 778 )) 779 780 $(eval $(call SetupTarget, exploded-test, \ 781 MAKEFILE := RunTests, \ 782 ARGS := TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR), \ 783 DEPS := exploded-image test-image, \ 784 )) 785 786 ifeq ($(JCOV_ENABLED), true) 787 $(eval $(call SetupTarget, jcov-test, \ 788 MAKEFILE := RunTests, \ 789 ARGS := TEST="$(TEST)" TEST_OPTS_JCOV=true, \ 790 DEPS := jcov-image test-image, \ 791 )) 792 endif 793 794 ################################################################################ 795 # Bundles 796 797 $(eval $(call SetupTarget, product-bundles, \ 798 MAKEFILE := Bundles, \ 799 TARGET := product-bundles, \ 800 DEPS := product-images, \ 801 )) 802 803 $(eval $(call SetupTarget, legacy-bundles, \ 804 MAKEFILE := Bundles, \ 805 TARGET := legacy-bundles, \ 806 DEPS := legacy-images, \ 807 )) 808 809 $(eval $(call SetupTarget, test-bundles, \ 810 MAKEFILE := Bundles, \ 811 TARGET := test-bundles, \ 812 DEPS := test-image, \ 813 )) 814 815 $(eval $(call SetupTarget, docs-jdk-bundles, \ 816 MAKEFILE := Bundles, \ 817 TARGET := docs-jdk-bundles, \ 818 DEPS := docs-image, \ 819 )) 820 821 $(eval $(call SetupTarget, docs-javase-bundles, \ 822 MAKEFILE := Bundles, \ 823 TARGET := docs-javase-bundles, \ 824 DEPS := docs-javase-image, \ 825 )) 826 827 $(eval $(call SetupTarget, docs-reference-bundles, \ 828 MAKEFILE := Bundles, \ 829 TARGET := docs-reference-bundles, \ 830 DEPS := docs-reference-image, \ 831 )) 832 833 $(eval $(call SetupTarget, static-libs-bundles, \ 834 MAKEFILE := Bundles, \ 835 TARGET := static-libs-bundles, \ 836 DEPS := static-libs-image, \ 837 )) 838 839 ifeq ($(JCOV_ENABLED), true) 840 $(eval $(call SetupTarget, jcov-bundles, \ 841 MAKEFILE := Bundles, \ 842 TARGET := jcov-bundles, \ 843 DEPS := jcov-image, \ 844 )) 845 endif 846 847 ################################################################################ 848 # Install targets 849 850 $(eval $(call SetupTarget, install, \ 851 MAKEFILE := Install, \ 852 DEPS := product-images, \ 853 )) 854 855 ################################################################################ 856 # 857 # Dependency declarations between targets. 858 # 859 # These are declared in two groups. First all dependencies between targets that 860 # have recipes above as these dependencies may be disabled. Then the aggregator 861 # targets that do not have recipes of their own, which will never have their 862 # dependencies disabled. 863 # 864 ################################################################################ 865 # Targets with recipes above 866 867 # If running an *-only target, parallel execution and dependencies between 868 # recipe targets are disabled. This makes it possible to run a select set of 869 # recipe targets in order. It's the responsibility of the user to make sure 870 # all prerequisites are fulfilled. 871 ifeq ($(DEPS), none) 872 .NOTPARALLEL: 873 else 874 $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools 875 876 interim-langtools: $(INTERIM_LANGTOOLS_GENSRC_TARGETS) 877 878 $(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot 879 880 $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk 881 882 $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk 883 884 $(GENDATA_TARGETS): interim-langtools buildtools-jdk 885 886 $(JAVA_TARGETS): interim-langtools 887 888 # Declare dependencies between hotspot-<variant>* targets 889 $(foreach v, $(JVM_VARIANTS), \ 890 $(eval hotspot-$v-gensrc: java.base-copy buildtools-hotspot) \ 891 $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \ 892 ) 893 894 # If not already set, set the JVM variant target so that the JVM will be built. 895 JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs 896 JVM_MAIN_GENSRC_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc 897 898 # Building one JVM variant is enough to start building the other libs 899 $(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS) 900 901 # Static libs depend on hotspot gensrc 902 $(STATIC_LIBS_TARGETS): $(JVM_MAIN_GENSRC_TARGETS) 903 904 $(LAUNCHER_TARGETS): java.base-libs 905 906 ifeq ($(STATIC_BUILD), true) 907 $(LAUNCHER_TARGETS): generate-exported-symbols 908 endif 909 910 # Declare dependency from <module>-java to <module>-gensrc 911 $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) 912 913 # Declare dependencies between java modules 914 $(foreach m, $(JAVA_MODULES), \ 915 $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \ 916 $(call FindDepsForModule,$m))))) 917 # Declare dependencies between the module meta targets 918 $(foreach m, $(ALL_MODULES), $(eval $m: $(call FindDepsForModule,$m))) 919 920 # Declare dependencies from <module>-lib to <module>-java 921 # Skip modules that do not have java source. 922 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java)) 923 924 # Declare dependencies from all other <module>-lib to java.base-lib 925 $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \ 926 $(eval $t: java.base-libs)) 927 928 ifeq ($(ENABLE_HSDIS_BUNDLING), true) 929 java.base-copy: build-hsdis 930 endif 931 932 # jdk.accessibility depends on java.desktop 933 jdk.accessibility-libs: java.desktop-libs 934 935 # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 936 # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a 937 # virtual target. 938 jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc 939 940 # jdk.jfr-gendata uses TOOL_JFR_GEN from buildtools-hotspot 941 jdk.jfr-gendata: buildtools-hotspot 942 943 # The swing beans need to have java base properly generated to avoid errors 944 # in javadoc. The X11 wrappers need the java.base include files to have been 945 # copied and processed. 946 java.desktop-gensrc-src: java.base-gensrc java.base-copy 947 948 jdk.jdeps-gendata: java 949 950 # The ct.sym generation uses all the moduleinfos as input 951 jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS) 952 953 # Declare dependencies between jmod targets. 954 # java.base jmod needs jrt-fs.jar and access to the other jmods to be built. 955 # When creating the BUILDJDK, we don't need to add hashes to java.base, thus 956 # we don't need to depend on all other jmods 957 ifneq ($(CREATING_BUILDJDK), true) 958 java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS)) 959 endif 960 961 # If not already set, set the JVM target so that the JVM will be built. 962 JVM_MAIN_TARGETS ?= hotspot 963 964 # Building java.base-jmod requires all of VM (ie hotspot) to be built. 965 java.base-jmod: $(JVM_MAIN_TARGETS) 966 967 # Declare dependencies from <module>-jmod to all other module targets 968 $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java)) 969 $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata)) 970 $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs)) 971 $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers)) 972 $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy)) 973 $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS))) 974 $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS))) 975 976 # Setup the minimal set of generated native source dependencies for hotspot 977 $(foreach v, $(JVM_VARIANTS), \ 978 $(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \ 979 $(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \ 980 $(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \ 981 ) 982 983 # For the full JDK compile commands, create all possible generated sources 984 $(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc)) 985 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java)) 986 987 $(COMPILE_COMMANDS_TARGETS_HOTSPOT): clean-compile-commands 988 $(COMPILE_COMMANDS_TARGETS_JDK): clean-compile-commands 989 compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) 990 compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK) 991 992 # The -static-libs targets depend on -java as well as java.base-copy. 993 $(foreach m, $(filter $(JAVA_MODULES), $(STATIC_LIBS_MODULES)), \ 994 $(eval $m-static-libs: $m-java java.base-copy)) 995 996 # Jmods cannot be created until we have the jmod tool ready to run. During 997 # a normal build we run it from the exploded image, but when cross compiling 998 # it's run from the buildjdk, which is either created at build time or user 999 # supplied. 1000 ifeq ($(CREATE_BUILDJDK), true) 1001 ifneq ($(CREATING_BUILDJDK), true) 1002 # When cross compiling and buildjdk is to be created, simply depend on 1003 # creating the buildjdk. 1004 $(JMOD_TARGETS): create-buildjdk 1005 buildtools-modules: create-buildjdk 1006 else 1007 # While actually creating the buildjdk, we need to list the bare 1008 # minimum dependencies needed before running jmod, to avoid building 1009 # more than necessary. This includes: 1010 # * all java modules 1011 # * jdk.jlink-launchers 1012 # * copy jvm.cfg (done in java.base-copy) 1013 # * tzdb.dat (done in java.base-gendata) 1014 # Without all of these jimage, jlink and jmod won't start. 1015 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): java.base-libs java.base-copy \ 1016 java.base-gendata jdk.jlink-launchers java 1017 endif 1018 else ifeq ($(EXTERNAL_BUILDJDK), false) 1019 # The normal non cross compilation usecase needs to wait for the full 1020 # exploded-image to avoid a race with the optimize target. 1021 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): exploded-image 1022 # The buildtools-modules are used for the exploded-image-optimize target, 1023 # but can be built either using the exploded-image or an external BUILDJDK. 1024 buildtools-modules: exploded-image-base 1025 endif 1026 1027 # All modules include the main license files from java.base. 1028 $(JMOD_TARGETS): java.base-copy 1029 1030 zip-security: $(filter jdk.crypto%, $(JAVA_TARGETS)) 1031 1032 ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 1033 ifeq ($(CREATE_BUILDJDK), true) 1034 # If creating a buildjdk, the interim image needs to be based on that. 1035 generate-link-opt-data: create-buildjdk 1036 else ifeq ($(EXTERNAL_BUILDJDK), false) 1037 # If an external buildjdk has been provided, we skip generating an 1038 # interim-image and just use the external buildjdk for generating 1039 # classlist. 1040 generate-link-opt-data: interim-image 1041 endif 1042 generate-link-opt-data: buildtools-jdk 1043 1044 # The generated classlist needs to go into java.base-jmod. 1045 java.base-jmod jdk.jlink-jmod jdk-image legacy-jre-image: generate-link-opt-data 1046 endif 1047 1048 symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS) 1049 1050 static-libs-image: $(STATIC_LIBS_TARGETS) 1051 1052 bootcycle-images: jdk-image 1053 1054 docs-jdk-api-javadoc: $(GENSRC_TARGETS) 1055 1056 docs-javase-api-javadoc: $(GENSRC_TARGETS) 1057 1058 docs-reference-api-javadoc: $(GENSRC_TARGETS) 1059 1060 # If not already set, then set the JVM specific docs targets 1061 JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc 1062 1063 # The gensrc steps for hotspot create html spec files. 1064 docs-jdk-specs: $(JVM_DOCS_TARGETS) 1065 1066 # Tests 1067 test-make: clean-test-make compile-commands 1068 1069 test-make-compile-commands: compile-commands 1070 1071 # Declare dependency for all generated test targets 1072 $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image)) 1073 $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image)) 1074 1075 interim-image: $(INTERIM_JMOD_TARGETS) 1076 1077 build-test-hotspot-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs 1078 build-test-libtest-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs 1079 1080 endif 1081 1082 ################################################################################ 1083 # Virtual targets without recipes 1084 1085 # If not already set, set the JVM specific tools targets 1086 JVM_TOOLS_TARGETS ?= buildtools-hotspot 1087 buildtools: buildtools-langtools interim-langtools \ 1088 buildtools-jdk $(JVM_TOOLS_TARGETS) 1089 1090 # Declare dependencies from hotspot-<variant> targets 1091 $(foreach v, $(JVM_VARIANTS), \ 1092 $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \ 1093 ) 1094 hotspot: $(HOTSPOT_VARIANT_TARGETS) 1095 1096 # Create targets hotspot-libs and hotspot-gensrc. 1097 $(foreach v, $(JVM_VARIANTS), \ 1098 $(eval hotspot-libs: hotspot-$v-libs) \ 1099 $(eval hotspot-gensrc: hotspot-$v-gensrc) \ 1100 ) 1101 1102 gensrc: $(GENSRC_TARGETS) 1103 1104 gendata: $(GENDATA_TARGETS) 1105 1106 copy: $(ALL_COPY_TARGETS) 1107 1108 java: $(JAVA_TARGETS) 1109 1110 libs: $(LIBS_TARGETS) 1111 1112 static-libs: $(STATIC_LIBS_TARGETS) 1113 1114 launchers: $(LAUNCHER_TARGETS) 1115 1116 jmods: $(JMOD_TARGETS) 1117 1118 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which 1119 # is actually handled by jdk.jdi-gensrc 1120 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc 1121 1122 # Declare dependencies from <module> to all the individual targets specific 1123 # to that module <module>-*, that are needed for the exploded image. 1124 $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc)) 1125 $(foreach m, $(JAVA_MODULES), $(eval $m: $m-java)) 1126 $(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata)) 1127 $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) 1128 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) 1129 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) 1130 1131 # Building java.base includes building all of hotspot. 1132 java.base: $(JVM_MAIN_TARGETS) 1133 1134 demos: demos-jdk 1135 1136 # The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk. 1137 exploded-image-base: $(ALL_MODULES) 1138 exploded-image: exploded-image-base release-file 1139 # When cross compiling, no need to optimize the exploded image since it won't 1140 # be runnable on the host platform anyway. 1141 ifneq ($(COMPILE_TYPE), cross) 1142 exploded-image: exploded-image-optimize 1143 endif 1144 1145 # The runnable-buildjdk target guarantees that the buildjdk is done 1146 # building and ready to be used. The exact set of dependencies it needs 1147 # depends on what kind of buildjdk is used for the current configuration. 1148 runnable-buildjdk: 1149 ifeq ($(CREATE_BUILDJDK), true) 1150 ifneq ($(CREATING_BUILDJDK), true) 1151 runnable-buildjdk: create-buildjdk 1152 endif 1153 else ifeq ($(EXTERNAL_BUILDJDK), false) 1154 runnable-buildjdk: exploded-image 1155 endif 1156 1157 create-buildjdk: create-buildjdk-interim-image 1158 1159 docs-jdk-api: docs-jdk-api-javadoc 1160 docs-javase-api: docs-javase-api-javadoc 1161 docs-reference-api: docs-reference-api-javadoc 1162 1163 # If we're building full docs, we must also generate the module graphs to 1164 # get non-broken api documentation. 1165 ifeq ($(ENABLE_FULL_DOCS), true) 1166 docs-jdk-api: docs-jdk-api-graphs 1167 docs-javase-api: docs-javase-api-graphs 1168 docs-reference-api: docs-reference-api-graphs 1169 1170 # We must generate javadoc first so we know what graphs are needed 1171 docs-jdk-api-graphs: docs-jdk-api-javadoc 1172 docs-javase-api-graphs: docs-javase-api-javadoc 1173 docs-reference-api-graphs: docs-reference-api-javadoc 1174 endif 1175 1176 docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index 1177 docs-javase: docs-javase-api 1178 docs-reference: docs-reference-api 1179 1180 # alias for backwards compatibility 1181 docs-javadoc: docs-jdk-api 1182 1183 mac-bundles: mac-jdk-bundle 1184 1185 # The $(OUTPUTDIR)/images directory contain the resulting deliverables, 1186 # and in line with this, our targets for creating these are named *-image[s]. 1187 1188 # This target builds the product images, e.g. the JDK image 1189 # (and possibly other, more specific versions) 1190 product-images: jdk-image symbols-image exploded-image 1191 1192 # This target builds the legacy images, e.g. the legacy JRE image 1193 legacy-images: legacy-jre-image 1194 1195 # zip-security is actually a bundle, but for now it needs to be considered 1196 # an image until this can be cleaned up properly. 1197 product-images: zip-security 1198 1199 # The module summary cannot be run when: 1200 # * Cross compiling and building a partial BUILDJDK for the build host 1201 # * An external buildjdk has been supplied since it may not match the 1202 # module selection of the target jdk 1203 ifneq ($(CREATE_BUILDJDK), true) 1204 ifeq ($(EXTERNAL_BUILDJDK), false) 1205 product-images: generate-summary 1206 endif 1207 endif 1208 1209 ifeq ($(call isTargetOs, macosx), true) 1210 product-images: mac-jdk-bundle 1211 1212 legacy-images: mac-legacy-jre-bundle 1213 endif 1214 1215 # These targets build the various documentation images 1216 docs-jdk-image: docs-jdk 1217 docs-javase-image: docs-javase 1218 docs-reference-image: docs-reference 1219 # The docs-jdk-image is what most users expect to be built 1220 docs-image: docs-jdk-image 1221 all-docs-images: docs-jdk-image docs-javase-image docs-reference-image 1222 1223 docs-bundles: docs-jdk-bundles 1224 all-docs-bundles: docs-jdk-bundles docs-javase-bundles docs-reference-bundles 1225 1226 # This target builds the test image 1227 test-image: prepare-test-image test-image-jdk-jtreg-native \ 1228 test-image-demos-jdk test-image-libtest-jtreg-native \ 1229 test-image-lib-native 1230 1231 ifneq ($(JVM_TEST_IMAGE_TARGETS), ) 1232 # If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the 1233 # standard hotspot set of tests. 1234 test-image: $(JVM_TEST_IMAGE_TARGETS) 1235 else 1236 test-image: test-image-hotspot-jtreg-native 1237 ifneq ($(GTEST_FRAMEWORK_SRC), ) 1238 test-image: test-image-hotspot-gtest 1239 endif 1240 endif 1241 1242 ifeq ($(BUILD_FAILURE_HANDLER), true) 1243 test-image: test-image-failure-handler 1244 endif 1245 1246 ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true) 1247 test-image: test-image-test-thread-factory 1248 endif 1249 1250 ifneq ($(JMH_CORE_JAR), ) 1251 test-image: build-microbenchmark 1252 endif 1253 1254 ################################################################################ 1255 1256 # all-images builds all our deliverables as images. 1257 all-images: product-images test-image all-docs-images 1258 1259 # all-bundles packages all our deliverables as tar.gz bundles. 1260 all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles 1261 1262 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \ 1263 copy java libs static-libs launchers jmods \ 1264 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \ 1265 exploded-image-base exploded-image runnable-buildjdk \ 1266 create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \ 1267 docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \ 1268 docs-image docs-javase-image docs-reference-image all-docs-images \ 1269 docs-bundles all-docs-bundles test-image all-images \ 1270 all-bundles 1271 1272 ################################################################################ 1273 1274 # Traditional targets typically run by users. 1275 # These can be considered aliases for the targets now named by a more 1276 # "modern" naming scheme. 1277 default: $(DEFAULT_MAKE_TARGET) 1278 jdk: exploded-image 1279 images: product-images 1280 docs: docs-image 1281 bundles: all-bundles 1282 all: all-images 1283 1284 ALL_TARGETS += default jdk images docs bundles all 1285 1286 # Aliases used for running tests. 1287 1288 # Let "run-test" be an alias for "test" 1289 $(foreach t, $(ALL_NAMED_TESTS), $(eval run-test-$t: test-$t)) 1290 RUN_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS)) 1291 1292 run-test: test 1293 exploded-run-test: exploded-test 1294 1295 # "make check" is a common idiom for running basic testing 1296 check: test-tier1 1297 1298 # Keep some old names as aliases 1299 test-hotspot-jtreg: test-hotspot_all 1300 test-hotspot-jtreg-native: test-hotspot_native_sanity 1301 test-hotspot-gtest: exploded-test-gtest 1302 test-jdk-jtreg-native: test-jdk_native_sanity 1303 1304 ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \ 1305 test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \ 1306 test-jdk-jtreg-native 1307 1308 ################################################################################ 1309 ################################################################################ 1310 # 1311 # Clean targets 1312 # 1313 ################################################################################ 1314 # Clean targets are automatically run serially by the Makefile calling this 1315 # file. 1316 1317 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ 1318 images make-support test-make bundles buildjdk test-results test-support \ 1319 support/images 1320 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) 1321 CLEAN_SUPPORT_DIRS += demos 1322 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS)) 1323 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib 1324 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) 1325 CLEAN_PHASES := gensrc java native include 1326 CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) 1327 CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) 1328 # Construct targets of the form clean-$module-$phase 1329 CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ 1330 $(addprefix $m-, $(CLEAN_PHASES)))) 1331 1332 # Remove everything, except the output from configure. 1333 clean: $(CLEAN_DIR_TARGETS) 1334 ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json) 1335 $(ECHO) Cleaned all build artifacts. 1336 1337 clean-docs: 1338 $(call CleanDocs) 1339 1340 clean-compile-commands: 1341 $(call CleanMakeSupportDir,compile-commands) 1342 1343 $(CLEAN_DIR_TARGETS): 1344 $(call CleanDir,$(patsubst clean-%, %, $@)) 1345 1346 $(CLEAN_SUPPORT_DIR_TARGETS): 1347 $(call CleanSupportDir,$(patsubst clean-%, %, $@)) 1348 1349 $(CLEAN_TEST_TARGETS): 1350 $(call CleanTest,$(patsubst clean-test-%, %, $@)) 1351 1352 $(CLEAN_PHASE_TARGETS): 1353 $(call Clean-$(patsubst clean-%,%, $@)) 1354 1355 $(CLEAN_MODULE_TARGETS): 1356 $(call CleanModule,$(patsubst clean-%, %, $@)) 1357 1358 $(CLEAN_MODULE_PHASE_TARGETS): 1359 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \ 1360 $(word 2, $(subst -,$(SPACE),$@))) 1361 1362 # When removing the support dir, we must also remove jdk. Building classes has 1363 # the side effect of generating native headers. The headers end up in support 1364 # while classes and touch files end up in jdk. 1365 clean-support: clean-jdk 1366 1367 clean-test: clean-test-results clean-test-support 1368 1369 # When cleaning images, also clean the support/images directory. 1370 clean-images: clean-support/images 1371 1372 # Remove everything, including configure configuration. If the output 1373 # directory was created by configure and now becomes empty, remove it as well. 1374 dist-clean: clean 1375 ($(CD) $(OUTPUTDIR) && \ 1376 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide \ 1377 configure.log* build.log*) 1378 $(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \ 1379 if test "x`$(LS) $(OUTPUTDIR)`" != x; then \ 1380 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 1381 else \ 1382 ($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \ 1383 && $(RM) -r $(OUTPUTDIR)) \ 1384 fi \ 1385 ) 1386 $(ECHO) Cleaned everything, you will have to re-run configure. 1387 1388 ALL_TARGETS += clean clean-docs clean-compile-commands dist-clean $(CLEAN_DIR_TARGETS) \ 1389 $(CLEAN_SUPPORT_DIR_TARGETS) $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) \ 1390 $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS) 1391 1392 ################################################################################ 1393 # Declare *-only targets for each normal target 1394 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) 1395 1396 ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) 1397 1398 ################################################################################ 1399 1400 # The following targets are intentionally not added to ALL_TARGETS since they 1401 # are internal only, to support Init.gmk. 1402 1403 print-targets: 1404 @$(ECHO) $(sort $(ALL_TARGETS)) 1405 1406 print-modules: 1407 @$(ECHO) $(sort $(ALL_MODULES)) 1408 1409 print-tests: 1410 @$(ECHO) $(sort $(ALL_NAMED_TESTS)) 1411 1412 create-main-targets-include: 1413 $(call LogInfo, Generating main target list) 1414 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ 1415 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk 1416 1417 ################################################################################ 1418 # Hook to include the corresponding custom file, if present. 1419 $(eval $(call IncludeCustomExtension, Main-post.gmk)) 1420 1421 .PHONY: $(ALL_TARGETS) 1422 1423 FRC: # Force target