Main.gmk revision 2024:cc16e2a24f94
138494Sobrien# 2310490Scy# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 338494Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 438494Sobrien# 538494Sobrien# This code is free software; you can redistribute it and/or modify it 638494Sobrien# under the terms of the GNU General Public License version 2 only, as 738494Sobrien# published by the Free Software Foundation. Oracle designates this 838494Sobrien# particular file as subject to the "Classpath" exception as provided 938494Sobrien# by Oracle in the LICENSE file that accompanied this code. 1038494Sobrien# 1138494Sobrien# This code is distributed in the hope that it will be useful, but WITHOUT 1238494Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1338494Sobrien# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1438494Sobrien# version 2 for more details (a copy is included in the LICENSE file that 1538494Sobrien# accompanied this code). 1638494Sobrien# 1738494Sobrien# You should have received a copy of the GNU General Public License version 1838494Sobrien# 2 along with this work; if not, write to the Free Software Foundation, 19310490Scy# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2038494Sobrien# 2138494Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2238494Sobrien# or visit www.oracle.com if you need additional information or have any 2338494Sobrien# questions. 2438494Sobrien# 2538494Sobrien 2638494Sobrien################################################################################ 2738494Sobrien# This is the main makefile containing most actual top level targets. It needs 2838494Sobrien# to be called with a SPEC file defined. 2938494Sobrien################################################################################ 3038494Sobrien 3138494Sobrien# Declare default target 3238494Sobriendefault: 3338494Sobrien 3438494Sobrienifeq ($(wildcard $(SPEC)),) 3538494Sobrien $(error Main.gmk needs SPEC set to a proper spec.gmk) 36174294Sobrienendif 3738494Sobrien 3838494Sobrien# Now load the spec 3938494Sobrieninclude $(SPEC) 4038494Sobrien 4138494Sobrieninclude $(SRC_ROOT)/make/MainSupport.gmk 4238494Sobrien 4338494Sobrien# Load the vital tools for all the makefiles. 4438494Sobrieninclude $(SRC_ROOT)/make/common/MakeBase.gmk 4538494Sobrieninclude $(SRC_ROOT)/make/common/Modules.gmk 4638494Sobrien 4738494Sobrien# Declare ALL_TARGETS as an immediate variable. This variable is a list of all 4838494Sobrien# valid top level targets. It's used to declare them all as PHONY and to 4938494Sobrien# generate the -only targets. 5038494SobrienALL_TARGETS := 5138494Sobrien 5238494Sobrien# Hook to include the corresponding custom file, if present. 5338494Sobrien$(eval $(call IncludeCustomExtension, , Main.gmk)) 5438494Sobrien 55310490Scy# All modules for the current target platform. 5638494SobrienALL_MODULES := $(call FindAllModules) 5738494Sobrien 5838494Sobrien################################################################################ 5938494Sobrien################################################################################ 6038494Sobrien# 6138494Sobrien# Recipes for all targets. Only recipes, dependencies are declared later. 6238494Sobrien# 6338494Sobrien################################################################################ 6438494Sobrien 6538494Sobrien################################################################################ 6638494Sobrien# Interim/build tools targets, compiling tools used during the build 6738494Sobrien 6838494Sobrienbuildtools-langtools: 6938494Sobrien +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk) 7038494Sobrien 7138494Sobrieninterim-langtools: 7238494Sobrien +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk) 7338494Sobrien 7438494Sobrieninterim-rmic: 7538494Sobrien +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk) 7638494Sobrien 7738494Sobrieninterim-cldrconverter: 7838494Sobrien +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk) 7938494Sobrien 8038494Sobrienbuildtools-jdk: 8138494Sobrien +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk) 8238494Sobrien 8338494SobrienALL_TARGETS += buildtools-langtools interim-langtools \ 8438494Sobrien interim-rmic interim-cldrconverter buildtools-jdk 8538494Sobrien 8638494Sobrien################################################################################ 8738494Sobrien# Special targets for certain modules 8838494Sobrien 8938494Sobrienimport-hotspot: 9038494Sobrien +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk) 9138494Sobrien 9238494Sobrienunpack-sec: 9338494Sobrien +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk) 9438494Sobrien 9538494Sobriengenerate-exported-symbols: 9638494Sobrien +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk) 9738494Sobrien 9838494SobrienALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols 9938494Sobrien 10038494Sobrien################################################################################ 10138494Sobrien# Gensrc targets, generating source before java compilation can be done 10238494Sobrien$(eval $(call DeclareRecipesForPhase, GENSRC, \ 10338494Sobrien TARGET_SUFFIX := gensrc, \ 10438494Sobrien FILE_PREFIX := Gensrc, \ 105 MAKE_SUBDIR := gensrc, \ 106 CHECK_MODULES := $(ALL_MODULES), \ 107 MULTIPLE_MAKEFILES := true)) 108 109JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS)) 110LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS)) 111CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS)) 112HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS)) 113 114GENSRC_MODULEINFO_MODULES := $(ALL_MODULES) 115GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \ 116 $(GENSRC_MODULEINFO_MODULES)) 117 118GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES) 119GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \ 120 $(addsuffix -gensrc, $(GENSRC_MODULES))) 121 122define DeclareModuleInfoRecipe 123 $1-gensrc-moduleinfo: 124 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 125 -f GensrcModuleInfo.gmk MODULE=$1) 126 127 $1-gensrc: $1-gensrc-moduleinfo 128endef 129 130$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m))) 131 132ALL_TARGETS += $(GENSRC_TARGETS) 133 134################################################################################ 135# Generate data targets 136$(eval $(call DeclareRecipesForPhase, GENDATA, \ 137 TARGET_SUFFIX := gendata, \ 138 FILE_PREFIX := Gendata, \ 139 MAKE_SUBDIR := gendata, \ 140 CHECK_MODULES := $(ALL_MODULES), \ 141 USE_WRAPPER := true)) 142 143ALL_TARGETS += $(GENDATA_TARGETS) 144 145################################################################################ 146# Copy files targets 147$(eval $(call DeclareRecipesForPhase, COPY, \ 148 TARGET_SUFFIX := copy, \ 149 FILE_PREFIX := Copy, \ 150 MAKE_SUBDIR := copy, \ 151 CHECK_MODULES := $(ALL_MODULES), \ 152 USE_WRAPPER := true, \ 153 MULTIPLE_MAKEFILES := true)) 154 155ALL_COPY_MODULES += $(COPY_MODULES) 156ALL_COPY_TARGETS += $(COPY_TARGETS) 157 158IMPORT_COPY_MODULES := $(call FindImportedModules) 159IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES)) 160ALL_COPY_MODULES += $(IMPORT_COPY_MODULES) 161ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS) 162 163define DeclareImportCopyRecipe 164 $1-copy: 165 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 166 -f CopyImportModules.gmk MODULE=$1) 167endef 168 169$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m))) 170 171ALL_TARGETS += $(ALL_COPY_TARGETS) 172 173################################################################################ 174# Targets for compiling all java modules. Nashorn is treated separately. 175JAVA_MODULES := $(ALL_MODULES) 176JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) 177 178define DeclareCompileJavaRecipe 179 $1-java: 180 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 181 -f CompileJavaModules.gmk MODULE=$1) 182endef 183 184$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \ 185 $(eval $(call DeclareCompileJavaRecipe,$m))) 186 187# Build nashorn. Needs to be compiled separately from the rest of the modules 188# due to nasgen. 189jdk.scripting.nashorn-java: 190 +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 191 -f BuildNashorn.gmk compile) 192 193ALL_TARGETS += $(JAVA_TARGETS) 194 195################################################################################ 196# Targets for running rmic. 197$(eval $(call DeclareRecipesForPhase, RMIC, \ 198 TARGET_SUFFIX := rmic, \ 199 FILE_PREFIX := Rmic, \ 200 MAKE_SUBDIR := rmic, \ 201 CHECK_MODULES := $(ALL_MODULES))) 202 203ALL_TARGETS += $(RMIC_TARGETS) 204 205################################################################################ 206# Targets for compiling native libraries 207$(eval $(call DeclareRecipesForPhase, LIBS, \ 208 TARGET_SUFFIX := libs, \ 209 FILE_PREFIX := Lib, \ 210 MAKE_SUBDIR := lib, \ 211 CHECK_MODULES := $(ALL_MODULES), \ 212 USE_WRAPPER := true)) 213 214ALL_TARGETS += $(LIBS_TARGETS) 215 216################################################################################ 217# Targets for compiling native executables 218$(eval $(call DeclareRecipesForPhase, LAUNCHER, \ 219 TARGET_SUFFIX := launchers, \ 220 FILE_PREFIX := Launcher, \ 221 MAKE_SUBDIR := launcher, \ 222 CHECK_MODULES := $(ALL_MODULES), \ 223 USE_WRAPPER := true)) 224 225ALL_TARGETS += $(LAUNCHER_TARGETS) 226 227################################################################################ 228# Build hotspot target 229 230ifeq ($(BUILD_HOTSPOT),true) 231 hotspot: 232 ifeq ($(USE_NEW_HOTSPOT_BUILD), true) 233 +($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) 234 else 235 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) 236 endif 237endif 238 239hotspot-ide-project: 240 +($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) 241 242ALL_TARGETS += hotspot hotspot-ide-project 243 244################################################################################ 245# Build demos and samples targets 246 247demos-jdk: 248 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) 249 250samples-jdk: 251 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk) 252 253ALL_TARGETS += demos-jdk samples-jdk 254 255################################################################################ 256# Jigsaw specific data and analysis targets. 257 258generate-summary: 259 +($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk) 260 261ALL_TARGETS += generate-summary 262 263################################################################################ 264# Strip binaries targets 265 266STRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \ 267 $(GENDATA_MODULES)) 268STRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES)) 269 270define DeclareStripRecipe 271 $1-strip: 272 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \ 273 MODULE=$1) 274endef 275 276$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m))) 277 278ALL_TARGETS += $(STRIP_TARGETS) 279 280################################################################################ 281# Jmod targets 282 283JMOD_MODULES := $(ALL_MODULES) 284JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES)) 285 286define DeclareJmodRecipe 287 $1-jmod: 288 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 289 MODULE=$1) 290endef 291 292$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m))) 293 294ALL_TARGETS += $(JMOD_TARGETS) 295 296################################################################################ 297# Images targets 298 299# Stores the tips for each repository. This file is be used when constructing the jdk image and can be 300# used to track the exact sources used to build that image. 301source-tips: $(SUPPORT_OUTPUTDIR)/source_tips 302$(SUPPORT_OUTPUTDIR)/source_tips: FRC 303 $(call MakeDir, $(@D)) 304 @$(RM) $@ 305 @$(call GetSourceTips) 306 307BOOTCYCLE_TARGET := product-images 308bootcycle-images: 309 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 310 +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ 311 JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main 312 313zip-security: 314 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) 315 316zip-source: 317 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk) 318 319jrtfs-jar: 320 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk) 321 322jimages: 323 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages) 324 325profiles: 326 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles) 327 328mac-bundles-jdk: 329 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk) 330 331ALL_TARGETS += source-tips bootcycle-images zip-security zip-source \ 332 jrtfs-jar jimages profiles mac-bundles-jdk 333 334################################################################################ 335# Docs targets 336 337docs-javadoc: 338 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 339 340docs-jvmtidoc: 341 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs) 342 343ALL_TARGETS += docs-javadoc docs-jvmtidoc 344 345################################################################################ 346# Cross compilation support 347 348ifeq ($(CREATE_BUILDJDK), true) 349 # This target is only called by the recursive call below. 350 create-buildjdk-compile-hotspot-helper: hotspot 351 create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy 352endif 353 354create-buildjdk-copy: 355 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk) 356 357create-buildjdk-compile-hotspot create-buildjdk-compile-modules: 358 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \ 359 $@-helper \ 360 SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 361 HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 362 CREATING_BUILDJDK=true) 363 364ALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \ 365 create-buildjdk-compile-modules 366 367################################################################################ 368# Build tests 369# 370 371prepare-test-image: 372 $(MKDIR) -p $(TEST_IMAGE_DIR) 373 $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' 374 375build-test-hotspot-jtreg-native: 376 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 377 build-test-hotspot-jtreg-native) 378 379test-image-hotspot-jtreg-native: 380 +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 381 test-image-hotspot-jtreg-native) 382 383build-test-jdk-jtreg-native: 384 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 385 build-test-jdk-jtreg-native) 386 387test-image-jdk-jtreg-native: 388 +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 389 test-image-jdk-jtreg-native) 390 391build-test-lib: 392 +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk) 393 394ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \ 395 test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \ 396 test-image-jdk-jtreg-native build-test-lib 397 398################################################################################ 399# Run tests 400 401# Run tests specified by $(TEST), or the default test set. 402test: 403 $(call RunTests, $(TEST)) 404 405test-hotspot-jtreg: 406 $(call RunTests, "hotspot_all") 407 408test-hotspot-jtreg-native: 409 $(call RunTests, "hotspot_native_sanity") 410 411test-hotspot-internal: 412 $(call RunTests, "hotspot_internal") 413 414test-jdk-jtreg-native: 415 $(call RunTests, "jdk_native_sanity") 416 417test-make: 418 ($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) 419 420ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \ 421 test-hotspot-internal test-jdk-jtreg-native test-make 422 423################################################################################ 424# Install targets 425 426install: 427 +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk) 428 429ALL_TARGETS += install 430 431################################################################################ 432# 433# Dependency declarations between targets. 434# 435# These are declared in two groups. First all dependencies between targets that 436# have recipes above as these dependencies may be disabled. Then the aggregator 437# targets that do not have recipes of their own, which will never have their 438# dependencies disabled. 439# 440################################################################################ 441# Targets with recipes above 442 443# If running an *-only target, parallel execution and dependencies between 444# recipe targets are disabled. This makes it possible to run a select set of 445# recipe targets in order. It's the responsibility of the user to make sure 446# all prerequisites are fulfilled. 447ifneq ($(findstring -only, $(MAKECMDGOALS)), ) 448 .NOTPARALLEL: 449else 450 $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools 451 452 interim-langtools: $(LANGTOOLS_GENSRC_TARGETS) 453 454 buildtools-jdk: interim-langtools interim-cldrconverter 455 456 $(CORBA_GENSRC_TARGETS): interim-langtools 457 458 $(HOTSPOT_GENSRC_TARGETS): interim-langtools 459 460 $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk 461 462 $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk 463 464 $(GENDATA_TARGETS): interim-langtools buildtools-jdk 465 466 interim-rmic: interim-langtools 467 468 $(RMIC_TARGETS): interim-langtools interim-rmic 469 470 $(JAVA_TARGETS): interim-langtools 471 472 hotspot-ide-project: hotspot exploded-image 473 474 import-hotspot: hotspot 475 476 generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs 477 478 $(LIBS_TARGETS): import-hotspot 479 480 $(LAUNCHER_TARGETS): java.base-libs 481 482 ifeq ($(STATIC_BUILD), true) 483 $(LAUNCHER_TARGETS): generate-exported-symbols 484 endif 485 486 # The demos are currently linking to libjvm and libjava, just like all other 487 # jdk libs, even though they don't need to. To avoid warnings, make sure they 488 # aren't built until after libjava and libjvm are available to link to. 489 demos-jdk: $(JAVA_TARGETS) 490 491 # Declare dependency from <module>-java to <module>-gensrc 492 $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) 493 494 # Declare dependencies between java modules 495 $(foreach m, $(JAVA_MODULES), \ 496 $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \ 497 $(call FindDepsForModule,$m))))) 498 499 # Declare dependencies between <module>-rmic to <module>-java 500 $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java)) 501 502 # Declare dependencies from <module>-lib to <module>-java 503 # Skip modules that do not have java source. When creating a BUILD_JDK, the 504 # java compilation has already been done by the normal build and copied in. 505 ifneq ($(CREATING_BUILDJDK), true) 506 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java)) 507 endif 508 509 # Declare dependencies from all other <module>-lib to java.base-lib 510 $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \ 511 $(eval $t: java.base-libs)) 512 513 # jdk.accessibility depends on java.desktop 514 jdk.accessibility-libs: java.desktop-libs 515 516 # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 517 # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a 518 # virtual target. 519 jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc 520 521 # The swing beans need to have java base properly generated to avoid errors 522 # in javadoc. 523 java.desktop-gensrc-jdk: java.base-gensrc 524 525 # The annotation processing for jdk.vm.ci needs java.base classes from the 526 # current JDK. 527 jdk.vm.ci-gensrc-hotspot: java.base-java 528 529 # Explicitly add dependencies for special targets 530 java.base-java: unpack-sec 531 532 # The copy target copies files generated by gensrc 533 java.base-copy-hotspot: java.base-gensrc-hotspot 534 535 jdk.jdeps-gendata: java rmic 536 537 # Declare dependencies from <module>-strip to libs, launchers, gendata and copy 538 $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs)) 539 $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers)) 540 $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata)) 541 $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy)) 542 543 # Declare dependencies between jmod targets 544 $(foreach m, $(JMOD_MODULES), \ 545 $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m)))) 546 547 # Declare dependencies from <module>-jmod to all other module targets 548 $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip)) 549 $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java)) 550 $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata)) 551 $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic)) 552 $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs)) 553 $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers)) 554 $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy)) 555 556 # Jmods cannot be created until we have the jlink tool ready to run, which requires 557 # all java modules to be compiled and jdk.jlink-launchers. 558 $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers 559 560 ifeq ($(CREATE_BUILDJDK), true) 561 $(JMOD_TARGETS): create-buildjdk 562 endif 563 564 zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \ 565 $(filter jdk.crypto%, $(JAVA_TARGETS)) 566 567 zip-source: gensrc rmic 568 569 jrtfs-jar: interim-langtools 570 571 jimages: jmods zip-source source-tips demos samples jrtfs-jar 572 573 profiles: jmods zip-source source-tips jrtfs-jar 574 575 mac-bundles-jdk: jimages 576 577 bootcycle-images: jimages 578 579 docs-javadoc: $(GENSRC_TARGETS) rmic 580 581 docs-jvmtidoc: hotspot 582 583 test: jimages test-image 584 585 create-buildjdk-copy: jdk.jlink-java java.base-gendata 586 587 create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot 588 589 test-make: clean-test-make 590 591 build-test-lib: java 592 593 build-test-hotspot-jtreg-native: buildtools-jdk 594 595 build-test-jdk-jtreg-native: buildtools-jdk 596 597 test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native 598 599 test-image-jdk-jtreg-native: build-test-jdk-jtreg-native 600 601 test-hotspot-internal: exploded-image 602 603 test-hotspot-jtreg: jimages test-image 604 605 install: product-images 606 607 generate-summary: jmods 608 609endif 610 611################################################################################ 612# Virtual targets without recipes 613 614buildtools: buildtools-langtools interim-langtools interim-rmic \ 615 buildtools-jdk 616 617gensrc: $(GENSRC_TARGETS) 618 619gendata: $(GENDATA_TARGETS) 620 621copy: $(ALL_COPY_TARGETS) 622 623java: $(JAVA_TARGETS) 624 625rmic: $(RMIC_TARGETS) 626 627libs: $(LIBS_TARGETS) 628 629launchers: $(LAUNCHER_TARGETS) 630 631jmods: $(JMOD_TARGETS) 632 633strip-binaries: $(STRIP_TARGETS) 634 635# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which 636# is actually handled by jdk.jdi-gensrc 637jdk.jdwp.agent-gensrc: jdk.jdi-gensrc 638 639# Declare dependencies from <module> to all the individual targets specific 640# to that module <module>-*, that are needed for the exploded image. 641$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc)) 642$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java)) 643$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata)) 644$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic)) 645$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) 646$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) 647$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) 648demos: demos-jdk 649 650samples: samples-jdk 651 652# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. 653exploded-image: $(ALL_MODULES) 654 655create-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \ 656 create-buildjdk-compile-hotspot 657 658mac-bundles: mac-bundles-jdk 659 660# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, 661# and in line with this, our targets for creating these are named *-image[s]. 662 663# This target builds the product images, e.g. the JRE and JDK image 664# (and possibly other, more specific versions) 665product-images: jimages demos samples zip-security exploded-image 666 667# When cross compiling and building a partial BUILDJDK for the build host, 668# the summary generation cannot be run. 669ifneq ($(CREATE_BUILDJDK), true) 670 product-images: generate-summary 671endif 672 673ifeq ($(OPENJDK_TARGET_OS), macosx) 674 product-images: mac-bundles 675endif 676 677# This target builds the documentation image 678docs-image: docs-javadoc docs-jvmtidoc 679 680# This target builds the test image 681test-image: prepare-test-image test-image-hotspot-jtreg-native \ 682 test-image-jdk-jtreg-native 683 684# all-images is the top-most target, it builds all our deliverables ("images"). 685all-images: product-images test-image docs-image 686 687ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \ 688 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \ 689 create-buildjdk mac-bundles product-images docs-image test-image all-images 690 691################################################################################ 692 693# Traditional targets typically run by users. 694# These can be considered aliases for the targets now named by a more 695# "modern" naming scheme. 696default: $(DEFAULT_MAKE_TARGET) 697jdk: exploded-image 698images: product-images 699docs: docs-image 700all: all-images 701 702ALL_TARGETS += default jdk images docs all 703 704################################################################################ 705################################################################################ 706# 707# Clean targets 708# 709################################################################################ 710# Clean targets are automatically run serially by the Makefile calling this 711# file. 712 713CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ 714 images make-support test-make bundles buildjdk 715CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) 716CLEAN_SUPPORT_DIRS += demos 717CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS)) 718CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib 719CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) 720CLEAN_PHASES := gensrc java native include docs 721CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) 722CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) 723# Construct targets of the form clean-$module-$phase 724CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ 725 $(addprefix $m-, $(CLEAN_PHASES)))) 726 727# Remove everything, except the output from configure. 728clean: $(CLEAN_DIR_TARGETS) 729 ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*) 730 $(ECHO) Cleaned all build artifacts. 731 732$(CLEAN_DIR_TARGETS): 733 $(call CleanDir,$(patsubst clean-%, %, $@)) 734 735$(CLEAN_SUPPORT_DIR_TARGETS): 736 $(call CleanSupportDir,$(patsubst clean-%, %, $@)) 737 738$(CLEAN_TEST_TARGETS): 739 $(call CleanTest,$(patsubst clean-test-%, %, $@)) 740 741$(CLEAN_PHASE_TARGETS): 742 $(call Clean-$(patsubst clean-%,%, $@)) 743 744$(CLEAN_MODULE_TARGETS): 745 $(call CleanModule,$(patsubst clean-%, %, $@)) 746 747$(CLEAN_MODULE_PHASE_TARGETS): 748 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \ 749 $(word 2, $(subst -,$(SPACE),$@))) 750 751# When removing the support dir, we must also remove jdk. Building classes has 752# the side effect of generating native headers. The headers end up in support 753# while classes and touch files end up in jdk. 754clean-support: clean-jdk 755 756# Remove everything, including configure configuration. If the output 757# directory was created by configure and now becomes empty, remove it as well. 758dist-clean: clean 759 ($(CD) $(OUTPUT_ROOT) && \ 760 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide) 761 $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 762 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 763 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 764 else \ 765 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \ 766 && $(RM) -r $(OUTPUT_ROOT)) \ 767 fi \ 768 ) 769 $(ECHO) Cleaned everything, you will have to re-run configure. 770 771ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \ 772 $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \ 773 $(CLEAN_MODULE_PHASE_TARGETS) 774 775################################################################################ 776# Declare *-only targets for each normal target 777$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) 778 779ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) 780 781################################################################################ 782 783# Include JPRT targets 784include $(SRC_ROOT)/make/Jprt.gmk 785 786################################################################################ 787 788# The following targets are intentionally not added to ALL_TARGETS since they 789# are internal only, to support Init.gmk. 790 791print-targets: 792 @$(ECHO) $(sort $(ALL_TARGETS)) 793 794print-modules: 795 @$(ECHO) $(sort $(ALL_MODULES)) 796 797create-main-targets-include: 798 $(call LogInfo, Generating main target list) 799 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ 800 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk 801 802################################################################################ 803 804.PHONY: $(ALL_TARGETS) 805 806FRC: # Force target 807