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