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