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