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