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