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