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