rev 55794 : [mq]: 8212970

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