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