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