1 # 2 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 ################################################################################ 27 # This is the main makefile containing most actual top level targets. It needs 28 # to be called with a SPEC file defined. 29 ################################################################################ 30 31 # Declare default target 32 default: 33 34 ifeq ($(wildcard $(SPEC)),) 35 $(error Main.gmk needs SPEC set to a proper spec.gmk) 36 endif 37 38 # Now load the spec 39 include $(SPEC) 40 41 include $(SRC_ROOT)/make/MainSupport.gmk 42 43 # Load the vital tools for all the makefiles. 44 include $(SRC_ROOT)/make/common/MakeBase.gmk 45 include $(SRC_ROOT)/make/common/Modules.gmk 46 47 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all 48 # valid top level targets. It's used to declare them all as PHONY and to 49 # generate the -only targets. 50 ALL_TARGETS := 51 52 # Hook to include the corresponding custom file, if present. 53 $(eval $(call IncludeCustomExtension, , Main.gmk)) 54 55 # All modules for the current target platform. 56 ALL_MODULES := $(call FindAllModules) 57 58 ################################################################################ 59 ################################################################################ 60 # 61 # Recipes for all targets. Only recipes, dependencies are declared later. 62 # 63 ################################################################################ 64 65 ################################################################################ 66 # Interim/build tools targets, compiling tools used during the build 67 68 # When creating a BUILDJDK, the buildtools and interim targets have already 69 # been built and should not be built again. 70 ifneq ($(CREATING_BUILDJDK), true) 71 buildtools-langtools: 72 +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk) 73 74 interim-langtools: 75 +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk) 76 77 interim-rmic: 78 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk) 79 80 interim-cldrconverter: 81 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk) 82 83 buildtools-jdk: 84 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk) 85 86 buildtools-modules: 87 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk) 88 endif 89 90 ALL_TARGETS += buildtools-langtools interim-langtools \ 91 interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules 92 93 ################################################################################ 94 # Special targets for certain modules 95 96 import-hotspot: 97 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk) 98 99 unpack-sec: 100 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk) 101 102 generate-exported-symbols: 103 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk) 104 105 ALL_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. 112 ifneq ($(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))) 142 endif 143 144 ALL_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 155 ALL_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 167 ALL_COPY_MODULES += $(COPY_MODULES) 168 ALL_COPY_TARGETS += $(COPY_TARGETS) 169 170 IMPORT_COPY_MODULES := $(call FindImportedModules) 171 IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES)) 172 ALL_COPY_MODULES += $(IMPORT_COPY_MODULES) 173 ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS) 174 175 define DeclareImportCopyRecipe 176 $1-copy: 177 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 178 -f CopyImportModules.gmk MODULE=$1) 179 endef 180 181 $(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m))) 182 183 ALL_TARGETS += $(ALL_COPY_TARGETS) 184 185 ################################################################################ 186 # Targets for compiling all java modules. Nashorn is treated separately. 187 JAVA_MODULES := $(ALL_MODULES) 188 JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) 189 190 define DeclareCompileJavaRecipe 191 $1-java: 192 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 193 -f CompileJavaModules.gmk MODULE=$1) 194 endef 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. 201 jdk.scripting.nashorn-java: 202 +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 203 -f BuildNashorn.gmk compile) 204 205 ALL_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 215 ALL_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 226 ALL_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 237 ALL_TARGETS += $(LAUNCHER_TARGETS) 238 239 ################################################################################ 240 # Build hotspot target 241 242 ifeq ($(BUILD_HOTSPOT),true) 243 hotspot: 244 +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) 245 endif 246 247 hotspot-ide-project: 248 +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) 249 250 ALL_TARGETS += hotspot hotspot-ide-project 251 252 ################################################################################ 253 # Build demos and samples targets 254 255 demos-jdk: 256 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) 257 258 samples-jdk: 259 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk) 260 261 ALL_TARGETS += demos-jdk samples-jdk 262 263 ################################################################################ 264 # Jigsaw specific data and analysis targets. 265 266 generate-summary: 267 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk) 268 269 ALL_TARGETS += generate-summary 270 271 ################################################################################ 272 # Strip binaries targets 273 274 STRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \ 275 $(GENDATA_MODULES)) 276 STRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES)) 277 278 define DeclareStripRecipe 279 $1-strip: 280 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \ 281 MODULE=$1) 282 endef 283 284 $(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m))) 285 286 ALL_TARGETS += $(STRIP_TARGETS) 287 288 ################################################################################ 289 # Jmod targets 290 291 JMOD_MODULES := $(ALL_MODULES) 292 JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES)) 293 294 define DeclareJmodRecipe 295 $1-jmod: 296 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 297 MODULE=$1) 298 endef 299 300 $(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m))) 301 302 ALL_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. 310 source-tips: $(SUPPORT_OUTPUTDIR)/source_tips 311 $(SUPPORT_OUTPUTDIR)/source_tips: FRC 312 $(call MakeDir, $(@D)) 313 $(call GetSourceTips) 314 315 create-hgtip-files: 316 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateHgtipFiles.gmk) 317 318 BOOTCYCLE_TARGET := product-images 319 bootcycle-images: 320 ifneq ($(COMPILE_TYPE), cross) 321 $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image) 322 +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ 323 JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main 324 else 325 $(call LogWarn, Boot cycle build disabled when cross compiling) 326 endif 327 328 zip-security: 329 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) 330 331 zip-source: 332 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk) 333 334 jrtfs-jar: 335 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk) 336 337 jimages: 338 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages) 339 340 profiles: 341 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles) 342 343 mac-bundles-jdk: 344 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk) 345 346 exploded-image-optimize: 347 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk) 348 349 ALL_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 356 docs-javadoc: 357 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 358 359 docs-jvmtidoc: 360 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs) 361 362 zip-docs: 363 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk zip-docs) 364 365 ALL_TARGETS += docs-javadoc docs-jvmtidoc zip-docs 366 367 ################################################################################ 368 # Cross compilation support 369 370 ifeq ($(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 374 endif 375 376 create-buildjdk-copy: 377 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk) 378 379 create-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 386 ALL_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 392 interim-image: 393 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f InterimImage.gmk) 394 395 ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 396 generate-classlist: 397 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GenerateClasslist.gmk) 398 endif 399 400 ALL_TARGETS += interim-image generate-classlist 401 402 ################################################################################ 403 # Build tests 404 # 405 406 prepare-test-image: 407 $(MKDIR) -p $(TEST_IMAGE_DIR) 408 $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' 409 410 build-test-hotspot-jtreg-native: 411 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 412 build-test-hotspot-jtreg-native) 413 414 test-image-hotspot-jtreg-native: 415 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 416 test-image-hotspot-jtreg-native) 417 418 build-test-jdk-jtreg-native: 419 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 420 build-test-jdk-jtreg-native) 421 422 test-image-jdk-jtreg-native: 423 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 424 test-image-jdk-jtreg-native) 425 426 ifeq ($(BUILD_GTEST), true) 427 test-image-hotspot-gtest: 428 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk) 429 endif 430 431 build-test-lib: 432 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk) 433 434 ifeq ($(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) 449 endif 450 451 ALL_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. 460 test: 461 $(call RunTests, $(TEST), $(JDK_IMAGE_DIR)) 462 463 test-hotspot-jtreg: 464 $(call RunTests, "hotspot_all", $(JDK_IMAGE_DIR)) 465 466 test-hotspot-jtreg-native: 467 $(call RunTests, "hotspot_native_sanity", $(JDK_IMAGE_DIR)) 468 469 test-hotspot-internal: 470 $(call RunTests, "hotspot_internal", $(JDK_OUTPUTDIR)) 471 472 test-hotspot-gtest: 473 $(call RunTests, "hotspot_gtest", $(JDK_OUTPUTDIR)) 474 475 test-jdk-jtreg-native: 476 $(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR)) 477 478 test-make: 479 ($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) 480 481 ALL_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 487 product-bundles: 488 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles) 489 490 test-bundles: 491 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles) 492 493 docs-bundles: 494 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles) 495 496 ALL_TARGETS += product-bundles test-bundles docs-bundles 497 498 ################################################################################ 499 # Install targets 500 501 install: 502 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk) 503 504 ALL_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. 522 ifneq ($(findstring -only, $(MAKECMDGOALS)), ) 523 .NOTPARALLEL: 524 else 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 endif 659 endif 660 661 zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \ 662 $(filter jdk.crypto%, $(JAVA_TARGETS)) 663 664 zip-source: gensrc rmic 665 666 jrtfs-jar: interim-langtools 667 668 ifeq ($(ENABLE_GENERATE_CLASSLIST), true) 669 ifeq ($(CREATE_BUILDJDK), true) 670 # If creating a buildjdk, the interim image needs to be based on that. 671 generate-classlist: create-buildjdk 672 else ifeq ($(EXTERNAL_BUILDJDK), false) 673 # If an external buildjdk has been provided, we skip generating an 674 # interim-image and just use the external buildjdk for generating 675 # classlist. 676 generate-classlist: interim-image 677 endif 678 generate-classlist: buildtools-jdk 679 680 jimages: generate-classlist 681 endif 682 683 jimages: jmods zip-source source-tips demos samples jrtfs-jar 684 685 profiles: jmods zip-source source-tips jrtfs-jar 686 687 mac-bundles-jdk: jimages 688 689 exploded-image-optimize: exploded-image-base buildtools-modules 690 691 bootcycle-images: jimages 692 693 docs-javadoc: $(GENSRC_TARGETS) rmic 694 695 docs-jvmtidoc: hotspot 696 697 zip-docs: docs-javadoc docs-jvmtidoc 698 699 test: jimages test-image 700 701 create-buildjdk-copy: jdk.jlink-java java.base-gendata \ 702 $(addsuffix -java, $(INTERIM_IMAGE_MODULES)) 703 704 create-buildjdk-interim-image: create-buildjdk-copy 705 706 interim-image: $(addsuffix -jmod, $(INTERIM_IMAGE_MODULES)) 707 708 test-make: clean-test-make 709 710 build-test-lib: java 711 712 build-test-failure-handler: interim-langtools 713 714 test-failure-handler: build-test-failure-handler 715 716 test-image-failure-handler: build-test-failure-handler 717 718 build-test-hotspot-jtreg-native: buildtools-jdk import-hotspot 719 720 build-test-jdk-jtreg-native: buildtools-jdk 721 722 test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native 723 724 test-image-jdk-jtreg-native: build-test-jdk-jtreg-native 725 726 test-image-hotspot-gtest: hotspot 727 728 test-hotspot-internal: exploded-image 729 730 test-hotspot-jtreg: jimages test-image 731 732 test-hotspot-gtest: exploded-image test-image-hotspot-gtest 733 734 install: product-images 735 736 product-bundles: product-images 737 738 test-bundles: test-image 739 740 docs-bundles: docs-image 741 742 generate-summary: jmods buildtools-modules 743 744 endif 745 746 ################################################################################ 747 # Virtual targets without recipes 748 749 buildtools: buildtools-langtools interim-langtools interim-rmic \ 750 buildtools-jdk 751 752 gensrc: $(GENSRC_TARGETS) 753 754 gendata: $(GENDATA_TARGETS) 755 756 copy: $(ALL_COPY_TARGETS) 757 758 java: $(JAVA_TARGETS) 759 760 rmic: $(RMIC_TARGETS) 761 762 libs: $(LIBS_TARGETS) 763 764 launchers: $(LAUNCHER_TARGETS) 765 766 jmods: $(JMOD_TARGETS) 767 768 strip-binaries: $(STRIP_TARGETS) 769 770 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which 771 # is actually handled by jdk.jdi-gensrc 772 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc 773 774 # Declare dependencies from <module> to all the individual targets specific 775 # to that module <module>-*, that are needed for the exploded image. 776 $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc)) 777 $(foreach m, $(JAVA_MODULES), $(eval $m: $m-java)) 778 $(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata)) 779 $(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic)) 780 $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) 781 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) 782 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) 783 demos: demos-jdk 784 785 samples: samples-jdk 786 787 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. 788 exploded-image-base: $(ALL_MODULES) 789 exploded-image: exploded-image-base exploded-image-optimize 790 791 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image 792 793 mac-bundles: mac-bundles-jdk 794 795 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, 796 # and in line with this, our targets for creating these are named *-image[s]. 797 798 # This target builds the product images, e.g. the JRE and JDK image 799 # (and possibly other, more specific versions) 800 product-images: jimages demos samples zip-security exploded-image 801 802 # The module summary cannot be run when: 803 # * Cross compiling and building a partial BUILDJDK for the build host 804 # * An external buildjdk has been supplied since it may not match the 805 # module selection of the target jdk 806 ifneq ($(CREATE_BUILDJDK), true) 807 ifeq ($(EXTERNAL_BUILDJDK), false) 808 product-images: generate-summary 809 endif 810 endif 811 812 ifeq ($(OPENJDK_TARGET_OS), macosx) 813 product-images: mac-bundles 814 endif 815 816 # This target builds the documentation image 817 docs-image: docs-javadoc docs-jvmtidoc 818 819 # This target builds the test image 820 test-image: prepare-test-image test-image-hotspot-jtreg-native \ 821 test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest 822 823 # all-images builds all our deliverables as images. 824 all-images: product-images test-image docs-image 825 826 # all-bundles packages all our deliverables as tar.gz bundles. 827 all-bundles: product-bundles test-bundles docs-bundles 828 829 ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \ 830 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \ 831 exploded-image-base exploded-image \ 832 create-buildjdk mac-bundles product-images docs-image test-image all-images \ 833 all-bundles 834 835 ################################################################################ 836 837 # Traditional targets typically run by users. 838 # These can be considered aliases for the targets now named by a more 839 # "modern" naming scheme. 840 default: $(DEFAULT_MAKE_TARGET) 841 jdk: exploded-image 842 images: product-images 843 docs: docs-image 844 bundles: all-bundles 845 all: all-images 846 847 ALL_TARGETS += default jdk images docs bundles all 848 849 ################################################################################ 850 ################################################################################ 851 # 852 # Clean targets 853 # 854 ################################################################################ 855 # Clean targets are automatically run serially by the Makefile calling this 856 # file. 857 858 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ 859 images make-support test-make bundles buildjdk 860 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) 861 CLEAN_SUPPORT_DIRS += demos 862 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS)) 863 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib 864 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) 865 CLEAN_PHASES := gensrc java native include docs 866 CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) 867 CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) 868 # Construct targets of the form clean-$module-$phase 869 CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ 870 $(addprefix $m-, $(CLEAN_PHASES)))) 871 872 # Remove everything, except the output from configure. 873 clean: $(CLEAN_DIR_TARGETS) 874 ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*) 875 $(ECHO) Cleaned all build artifacts. 876 877 $(CLEAN_DIR_TARGETS): 878 $(call CleanDir,$(patsubst clean-%, %, $@)) 879 880 $(CLEAN_SUPPORT_DIR_TARGETS): 881 $(call CleanSupportDir,$(patsubst clean-%, %, $@)) 882 883 $(CLEAN_TEST_TARGETS): 884 $(call CleanTest,$(patsubst clean-test-%, %, $@)) 885 886 $(CLEAN_PHASE_TARGETS): 887 $(call Clean-$(patsubst clean-%,%, $@)) 888 889 $(CLEAN_MODULE_TARGETS): 890 $(call CleanModule,$(patsubst clean-%, %, $@)) 891 892 $(CLEAN_MODULE_PHASE_TARGETS): 893 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \ 894 $(word 2, $(subst -,$(SPACE),$@))) 895 896 # When removing the support dir, we must also remove jdk. Building classes has 897 # the side effect of generating native headers. The headers end up in support 898 # while classes and touch files end up in jdk. 899 clean-support: clean-jdk 900 901 # Remove everything, including configure configuration. If the output 902 # directory was created by configure and now becomes empty, remove it as well. 903 dist-clean: clean 904 ($(CD) $(OUTPUT_ROOT) && \ 905 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide) 906 $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 907 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 908 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 909 else \ 910 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \ 911 && $(RM) -r $(OUTPUT_ROOT)) \ 912 fi \ 913 ) 914 $(ECHO) Cleaned everything, you will have to re-run configure. 915 916 ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \ 917 $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \ 918 $(CLEAN_MODULE_PHASE_TARGETS) 919 920 ################################################################################ 921 # Declare *-only targets for each normal target 922 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) 923 924 ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) 925 926 ################################################################################ 927 928 # Include JPRT targets 929 include $(SRC_ROOT)/make/Jprt.gmk 930 931 ################################################################################ 932 933 # The following targets are intentionally not added to ALL_TARGETS since they 934 # are internal only, to support Init.gmk. 935 936 print-targets: 937 @$(ECHO) $(sort $(ALL_TARGETS)) 938 939 print-modules: 940 @$(ECHO) $(sort $(ALL_MODULES)) 941 942 create-main-targets-include: 943 $(call LogInfo, Generating main target list) 944 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ 945 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk 946 947 ################################################################################ 948 949 .PHONY: $(ALL_TARGETS) 950 951 FRC: # Force target