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-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
 788   compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
 789 
 790   # Jmods cannot be created until we have the jmod tool ready to run. During
 791   # a normal build we run it from the exploded image, but when cross compiling
 792   # it's run from the buildjdk, which is either created at build time or user
 793   # supplied.
 794   #
 795   # For the exploded image to be runnable, all java modules and
 796   # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
 797   # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
 798   # appropriate location otherwise jimage, jlink and jmod won't start. This
 799   # also applies when creating the buildjdk.
 800   DEFAULT_JMOD_DEPS += java.base-libs java.base-copy java.base-gendata \
 801       jdk.jlink-launchers
 802   # When cross compiling and buildjdk is to be created, depend on creating the
 803   # buildjdk instead of the default dependencies.
 804   ifeq ($(CREATE_BUILDJDK), true)
 805     # Avoid calling create-buildjdk from within a create-buildjdk call.
 806     ifneq ($(CREATING_BUILDJDK), true)
 807       $(JMOD_TARGETS): create-buildjdk
 808       buildtools-modules: create-buildjdk
 809     else
 810       # While actually creating the buildjdk, the default deps applies.
 811       $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
 812     endif
 813   else
 814     # The normal non cross compilation case uses the default deps.
 815     # To avoid races with the optimize target, that also needs to happen first.
 816     $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) \
 817         exploded-image-optimize
 818   endif
 819 
 820   # All modules include the main license files from java.base.
 821   $(JMOD_TARGETS): java.base-copy
 822 
 823   zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
 824       $(filter jdk.crypto%, $(JAVA_TARGETS))
 825 
 826   zip-source: gensrc rmic
 827 
 828   jrtfs-jar: interim-langtools
 829 
 830   ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
 831     ifeq ($(CREATE_BUILDJDK), true)
 832       # If creating a buildjdk, the interim image needs to be based on that.
 833       generate-link-opt-data: create-buildjdk
 834     else ifeq ($(EXTERNAL_BUILDJDK), false)
 835       # If an external buildjdk has been provided, we skip generating an
 836       # interim-image and just use the external buildjdk for generating
 837       # classlist.
 838       generate-link-opt-data: interim-image
 839     endif
 840     generate-link-opt-data: buildtools-jdk
 841 
 842     # The generated classlist needs to go into java.base-jmod.
 843     java.base-jmod jdk.jlink-jmod jdk-image legacy-jre-image: generate-link-opt-data
 844   endif
 845 
 846   release-file: create-source-revision-tracker
 847 
 848   jdk-image: jmods zip-source demos release-file
 849   legacy-jre-image: jmods release-file
 850   symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
 851 
 852   mac-jdk-bundle: jdk-image
 853   mac-legacy-jre-bundle: legacy-jre-image
 854 
 855   # The optimize target can run as soon as the modules dir has been completely
 856   # populated (java, copy and gendata targets) and the basic libs and launchers
 857   # have been built.
 858   exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
 859       buildtools-modules
 860 
 861   bootcycle-images: jdk-image
 862 
 863   docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic
 864 
 865   docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic
 866 
 867   docs-reference-api-javadoc: $(GENSRC_TARGETS) rmic
 868 
 869   docs-jdk-api-modulegraph: exploded-image buildtools-modules
 870 
 871   docs-javase-api-modulegraph: exploded-image buildtools-modules
 872 
 873   docs-reference-api-modulegraph: exploded-image buildtools-modules
 874 
 875   # If not already set, then set the JVM specific docs targets
 876   JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
 877 
 878   # The gensrc steps for hotspot and jdk.jdi create html spec files.
 879   docs-jdk-specs: $(JVM_DOCS_TARGETS) jdk.jdi-gensrc \
 880       docs-jdk-index
 881 
 882   docs-jdk-index: exploded-image buildtools-modules
 883 
 884   docs-zip: docs-jdk
 885 
 886   test: jdk-image test-image
 887 
 888   run-test: jdk-image test-image
 889   exploded-run-test: exploded-image test-image
 890 
 891   # Declare dependency for all generated test targets
 892   $(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
 893   $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
 894 
 895   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
 896       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
 897 
 898   create-buildjdk-interim-image: create-buildjdk-copy
 899 
 900   interim-image: $(INTERIM_JMOD_TARGETS)
 901 
 902   test-make: clean-test-make
 903 
 904   test-compile-commands: compile-commands
 905 
 906   build-test-lib: exploded-image-optimize
 907 
 908   build-test-failure-handler: interim-langtools
 909 
 910   test-failure-handler: build-test-failure-handler
 911 
 912   test-image-failure-handler: build-test-failure-handler
 913 
 914   build-test-hotspot-jtreg-native: buildtools-jdk \
 915       hotspot-$(JVM_VARIANT_MAIN)-libs
 916 
 917   build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
 918 
 919   build-test-hotspot-jtreg-graal: exploded-image-optimize
 920 
 921   test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
 922 
 923   test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
 924 
 925   test-image-hotspot-jtreg-graal: build-test-hotspot-jtreg-graal
 926 
 927   test-image-hotspot-gtest: hotspot
 928 
 929   test-hotspot-internal: exploded-image
 930 
 931   test-hotspot-jtreg: jdk-image test-image
 932 
 933   test-hotspot-gtest: exploded-image test-image-hotspot-gtest
 934 
 935   install: product-images
 936 
 937   product-bundles: product-images
 938 
 939   legacy-bundles: legacy-images
 940 
 941   test-bundles: test-image
 942 
 943   docs-bundles: docs-image
 944 
 945   generate-summary: jmods buildtools-modules
 946 
 947   update-x11wrappers: java.base-copy buildtools-jdk
 948 
 949 endif
 950 
 951 ################################################################################
 952 # Virtual targets without recipes
 953 
 954 # If not already set, set the JVM specific tools targets
 955 JVM_TOOLS_TARGETS ?= buildtools-hotspot
 956 buildtools: buildtools-langtools interim-langtools interim-rmic \
 957     buildtools-jdk $(JVM_TOOLS_TARGETS)
 958 
 959 hotspot: $(HOTSPOT_VARIANT_TARGETS)
 960 
 961 # Create targets hotspot-libs and hotspot-gensrc.
 962 $(foreach v, $(JVM_VARIANTS), \
 963   $(eval hotspot-libs: hotspot-$v-libs) \
 964   $(eval hotspot-gensrc: hotspot-$v-gensrc) \
 965 )
 966 
 967 gensrc: $(GENSRC_TARGETS)
 968 
 969 gendata: $(GENDATA_TARGETS)
 970 
 971 copy: $(ALL_COPY_TARGETS)
 972 
 973 java: $(JAVA_TARGETS)
 974 
 975 rmic: $(RMIC_TARGETS)
 976 
 977 libs: $(LIBS_TARGETS)
 978 
 979 launchers: $(LAUNCHER_TARGETS)
 980 
 981 jmods: $(JMOD_TARGETS)
 982 
 983 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
 984 # is actually handled by jdk.jdi-gensrc
 985 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
 986 
 987 # Declare dependencies from <module> to all the individual targets specific
 988 # to that module <module>-*, that are needed for the exploded image.
 989 $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
 990 $(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
 991 $(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
 992 $(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
 993 $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
 994 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
 995 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
 996 
 997 # Building java.base includes building all of hotspot.
 998 java.base: $(JVM_MAIN_TARGETS)
 999 
1000 demos: demos-jdk
1001 
1002 # The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
1003 exploded-image-base: $(ALL_MODULES)
1004 exploded-image: exploded-image-base release-file
1005 # When cross compiling, no need to optimize the exploded image since it won't
1006 # be runnable on the host platform anyway.
1007 ifneq ($(COMPILE_TYPE), cross)
1008   exploded-image: exploded-image-optimize
1009 endif
1010 
1011 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
1012 
1013 docs-jdk-api: docs-jdk-api-javadoc
1014 docs-javase-api: docs-javase-api-javadoc
1015 docs-reference-api: docs-reference-api-javadoc
1016 
1017 # If we're building full docs, we must also generate the module graphs to
1018 # get non-broken api documentation.
1019 ifeq ($(ENABLE_FULL_DOCS), true)
1020   docs-jdk-api: docs-jdk-api-modulegraph
1021   docs-javase-api: docs-javase-api-modulegraph
1022   docs-reference-api: docs-reference-api-modulegraph
1023 endif
1024 
1025 docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
1026 docs-javase: docs-javase-api
1027 docs-reference: docs-reference-api
1028 
1029 # alias for backwards compatibility
1030 docs-javadoc: docs-jdk-api
1031 
1032 mac-bundles: mac-jdk-bundle
1033 
1034 # The $(OUTPUTDIR)/images directory contain the resulting deliverables,
1035 # and in line with this, our targets for creating these are named *-image[s].
1036 
1037 # This target builds the product images, e.g. the JDK image
1038 # (and possibly other, more specific versions)
1039 product-images: jdk-image symbols-image exploded-image
1040 
1041 # This target builds the legacy images, e.g. the legacy JRE image
1042 legacy-images: legacy-jre-image
1043 
1044 # zip-security is actually a bundle, but for now it needs to be considered
1045 # an image until this can be cleaned up properly.
1046 product-images: zip-security
1047 
1048 # The module summary cannot be run when:
1049 # * Cross compiling and building a partial BUILDJDK for the build host
1050 # * An external buildjdk has been supplied since it may not match the
1051 #   module selection of the target jdk
1052 ifneq ($(CREATE_BUILDJDK), true)
1053   ifeq ($(EXTERNAL_BUILDJDK), false)
1054     product-images: generate-summary
1055   endif
1056 endif
1057 
1058 ifeq ($(OPENJDK_TARGET_OS), macosx)
1059   product-images: mac-jdk-bundle
1060 
1061   legacy-images: mac-legacy-jre-bundle
1062 endif
1063 
1064 # This target builds the documentation image
1065 docs-image: docs-jdk
1066 
1067 # If not already set, set the JVM specific targets to build the test image
1068 JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native test-image-hotspot-gtest
1069 
1070 ifeq ($(INCLUDE_GRAAL), true)
1071   JVM_TEST_IMAGE_TARGETS += test-image-hotspot-jtreg-graal
1072 endif
1073 
1074 # This target builds the test image
1075 test-image: prepare-test-image \
1076     test-image-jdk-jtreg-native test-image-failure-handler \
1077     test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
1078 
1079 ################################################################################
1080 
1081 # all-images builds all our deliverables as images.
1082 all-images: product-images test-image docs-image
1083 
1084 # all-bundles packages all our deliverables as tar.gz bundles.
1085 all-bundles: product-bundles test-bundles docs-bundles
1086 
1087 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
1088     copy java rmic libs launchers jmods \
1089     jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
1090     exploded-image-base exploded-image \
1091     create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \
1092     docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \
1093     docs-image test-image all-images \
1094     all-bundles
1095 
1096 ################################################################################
1097 
1098 # Traditional targets typically run by users.
1099 # These can be considered aliases for the targets now named by a more
1100 # "modern" naming scheme.
1101 default: $(DEFAULT_MAKE_TARGET)
1102 jdk: exploded-image
1103 images: product-images
1104 docs: docs-image
1105 bundles: all-bundles
1106 all: all-images
1107 
1108 ALL_TARGETS += default jdk images docs bundles all
1109 
1110 ################################################################################
1111 ################################################################################
1112 #
1113 # Clean targets
1114 #
1115 ################################################################################
1116 # Clean targets are automatically run serially by the Makefile calling this
1117 # file.
1118 
1119 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
1120     images make-support test-make bundles buildjdk test-results test-support
1121 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
1122 CLEAN_SUPPORT_DIRS += demos
1123 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
1124 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
1125 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
1126 CLEAN_PHASES := gensrc java native include
1127 CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
1128 CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
1129 # Construct targets of the form clean-$module-$phase
1130 CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
1131     $(addprefix $m-, $(CLEAN_PHASES))))
1132 
1133 # Remove everything, except the output from configure.
1134 clean: $(CLEAN_DIR_TARGETS)
1135         ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
1136         $(ECHO) Cleaned all build artifacts.
1137 
1138 clean-docs:
1139         $(call CleanDocs)
1140 
1141 $(CLEAN_DIR_TARGETS):
1142         $(call CleanDir,$(patsubst clean-%, %, $@))
1143 
1144 $(CLEAN_SUPPORT_DIR_TARGETS):
1145         $(call CleanSupportDir,$(patsubst clean-%, %, $@))
1146 
1147 $(CLEAN_TEST_TARGETS):
1148         $(call CleanTest,$(patsubst clean-test-%, %, $@))
1149 
1150 $(CLEAN_PHASE_TARGETS):
1151         $(call Clean-$(patsubst clean-%,%, $@))
1152 
1153 $(CLEAN_MODULE_TARGETS):
1154         $(call CleanModule,$(patsubst clean-%, %, $@))
1155 
1156 $(CLEAN_MODULE_PHASE_TARGETS):
1157         $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
1158             $(word 2, $(subst -,$(SPACE),$@)))
1159 
1160 # When removing the support dir, we must also remove jdk. Building classes has
1161 # the side effect of generating native headers. The headers end up in support
1162 # while classes and touch files end up in jdk.
1163 clean-support: clean-jdk
1164 
1165 clean-test: clean-test-results clean-test-support
1166 
1167 # Remove everything, including configure configuration. If the output
1168 # directory was created by configure and now becomes empty, remove it as well.
1169 dist-clean: clean
1170         ($(CD) $(OUTPUTDIR) && \
1171             $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
1172         $(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \
1173           if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
1174             $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
1175           else \
1176             ($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
1177                 && $(RM) -r $(OUTPUTDIR)) \
1178           fi \
1179         )
1180         $(ECHO) Cleaned everything, you will have to re-run configure.
1181 
1182 ALL_TARGETS += clean clean-docs dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
1183     $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
1184     $(CLEAN_MODULE_PHASE_TARGETS)
1185 
1186 ################################################################################
1187 # Declare *-only targets for each normal target
1188 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
1189 
1190 ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
1191 
1192 ################################################################################
1193 
1194 # The following targets are intentionally not added to ALL_TARGETS since they
1195 # are internal only, to support Init.gmk.
1196 
1197 print-targets:
1198           @$(ECHO) $(sort $(ALL_TARGETS))
1199 
1200 print-modules:
1201           @$(ECHO) $(sort $(ALL_MODULES))
1202 
1203 print-tests:
1204           @$(ECHO) $(sort $(ALL_NAMED_TESTS))
1205 
1206 create-main-targets-include:
1207           $(call LogInfo, Generating main target list)
1208           @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
1209               $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
1210 
1211 ################################################################################
1212 # Hook to include the corresponding custom file, if present.
1213 $(eval $(call IncludeCustomExtension, Main-post.gmk))
1214 
1215 .PHONY: $(ALL_TARGETS)
1216 
1217 FRC: # Force target