Main.gmk revision 2668:d67a3f1f057f
1294332Sdes# 2261287Sdes# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. 3261287Sdes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4261287Sdes# 5261287Sdes# This code is free software; you can redistribute it and/or modify it 6261287Sdes# under the terms of the GNU General Public License version 2 only, as 7261287Sdes# published by the Free Software Foundation. Oracle designates this 8261287Sdes# particular file as subject to the "Classpath" exception as provided 9261287Sdes# by Oracle in the LICENSE file that accompanied this code. 10261287Sdes# 11261287Sdes# This code is distributed in the hope that it will be useful, but WITHOUT 12261287Sdes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13261287Sdes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14261287Sdes# version 2 for more details (a copy is included in the LICENSE file that 15261287Sdes# accompanied this code). 16261287Sdes# 17261287Sdes# You should have received a copy of the GNU General Public License version 18261287Sdes# 2 along with this work; if not, write to the Free Software Foundation, 19261287Sdes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20261287Sdes# 21261287Sdes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22261287Sdes# or visit www.oracle.com if you need additional information or have any 23261287Sdes# questions. 24261287Sdes# 25261287Sdes 26261287Sdes################################################################################ 27261287Sdes# This is the main makefile containing most actual top level targets. It needs 28261287Sdes# to be called with a SPEC file defined. 29261287Sdes################################################################################ 30261287Sdes 31261287Sdes# Declare default target 32261287Sdesdefault: 33261287Sdes 34261287Sdesifeq ($(wildcard $(SPEC)),) 35261287Sdes $(error Main.gmk needs SPEC set to a proper spec.gmk) 36294332Sdesendif 37261287Sdes 38261287Sdes# Now load the spec 39261287Sdesinclude $(SPEC) 40261287Sdes 41261287Sdesinclude $(SRC_ROOT)/make/MainSupport.gmk 42294332Sdes 43294332Sdes# Load the vital tools for all the makefiles. 44294332Sdesinclude $(SRC_ROOT)/make/common/MakeBase.gmk 45261287Sdesinclude $(SRC_ROOT)/make/common/Modules.gmk 46294332Sdesinclude $(SRC_ROOT)/make/common/FindTests.gmk 47294332Sdes 48294332Sdes# Declare ALL_TARGETS as an immediate variable. This variable is a list of all 49294332Sdes# valid top level targets. It's used to declare them all as PHONY and to 50294332Sdes# generate the -only targets. 51261287SdesALL_TARGETS := 52294332Sdes 53294332Sdes# Hook to include the corresponding custom file, if present. 54261287Sdes$(eval $(call IncludeCustomExtension, , Main.gmk)) 55294332Sdes 56261287Sdes# All modules for the current target platform. 57294332SdesALL_MODULES := $(call FindAllModules) 58294332Sdes 59261287Sdes################################################################################ 60294332Sdes################################################################################ 61294332Sdes# 62294332Sdes# Recipes for all targets. Only recipes, dependencies are declared later. 63294332Sdes# 64294332Sdes################################################################################ 65261287Sdes 66261287Sdes################################################################################ 67294332Sdes# Interim/build tools targets, compiling tools used during the build 68294332Sdes 69294332Sdes# When creating a BUILDJDK, the buildtools and interim targets have already 70261287Sdes# been built and should not be built again. 71294332Sdesifneq ($(CREATING_BUILDJDK), true) 72294332Sdes buildtools-langtools: 73294332Sdes +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk) 74294332Sdes 75294332Sdes interim-langtools: 76294332Sdes +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk) 77294332Sdes 78294332Sdes interim-rmic: 79294332Sdes +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk) 80294332Sdes 81294332Sdes interim-cldrconverter: 82294332Sdes +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk) 83294332Sdes 84294332Sdes buildtools-jdk: 85294332Sdes +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk) 86294332Sdes 87294332Sdes buildtools-modules: 88294332Sdes +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk) 89261287Sdes 90294332Sdes buildtools-hotspot: 91294332Sdes +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk) 92294332Sdesendif 93294332Sdes 94294332SdesALL_TARGETS += buildtools-langtools interim-langtools \ 95294332Sdes interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules \ 96294332Sdes buildtools-hotspot 97294332Sdes 98294332Sdes################################################################################ 99294332Sdes# Special targets for certain modules 100294332Sdes 101294332Sdesunpack-sec: 102294332Sdes +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk) 103294332Sdes 104294332Sdesgenerate-exported-symbols: 105261287Sdes +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk) 106261287Sdes 107294332SdesALL_TARGETS += unpack-sec generate-exported-symbols 108294332Sdes 109294332Sdes################################################################################ 110294332Sdes# Gensrc targets, generating source before java compilation can be done 111294332Sdes# 112294332Sdes# When creating a BUILDJDK, the java targets have already been built and copied 113294332Sdes# into the buildjdk so no need to generate sources. 114294332Sdesifneq ($(CREATING_BUILDJDK), true) 115294332Sdes $(eval $(call DeclareRecipesForPhase, GENSRC, \ 116261287Sdes TARGET_SUFFIX := gensrc, \ 117261287Sdes FILE_PREFIX := Gensrc, \ 118261287Sdes MAKE_SUBDIR := gensrc, \ 119261287Sdes CHECK_MODULES := $(ALL_MODULES), \ 120261287Sdes MULTIPLE_MAKEFILES := true)) 121294332Sdes 122294332Sdes JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS)) 123294332Sdes LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS)) 124294332Sdes CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS)) 125294332Sdes HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS)) 126294332Sdes 127294332Sdes GENSRC_MODULEINFO_MODULES := $(ALL_MODULES) 128261287Sdes GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \ 129261287Sdes $(GENSRC_MODULEINFO_MODULES)) 130294332Sdes 131294332Sdes GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES) 132261287Sdes GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \ 133261287Sdes $(addsuffix -gensrc, $(GENSRC_MODULES))) 134261287Sdes 135294332Sdes define DeclareModuleInfoRecipe 136294332Sdes $1-gensrc-moduleinfo: 137261287Sdes +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 138294332Sdes -f GensrcModuleInfo.gmk MODULE=$1) 139261287Sdes 140294332Sdes $1-gensrc: $1-gensrc-moduleinfo 141294332Sdes endef 142294332Sdes 143261287Sdes $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m))) 144294332Sdesendif 145294332Sdes 146294332SdesALL_TARGETS += $(GENSRC_TARGETS) 147294332Sdes 148261287Sdes################################################################################ 149261287Sdes# Generate data targets 150261287Sdes$(eval $(call DeclareRecipesForPhase, GENDATA, \ 151294332Sdes TARGET_SUFFIX := gendata, \ 152294332Sdes FILE_PREFIX := Gendata, \ 153294332Sdes MAKE_SUBDIR := gendata, \ 154294332Sdes CHECK_MODULES := $(ALL_MODULES), \ 155294332Sdes USE_WRAPPER := true)) 156261287Sdes 157261287SdesALL_TARGETS += $(GENDATA_TARGETS) 158294332Sdes 159294332Sdes################################################################################ 160294332Sdes# Copy files targets 161294332Sdes$(eval $(call DeclareRecipesForPhase, COPY, \ 162294332Sdes TARGET_SUFFIX := copy, \ 163294332Sdes FILE_PREFIX := Copy, \ 164294332Sdes MAKE_SUBDIR := copy, \ 165294332Sdes CHECK_MODULES := $(ALL_MODULES), \ 166294332Sdes USE_WRAPPER := true, \ 167294332Sdes MULTIPLE_MAKEFILES := true)) 168294332Sdes 169294332SdesALL_COPY_MODULES += $(COPY_MODULES) 170261287SdesALL_COPY_TARGETS += $(COPY_TARGETS) 171 172IMPORT_COPY_MODULES := $(call FindImportedModules) 173IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES)) 174ALL_COPY_MODULES += $(IMPORT_COPY_MODULES) 175ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS) 176 177define DeclareImportCopyRecipe 178 $1-copy: 179 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 180 -f CopyImportModules.gmk MODULE=$1) 181endef 182 183$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m))) 184 185ALL_TARGETS += $(ALL_COPY_TARGETS) 186 187################################################################################ 188# Targets for compiling all java modules. Nashorn is treated separately. 189JAVA_MODULES := $(ALL_MODULES) 190JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) 191 192define DeclareCompileJavaRecipe 193 $1-java: 194 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 195 -f CompileJavaModules.gmk MODULE=$1) 196endef 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. 203jdk.scripting.nashorn-java: 204 +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 205 -f BuildNashorn.gmk compile) 206 207ALL_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 217ALL_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 228ALL_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 239ALL_TARGETS += $(LAUNCHER_TARGETS) 240 241################################################################################ 242# Build hotspot target 243 244HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS)) 245HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS)) 246HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS)) 247 248define 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) 253endef 254 255$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v))) 256 257define DeclareHotspotLibsRecipe 258 hotspot-$1-libs: 259 +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \ 260 JVM_VARIANT=$1) 261endef 262 263$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v))) 264 265hotspot-jsig: 266 +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibjsig.gmk) 267 268hotspot-ide-project: 269 +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) 270 271ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \ 272 $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project 273 274################################################################################ 275# Build demos targets 276 277demos-jdk: 278 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) 279 280test-image-demos-jdk: 281 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk images) 282 283ALL_TARGETS += demos-jdk test-image-demos-jdk 284 285################################################################################ 286# Jigsaw specific data and analysis targets. 287 288generate-summary: 289 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GenerateModuleSummary.gmk) 290 291ALL_TARGETS += generate-summary 292 293################################################################################ 294# Jmod targets 295 296JMOD_MODULES := $(ALL_MODULES) 297JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES)) 298 299define DeclareJmodRecipe 300 $1-jmod: 301 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 302 MODULE=$1) 303endef 304 305$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m))) 306 307ALL_TARGETS += $(JMOD_TARGETS) 308 309################################################################################ 310# Images targets 311 312store-source-revision: 313 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk store-source-revision) 314 315create-source-revision-tracker: 316 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk create-source-revision-tracker) 317 318BOOTCYCLE_TARGET := product-images 319bootcycle-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 328zip-security: 329 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) 330 331zip-source: 332 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk) 333 334jrtfs-jar: 335 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk) 336 337jdk-image: 338 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk) 339 340jre-image: 341 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre) 342 343symbols-image: 344 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols) 345 346profiles-image: 347 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles) 348 349mac-bundles-jdk: 350 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk) 351 352release-file: 353 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ReleaseFile.gmk) 354 355exploded-image-optimize: 356 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk) 357 358ALL_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# If building full docs, to complete docs-*-api we need both the javadoc and 367# modulegraph targets. 368docs-jdk-api-javadoc: 369 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-javadoc) 370 371docs-jdk-api-modulegraph: 372 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-modulegraph) 373 374docs-javase-api-javadoc: 375 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-javadoc) 376 377docs-javase-api-modulegraph: 378 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-modulegraph) 379 380docs-jdk-specs: 381 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-specs) 382 383docs-jdk-index: 384 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-index) 385 386docs-zip: 387 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-zip) 388 389update-build-docs: 390 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk) 391 392ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \ 393 docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \ 394 docs-jdk-index docs-zip update-build-docs 395 396################################################################################ 397# Cross compilation support 398 399ifeq ($(CREATING_BUILDJDK), true) 400 # This target is only called by the recursive call below. 401 create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \ 402 java.base-copy jdk.jdeps-launchers 403endif 404 405create-buildjdk-copy: 406 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk) 407 408create-buildjdk-interim-image: 409 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \ 410 $@-helper \ 411 SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 412 HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 413 CREATING_BUILDJDK=true) 414 415ALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image 416 417################################################################################ 418# The interim-image is a small jlinked image that is used to generate artifacts 419# at build time for use when linking the real images. 420 421INTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES)) 422 423define DeclareInterimJmodRecipe 424 $1-interim-jmod: 425 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 426 MODULE=$1 \ 427 JMODS_DIR=$(INTERIM_JMODS_DIR) \ 428 JMODS_TEMPDIR=$(INTERIM_JMODS_DIR)/temp \ 429 INTERIM_JMOD=true \ 430 ) 431endef 432 433$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m))) 434 435interim-image: 436 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f InterimImage.gmk) 437 438ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 439 generate-link-opt-data: 440 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f GenerateLinkOptData.gmk) 441endif 442 443ALL_TARGETS += $(INTERIM_JMOD_TARGETS) interim-image generate-link-opt-data 444 445################################################################################ 446# Generate test names for all JTReg test groups 447# 448 449define DeclareRunTestRecipe 450 run-test-$1: 451 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1") 452 453 exploded-run-test-$1: 454 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \ 455 TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR)) 456 457endef 458 459# ALL_NAMED_TESTS is defined in FindTests.gmk 460$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t))) 461ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS)) 462ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-run-test-, $(ALL_NAMED_TESTS)) 463 464ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS) 465 466################################################################################ 467# Build tests 468# 469 470prepare-test-image: 471 $(MKDIR) -p $(TEST_IMAGE_DIR) 472 $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' 473 474build-test-hotspot-jtreg-native: 475 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 476 build-test-hotspot-jtreg-native) 477 478test-image-hotspot-jtreg-native: 479 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 480 test-image-hotspot-jtreg-native) 481 482build-test-jdk-jtreg-native: 483 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 484 build-test-jdk-jtreg-native) 485 486test-image-jdk-jtreg-native: 487 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 488 test-image-jdk-jtreg-native) 489 490run-test: 491 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)") 492 493exploded-run-test: 494 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \ 495 TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR)) 496 497ifeq ($(BUILD_GTEST), true) 498 test-image-hotspot-gtest: 499 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk) 500endif 501 502build-test-lib: 503 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk) 504 505ifeq ($(BUILD_FAILURE_HANDLER), true) 506 # Builds the failure handler jtreg extension 507 build-test-failure-handler: 508 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 509 -f BuildFailureHandler.gmk build) 510 511 # Runs the tests for the failure handler jtreg extension 512 test-failure-handler: 513 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 514 -f BuildFailureHandler.gmk test) 515 516 # Copies the failure handler jtreg extension into the test image 517 test-image-failure-handler: 518 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 519 -f BuildFailureHandler.gmk images) 520endif 521 522ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \ 523 test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \ 524 test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \ 525 test-failure-handler test-image-failure-handler test-image-hotspot-gtest \ 526 run-test exploded-run-test 527 528################################################################################ 529# Run tests 530 531# Run tests specified by $(TEST), or the default test set. 532test: 533 $(call RunTests, $(TEST), $(JDK_IMAGE_DIR)) 534 535test-hotspot-jtreg: 536 $(call RunTests, "hotspot_all", $(JDK_IMAGE_DIR)) 537 538test-hotspot-jtreg-native: 539 $(call RunTests, "hotspot_native_sanity", $(JDK_IMAGE_DIR)) 540 541test-hotspot-internal: 542 $(call RunTests, "hotspot_internal", $(JDK_OUTPUTDIR)) 543 544test-hotspot-gtest: 545 $(call RunTests, "hotspot_gtest", $(JDK_OUTPUTDIR)) 546 547test-jdk-jtreg-native: 548 $(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR)) 549 550test-make: 551 ($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) 552 553ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \ 554 test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make 555 556################################################################################ 557# Bundles 558 559product-bundles: 560 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles) 561 562profiles-bundles: 563 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk profiles-bundles) 564 565test-bundles: 566 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles) 567 568docs-bundles: 569 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles) 570 571ALL_TARGETS += product-bundles profiles-bundles test-bundles docs-bundles 572 573################################################################################ 574# Install targets 575 576install: 577 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk) 578 579ALL_TARGETS += install 580 581################################################################################ 582# 583# Dependency declarations between targets. 584# 585# These are declared in two groups. First all dependencies between targets that 586# have recipes above as these dependencies may be disabled. Then the aggregator 587# targets that do not have recipes of their own, which will never have their 588# dependencies disabled. 589# 590################################################################################ 591# Targets with recipes above 592 593# If running an *-only target, parallel execution and dependencies between 594# recipe targets are disabled. This makes it possible to run a select set of 595# recipe targets in order. It's the responsibility of the user to make sure 596# all prerequisites are fulfilled. 597ifneq ($(findstring -only, $(MAKECMDGOALS)), ) 598 .NOTPARALLEL: 599else 600 $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools 601 602 interim-langtools: $(LANGTOOLS_GENSRC_TARGETS) 603 604 buildtools-jdk: interim-langtools interim-cldrconverter 605 606 buildtools-hotspot: interim-langtools 607 608 buildtools-modules: exploded-image-base 609 610 $(CORBA_GENSRC_TARGETS): interim-langtools 611 612 $(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot 613 614 $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk 615 616 $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk 617 618 $(GENDATA_TARGETS): interim-langtools buildtools-jdk 619 620 interim-rmic: interim-langtools 621 622 $(RMIC_TARGETS): interim-langtools interim-rmic 623 624 $(JAVA_TARGETS): interim-langtools 625 626 # Declare dependencies between hotspot-<variant>* targets 627 $(foreach v, $(JVM_VARIANTS), \ 628 $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \ 629 $(eval hotspot-$v-libs: hotspot-$v-gensrc) \ 630 ) 631 632 hotspot-ide-project: hotspot exploded-image 633 634 generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs 635 636 # Building one JVM variant is enough to start building the other libs 637 $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs 638 639 $(LAUNCHER_TARGETS): java.base-libs 640 641 ifeq ($(STATIC_BUILD), true) 642 $(LAUNCHER_TARGETS): generate-exported-symbols 643 endif 644 645 # The demos are currently linking to libjvm and libjava, just like all other 646 # jdk libs, even though they don't need to. To avoid warnings, make sure they 647 # aren't built until after libjava and libjvm are available to link to. 648 demos-jdk: java.base-libs exploded-image-optimize 649 test-image-demos-jdk: demos-jdk 650 651 # Declare dependency from <module>-java to <module>-gensrc 652 $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) 653 654 # Declare dependencies between java modules 655 $(foreach m, $(JAVA_MODULES), \ 656 $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \ 657 $(call FindDepsForModule,$m))))) 658 659 # Declare dependencies between <module>-rmic to <module>-java 660 $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java)) 661 662 # Declare dependencies from <module>-lib to <module>-java 663 # Skip modules that do not have java source. 664 # When creating a BUILDJDK, the java compilation has already been done by the 665 # normal build and copied in. 666 ifneq ($(CREATING_BUILDJDK), true) 667 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java)) 668 endif 669 670 # Declare dependencies from all other <module>-lib to java.base-lib 671 $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \ 672 $(eval $t: java.base-libs)) 673 674 # jdk.accessibility depends on java.desktop 675 jdk.accessibility-libs: java.desktop-libs 676 677 # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 678 # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a 679 # virtual target. 680 jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc 681 682 # The swing beans need to have java base properly generated to avoid errors 683 # in javadoc. 684 java.desktop-gensrc-jdk: java.base-gensrc 685 686 # The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler 687 # needs classes from the current JDK. 688 jdk.internal.vm.ci-gensrc-hotspot: $(addsuffix -java, \ 689 $(call FindTransitiveDepsForModule, jdk.internal.vm.ci)) 690 jdk.internal.vm.compiler-gensrc-hotspot: $(addsuffix -java, \ 691 $(call FindTransitiveDepsForModule, jdk.internal.vm.compiler)) 692 693 # For jdk.internal.vm.compiler, the gensrc step is generating a module-info.java.extra 694 # file to be processed by the gensrc-moduleinfo target. 695 jdk.internal.vm.compiler-gensrc-moduleinfo: jdk.internal.vm.compiler-gensrc-hotspot 696 697 # Explicitly add dependencies for special targets 698 java.base-java: unpack-sec 699 700 jdk.jdeps-gendata: java rmic 701 702 # Declare dependencies between jmod targets. 703 # java.base jmod needs jrt-fs.jar and access to the other jmods to be built. 704 # When creating a BUILDJDK, we don't need to add hashes to java.base, thus 705 # we don't need to depend on all other jmods 706 ifneq ($(CREATING_BUILDJDK), true) 707 java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS)) 708 endif 709 710 # Building java.base-jmod requires all of hotspot to be built. 711 java.base-jmod: hotspot 712 713 # Declare dependencies from <module>-jmod to all other module targets 714 # When creating a BUILDJDK, the java compilation has already been done by the 715 # normal build and copied in. 716 ifneq ($(CREATING_BUILDJDK), true) 717 $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java)) 718 endif 719 $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata)) 720 $(foreach m, $(RMIC_MODULES), $(eval $m_JMOD_DEPS += $m-rmic)) 721 $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs)) 722 $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers)) 723 $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy)) 724 $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS))) 725 $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS))) 726 727 # Jmods cannot be created until we have the jmod tool ready to run. During 728 # a normal build we run it from the exploded image, but when cross compiling 729 # it's run from the buildjdk, which is either created at build time or user 730 # supplied. 731 # 732 # For the exploded image to be runnable, all java modules and 733 # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done 734 # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the 735 # appropriate location otherwise jimage, jlink and jmod won't start. This 736 # also applies when creating the buildjdk. 737 DEFAULT_JMOD_DEPS := java.base-libs java.base-copy java.base-gendata \ 738 jdk.jlink-launchers 739 # When cross compiling and buildjdk is to be created, depend on creating the 740 # buildjdk instead of the default dependencies. 741 ifeq ($(CREATE_BUILDJDK), true) 742 # Avoid calling create-buildjdk from within a create-buildjdk call. 743 ifneq ($(CREATING_BUILDJDK), true) 744 $(JMOD_TARGETS): create-buildjdk 745 buildtools-modules: create-buildjdk 746 else 747 # While actually creating the buildjdk, the default deps applies. 748 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) 749 endif 750 else 751 # The normal non cross compilation case uses the default deps. 752 # To avoid races with the optimize target, that also needs to happen first. 753 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) \ 754 exploded-image-optimize 755 endif 756 757 # All modules include the main license files from java.base. 758 $(JMOD_TARGETS): java.base-copy 759 760 zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \ 761 $(filter jdk.crypto%, $(JAVA_TARGETS)) 762 763 zip-source: gensrc rmic 764 765 jrtfs-jar: interim-langtools 766 767 ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 768 ifeq ($(CREATE_BUILDJDK), true) 769 # If creating a buildjdk, the interim image needs to be based on that. 770 generate-link-opt-data: create-buildjdk 771 else ifeq ($(EXTERNAL_BUILDJDK), false) 772 # If an external buildjdk has been provided, we skip generating an 773 # interim-image and just use the external buildjdk for generating 774 # classlist. 775 generate-link-opt-data: interim-image 776 endif 777 generate-link-opt-data: buildtools-jdk 778 779 # The generated classlist needs to go into java.base-jmod. 780 java.base-jmod jdk.jlink-jmod jdk-image jre-image: generate-link-opt-data 781 endif 782 783 release-file: create-source-revision-tracker 784 785 jdk-image: jmods zip-source demos release-file 786 jre-image: jmods release-file 787 symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS) 788 789 profiles-image: jmods release-file 790 791 mac-bundles-jdk: jdk-image jre-image 792 793 # The optimize target can run as soon as the modules dir has been completely 794 # populated (java, copy and gendata targets) and the basic libs and launchers 795 # have been built. 796 exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \ 797 buildtools-modules 798 799 bootcycle-images: jdk-image 800 801 docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic 802 803 docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic 804 805 docs-jdk-api-modulegraph: exploded-image buildtools-modules 806 807 docs-javase-api-modulegraph: exploded-image buildtools-modules 808 809 # The gensrc steps for hotspot and jdk.jdi create html spec files. 810 docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \ 811 docs-jdk-index 812 813 docs-jdk-index: exploded-image buildtools-modules 814 815 docs-zip: docs-jdk 816 817 test: jdk-image test-image 818 819 run-test: jdk-image test-image 820 exploded-run-test: exploded-image test-image 821 822 # Declare dependency for all generated test targets 823 $(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image)) 824 $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image)) 825 826 create-buildjdk-copy: jdk.jlink-java java.base-gendata \ 827 $(addsuffix -java, $(INTERIM_IMAGE_MODULES)) 828 829 create-buildjdk-interim-image: create-buildjdk-copy 830 831 interim-image: $(INTERIM_JMOD_TARGETS) 832 833 test-make: clean-test-make 834 835 build-test-lib: exploded-image-optimize 836 837 build-test-failure-handler: interim-langtools 838 839 test-failure-handler: build-test-failure-handler 840 841 test-image-failure-handler: build-test-failure-handler 842 843 build-test-hotspot-jtreg-native: buildtools-jdk \ 844 hotspot-$(JVM_VARIANT_MAIN)-libs 845 846 build-test-jdk-jtreg-native: buildtools-jdk java.base-libs 847 848 test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native 849 850 test-image-jdk-jtreg-native: build-test-jdk-jtreg-native 851 852 test-image-hotspot-gtest: hotspot 853 854 test-hotspot-internal: exploded-image 855 856 test-hotspot-jtreg: jdk-image test-image 857 858 test-hotspot-gtest: exploded-image test-image-hotspot-gtest 859 860 install: product-images 861 862 product-bundles: product-images 863 864 profiles-bundles: profiles-images 865 866 test-bundles: test-image 867 868 docs-bundles: docs-image 869 870 generate-summary: jmods buildtools-modules 871 872endif 873 874################################################################################ 875# Virtual targets without recipes 876 877buildtools: buildtools-langtools interim-langtools interim-rmic \ 878 buildtools-jdk buildtools-hotspot 879 880hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig 881 882hotspot-libs: hotspot-jsig 883 884# Create targets hotspot-libs and hotspot-gensrc. 885$(foreach v, $(JVM_VARIANTS), \ 886 $(eval hotspot-libs: hotspot-$v-libs) \ 887 $(eval hotspot-gensrc: hotspot-$v-gensrc) \ 888) 889 890gensrc: $(GENSRC_TARGETS) 891 892gendata: $(GENDATA_TARGETS) 893 894copy: $(ALL_COPY_TARGETS) 895 896java: $(JAVA_TARGETS) 897 898rmic: $(RMIC_TARGETS) 899 900libs: $(LIBS_TARGETS) 901 902launchers: $(LAUNCHER_TARGETS) 903 904jmods: $(JMOD_TARGETS) 905 906# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which 907# is actually handled by jdk.jdi-gensrc 908jdk.jdwp.agent-gensrc: jdk.jdi-gensrc 909 910# Declare dependencies from <module> to all the individual targets specific 911# to that module <module>-*, that are needed for the exploded image. 912$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc)) 913$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java)) 914$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata)) 915$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic)) 916$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) 917$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) 918$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) 919 920# Building java.base includes building all of hotspot. 921java.base: hotspot 922 923demos: demos-jdk 924 925# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. 926exploded-image-base: $(ALL_MODULES) 927exploded-image: exploded-image-base release-file 928# When cross compiling, no need to optimize the exploded image since it won't 929# be runnable on the host platform anyway. 930ifneq ($(COMPILE_TYPE), cross) 931 exploded-image: exploded-image-optimize 932endif 933 934create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image 935 936docs-jdk-api: docs-jdk-api-javadoc 937docs-javase-api: docs-javase-api-javadoc 938 939# If we're building full docs, we must also generate the module graphs to 940# get non-broken api documentation. 941ifeq ($(ENABLE_FULL_DOCS), true) 942 docs-jdk-api: docs-jdk-api-modulegraph 943 docs-javase-api: docs-javase-api-modulegraph 944endif 945 946docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index 947docs-javase: docs-javase-api 948 949# alias for backwards compatibility 950docs-javadoc: docs-jdk-api 951 952mac-bundles: mac-bundles-jdk 953 954# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, 955# and in line with this, our targets for creating these are named *-image[s]. 956 957# This target builds the product images, e.g. the JRE and JDK image 958# (and possibly other, more specific versions) 959product-images: jdk-image jre-image symbols-image exploded-image 960 961# zip-security is actually a bundle, but for now it needs to be considered 962# an image until this can be cleaned up properly. 963product-images: zip-security 964 965# Declare these for backwards compatiblity and convenience. 966profiles profiles-images: profiles-image 967 968# The module summary cannot be run when: 969# * Cross compiling and building a partial BUILDJDK for the build host 970# * An external buildjdk has been supplied since it may not match the 971# module selection of the target jdk 972ifneq ($(CREATE_BUILDJDK), true) 973 ifeq ($(EXTERNAL_BUILDJDK), false) 974 product-images: generate-summary 975 endif 976endif 977 978ifeq ($(OPENJDK_TARGET_OS), macosx) 979 product-images: mac-bundles 980endif 981 982# This target builds the documentation image 983docs-image: docs-jdk 984 985# This target builds the test image 986test-image: prepare-test-image test-image-hotspot-jtreg-native \ 987 test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \ 988 test-image-demos-jdk 989 990# all-images builds all our deliverables as images. 991all-images: product-images test-image docs-image 992 993# all-bundles packages all our deliverables as tar.gz bundles. 994all-bundles: product-bundles test-bundles docs-bundles 995 996ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \ 997 copy java rmic libs launchers jmods \ 998 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \ 999 exploded-image-base exploded-image \ 1000 create-buildjdk docs-jdk-api docs-javase-api docs-jdk docs-javase \ 1001 docs-javadoc mac-bundles product-images \ 1002 profiles profiles-images \ 1003 docs-image test-image all-images \ 1004 all-bundles 1005 1006################################################################################ 1007 1008# Traditional targets typically run by users. 1009# These can be considered aliases for the targets now named by a more 1010# "modern" naming scheme. 1011default: $(DEFAULT_MAKE_TARGET) 1012jdk: exploded-image 1013images: product-images 1014docs: docs-image 1015bundles: all-bundles 1016all: all-images 1017 1018ALL_TARGETS += default jdk images docs bundles all 1019 1020################################################################################ 1021################################################################################ 1022# 1023# Clean targets 1024# 1025################################################################################ 1026# Clean targets are automatically run serially by the Makefile calling this 1027# file. 1028 1029CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ 1030 images make-support test-make bundles buildjdk 1031CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) 1032CLEAN_SUPPORT_DIRS += demos 1033CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS)) 1034CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib 1035CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) 1036CLEAN_PHASES := gensrc java native include 1037CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) 1038CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) 1039# Construct targets of the form clean-$module-$phase 1040CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ 1041 $(addprefix $m-, $(CLEAN_PHASES)))) 1042 1043# Remove everything, except the output from configure. 1044clean: $(CLEAN_DIR_TARGETS) 1045 ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*) 1046 $(ECHO) Cleaned all build artifacts. 1047 1048clean-docs: 1049 $(call CleanDocs) 1050 1051$(CLEAN_DIR_TARGETS): 1052 $(call CleanDir,$(patsubst clean-%, %, $@)) 1053 1054$(CLEAN_SUPPORT_DIR_TARGETS): 1055 $(call CleanSupportDir,$(patsubst clean-%, %, $@)) 1056 1057$(CLEAN_TEST_TARGETS): 1058 $(call CleanTest,$(patsubst clean-test-%, %, $@)) 1059 1060$(CLEAN_PHASE_TARGETS): 1061 $(call Clean-$(patsubst clean-%,%, $@)) 1062 1063$(CLEAN_MODULE_TARGETS): 1064 $(call CleanModule,$(patsubst clean-%, %, $@)) 1065 1066$(CLEAN_MODULE_PHASE_TARGETS): 1067 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \ 1068 $(word 2, $(subst -,$(SPACE),$@))) 1069 1070# When removing the support dir, we must also remove jdk. Building classes has 1071# the side effect of generating native headers. The headers end up in support 1072# while classes and touch files end up in jdk. 1073clean-support: clean-jdk 1074 1075# Remove everything, including configure configuration. If the output 1076# directory was created by configure and now becomes empty, remove it as well. 1077dist-clean: clean 1078 ($(CD) $(OUTPUT_ROOT) && \ 1079 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide) 1080 $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 1081 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 1082 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 1083 else \ 1084 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \ 1085 && $(RM) -r $(OUTPUT_ROOT)) \ 1086 fi \ 1087 ) 1088 $(ECHO) Cleaned everything, you will have to re-run configure. 1089 1090ALL_TARGETS += clean clean-docs dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \ 1091 $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \ 1092 $(CLEAN_MODULE_PHASE_TARGETS) 1093 1094################################################################################ 1095# Declare *-only targets for each normal target 1096$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) 1097 1098ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) 1099 1100################################################################################ 1101 1102# Include JPRT targets 1103include $(SRC_ROOT)/make/Jprt.gmk 1104 1105################################################################################ 1106 1107# The following targets are intentionally not added to ALL_TARGETS since they 1108# are internal only, to support Init.gmk. 1109 1110print-targets: 1111 @$(ECHO) $(sort $(ALL_TARGETS)) 1112 1113print-modules: 1114 @$(ECHO) $(sort $(ALL_MODULES)) 1115 1116print-tests: 1117 @$(ECHO) $(sort $(ALL_NAMED_TESTS)) 1118 1119create-main-targets-include: 1120 $(call LogInfo, Generating main target list) 1121 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ 1122 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk 1123 1124################################################################################ 1125 1126.PHONY: $(ALL_TARGETS) 1127 1128FRC: # Force target 1129