Main.gmk revision 2072:8c014913a48d
1219820Sjeff# 2219820Sjeff# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3219820Sjeff# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4219820Sjeff# 5219820Sjeff# This code is free software; you can redistribute it and/or modify it 6219820Sjeff# under the terms of the GNU General Public License version 2 only, as 7219820Sjeff# published by the Free Software Foundation. Oracle designates this 8219820Sjeff# particular file as subject to the "Classpath" exception as provided 9219820Sjeff# by Oracle in the LICENSE file that accompanied this code. 10219820Sjeff# 11219820Sjeff# This code is distributed in the hope that it will be useful, but WITHOUT 12219820Sjeff# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13219820Sjeff# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14219820Sjeff# version 2 for more details (a copy is included in the LICENSE file that 15219820Sjeff# accompanied this code). 16219820Sjeff# 17219820Sjeff# You should have received a copy of the GNU General Public License version 18219820Sjeff# 2 along with this work; if not, write to the Free Software Foundation, 19219820Sjeff# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20219820Sjeff# 21219820Sjeff# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22219820Sjeff# or visit www.oracle.com if you need additional information or have any 23219820Sjeff# questions. 24219820Sjeff# 25219820Sjeff 26219820Sjeff################################################################################ 27219820Sjeff# This is the main makefile containing most actual top level targets. It needs 28219820Sjeff# to be called with a SPEC file defined. 29219820Sjeff################################################################################ 30219820Sjeff 31219820Sjeff# Declare default target 32219820Sjeffdefault: 33219820Sjeff 34219820Sjeffifeq ($(wildcard $(SPEC)),) 35219820Sjeff $(error Main.gmk needs SPEC set to a proper spec.gmk) 36219820Sjeffendif 37219820Sjeff 38219820Sjeff# Now load the spec 39219820Sjeffinclude $(SPEC) 40219820Sjeff 41219820Sjeffinclude $(SRC_ROOT)/make/MainSupport.gmk 42219820Sjeff 43219820Sjeff# Load the vital tools for all the makefiles. 44219820Sjeffinclude $(SRC_ROOT)/make/common/MakeBase.gmk 45219820Sjeffinclude $(SRC_ROOT)/make/common/Modules.gmk 46219820Sjeff 47219820Sjeff# Declare ALL_TARGETS as an immediate variable. This variable is a list of all 48219820Sjeff# valid top level targets. It's used to declare them all as PHONY and to 49219820Sjeff# generate the -only targets. 50219820SjeffALL_TARGETS := 51219820Sjeff 52219820Sjeff# Hook to include the corresponding custom file, if present. 53219820Sjeff$(eval $(call IncludeCustomExtension, , Main.gmk)) 54219820Sjeff 55219820Sjeff# All modules for the current target platform. 56219820SjeffALL_MODULES := $(call FindAllModules) 57219820Sjeff 58219820Sjeff################################################################################ 59219820Sjeff################################################################################ 60219820Sjeff# 61219820Sjeff# Recipes for all targets. Only recipes, dependencies are declared later. 62219820Sjeff# 63219820Sjeff################################################################################ 64219820Sjeff 65219820Sjeff################################################################################ 66219820Sjeff# Interim/build tools targets, compiling tools used during the build 67219820Sjeff 68219820Sjeffbuildtools-langtools: 69219820Sjeff +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk) 70219820Sjeff 71219820Sjeffinterim-langtools: 72219820Sjeff +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk) 73219820Sjeff 74219820Sjeffinterim-rmic: 75219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk) 76219820Sjeff 77219820Sjeffinterim-cldrconverter: 78219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk) 79219820Sjeff 80219820Sjeffbuildtools-jdk: 81219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk) 82219820Sjeff 83219820SjeffALL_TARGETS += buildtools-langtools interim-langtools \ 84219820Sjeff interim-rmic interim-cldrconverter buildtools-jdk 85219820Sjeff 86219820Sjeff################################################################################ 87219820Sjeff# Special targets for certain modules 88219820Sjeff 89219820Sjeffimport-hotspot: 90219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk) 91219820Sjeff 92219820Sjeffunpack-sec: 93219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk) 94219820Sjeff 95219820Sjeffgenerate-exported-symbols: 96219820Sjeff +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk) 97219820Sjeff 98219820SjeffALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols 99219820Sjeff 100219820Sjeff################################################################################ 101219820Sjeff# Gensrc targets, generating source before java compilation can be done 102219820Sjeff$(eval $(call DeclareRecipesForPhase, GENSRC, \ 103219820Sjeff TARGET_SUFFIX := gensrc, \ 104219820Sjeff FILE_PREFIX := Gensrc, \ 105219820Sjeff MAKE_SUBDIR := gensrc, \ 106219820Sjeff CHECK_MODULES := $(ALL_MODULES), \ 107219820Sjeff MULTIPLE_MAKEFILES := true)) 108219820Sjeff 109219820SjeffJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS)) 110219820SjeffLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS)) 111219820SjeffCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS)) 112219820SjeffHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS)) 113219820Sjeff 114219820SjeffGENSRC_MODULEINFO_MODULES := $(ALL_MODULES) 115219820SjeffGENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \ 116219820Sjeff $(GENSRC_MODULEINFO_MODULES)) 117219820Sjeff 118219820SjeffGENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES) 119219820SjeffGENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \ 120219820Sjeff $(addsuffix -gensrc, $(GENSRC_MODULES))) 121219820Sjeff 122219820Sjeffdefine DeclareModuleInfoRecipe 123219820Sjeff $1-gensrc-moduleinfo: 124219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 125219820Sjeff -f GensrcModuleInfo.gmk MODULE=$1) 126219820Sjeff 127219820Sjeff $1-gensrc: $1-gensrc-moduleinfo 128219820Sjeffendef 129219820Sjeff 130219820Sjeff$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m))) 131219820Sjeff 132219820SjeffALL_TARGETS += $(GENSRC_TARGETS) 133219820Sjeff 134219820Sjeff################################################################################ 135219820Sjeff# Generate data targets 136219820Sjeff$(eval $(call DeclareRecipesForPhase, GENDATA, \ 137219820Sjeff TARGET_SUFFIX := gendata, \ 138219820Sjeff FILE_PREFIX := Gendata, \ 139219820Sjeff MAKE_SUBDIR := gendata, \ 140219820Sjeff CHECK_MODULES := $(ALL_MODULES), \ 141219820Sjeff USE_WRAPPER := true)) 142219820Sjeff 143219820SjeffALL_TARGETS += $(GENDATA_TARGETS) 144219820Sjeff 145219820Sjeff################################################################################ 146219820Sjeff# Copy files targets 147219820Sjeff$(eval $(call DeclareRecipesForPhase, COPY, \ 148219820Sjeff TARGET_SUFFIX := copy, \ 149219820Sjeff FILE_PREFIX := Copy, \ 150219820Sjeff MAKE_SUBDIR := copy, \ 151219820Sjeff CHECK_MODULES := $(ALL_MODULES), \ 152219820Sjeff USE_WRAPPER := true, \ 153219820Sjeff MULTIPLE_MAKEFILES := true)) 154219820Sjeff 155219820SjeffALL_COPY_MODULES += $(COPY_MODULES) 156219820SjeffALL_COPY_TARGETS += $(COPY_TARGETS) 157219820Sjeff 158219820SjeffIMPORT_COPY_MODULES := $(call FindImportedModules) 159219820SjeffIMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES)) 160219820SjeffALL_COPY_MODULES += $(IMPORT_COPY_MODULES) 161219820SjeffALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS) 162219820Sjeff 163219820Sjeffdefine DeclareImportCopyRecipe 164219820Sjeff $1-copy: 165219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 166219820Sjeff -f CopyImportModules.gmk MODULE=$1) 167219820Sjeffendef 168219820Sjeff 169219820Sjeff$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m))) 170219820Sjeff 171219820SjeffALL_TARGETS += $(ALL_COPY_TARGETS) 172219820Sjeff 173219820Sjeff################################################################################ 174219820Sjeff# Targets for compiling all java modules. Nashorn is treated separately. 175219820SjeffJAVA_MODULES := $(ALL_MODULES) 176219820SjeffJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) 177219820Sjeff 178219820Sjeffdefine DeclareCompileJavaRecipe 179219820Sjeff $1-java: 180219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ 181219820Sjeff -f CompileJavaModules.gmk MODULE=$1) 182219820Sjeffendef 183219820Sjeff 184219820Sjeff$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \ 185219820Sjeff $(eval $(call DeclareCompileJavaRecipe,$m))) 186219820Sjeff 187219820Sjeff# Build nashorn. Needs to be compiled separately from the rest of the modules 188219820Sjeff# due to nasgen. 189219820Sjeffjdk.scripting.nashorn-java: 190219820Sjeff +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ 191219820Sjeff -f BuildNashorn.gmk compile) 192219820Sjeff 193219820SjeffALL_TARGETS += $(JAVA_TARGETS) 194219820Sjeff 195219820Sjeff################################################################################ 196219820Sjeff# Targets for running rmic. 197219820Sjeff$(eval $(call DeclareRecipesForPhase, RMIC, \ 198219820Sjeff TARGET_SUFFIX := rmic, \ 199219820Sjeff FILE_PREFIX := Rmic, \ 200219820Sjeff MAKE_SUBDIR := rmic, \ 201219820Sjeff CHECK_MODULES := $(ALL_MODULES))) 202219820Sjeff 203219820SjeffALL_TARGETS += $(RMIC_TARGETS) 204219820Sjeff 205219820Sjeff################################################################################ 206219820Sjeff# Targets for compiling native libraries 207219820Sjeff$(eval $(call DeclareRecipesForPhase, LIBS, \ 208219820Sjeff TARGET_SUFFIX := libs, \ 209219820Sjeff FILE_PREFIX := Lib, \ 210219820Sjeff MAKE_SUBDIR := lib, \ 211219820Sjeff CHECK_MODULES := $(ALL_MODULES), \ 212219820Sjeff USE_WRAPPER := true)) 213219820Sjeff 214219820SjeffALL_TARGETS += $(LIBS_TARGETS) 215219820Sjeff 216219820Sjeff################################################################################ 217219820Sjeff# Targets for compiling native executables 218219820Sjeff$(eval $(call DeclareRecipesForPhase, LAUNCHER, \ 219219820Sjeff TARGET_SUFFIX := launchers, \ 220219820Sjeff FILE_PREFIX := Launcher, \ 221219820Sjeff MAKE_SUBDIR := launcher, \ 222219820Sjeff CHECK_MODULES := $(ALL_MODULES), \ 223219820Sjeff USE_WRAPPER := true)) 224219820Sjeff 225219820SjeffALL_TARGETS += $(LAUNCHER_TARGETS) 226219820Sjeff 227219820Sjeff################################################################################ 228219820Sjeff# Build hotspot target 229219820Sjeff 230219820Sjeffifeq ($(BUILD_HOTSPOT),true) 231219820Sjeffhotspot: 232219820Sjeff +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) 233219820Sjeffendif 234219820Sjeff 235219820Sjeffhotspot-ide-project: 236219820Sjeff +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) 237219820Sjeff 238219820SjeffALL_TARGETS += hotspot hotspot-ide-project 239219820Sjeff 240219820Sjeff################################################################################ 241219820Sjeff# Build demos and samples targets 242219820Sjeff 243219820Sjeffdemos-jdk: 244219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) 245219820Sjeff 246219820Sjeffsamples-jdk: 247219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk) 248219820Sjeff 249219820SjeffALL_TARGETS += demos-jdk samples-jdk 250219820Sjeff 251219820Sjeff################################################################################ 252219820Sjeff# Jigsaw specific data and analysis targets. 253219820Sjeff 254219820Sjeffgenerate-summary: 255219820Sjeff +($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk) 256219820Sjeff 257219820SjeffALL_TARGETS += generate-summary 258219820Sjeff 259219820Sjeff################################################################################ 260219820Sjeff# Strip binaries targets 261219820Sjeff 262219820SjeffSTRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \ 263219820Sjeff $(GENDATA_MODULES)) 264219820SjeffSTRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES)) 265219820Sjeff 266219820Sjeffdefine DeclareStripRecipe 267219820Sjeff $1-strip: 268219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \ 269219820Sjeff MODULE=$1) 270219820Sjeffendef 271219820Sjeff 272219820Sjeff$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m))) 273219820Sjeff 274219820SjeffALL_TARGETS += $(STRIP_TARGETS) 275219820Sjeff 276219820Sjeff################################################################################ 277219820Sjeff# Jmod targets 278219820Sjeff 279219820SjeffJMOD_MODULES := $(ALL_MODULES) 280219820SjeffJMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES)) 281219820Sjeff 282219820Sjeffdefine DeclareJmodRecipe 283219820Sjeff $1-jmod: 284219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \ 285219820Sjeff MODULE=$1) 286219820Sjeffendef 287219820Sjeff 288219820Sjeff$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m))) 289219820Sjeff 290219820SjeffALL_TARGETS += $(JMOD_TARGETS) 291219820Sjeff 292219820Sjeff################################################################################ 293219820Sjeff# Images targets 294219820Sjeff 295219820Sjeff# Stores the tips for each repository. This file is be used when constructing the jdk image and can be 296219820Sjeff# used to track the exact sources used to build that image. 297219820Sjeffsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips 298219820Sjeff$(SUPPORT_OUTPUTDIR)/source_tips: FRC 299219820Sjeff $(call MakeDir, $(@D)) 300219820Sjeff @$(RM) $@ 301219820Sjeff @$(call GetSourceTips) 302219820Sjeff 303219820SjeffBOOTCYCLE_TARGET := product-images 304219820Sjeffbootcycle-images: 305219820Sjeff @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 306219820Sjeff +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ 307219820Sjeff JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main 308219820Sjeff 309219820Sjeffzip-security: 310219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) 311219820Sjeff 312219820Sjeffzip-source: 313219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk) 314219820Sjeff 315219820Sjeffjrtfs-jar: 316219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk) 317219820Sjeff 318219820Sjeffjimages: 319219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages) 320219820Sjeff 321219820Sjeffprofiles: 322219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles) 323219820Sjeff 324219820Sjeffmac-bundles-jdk: 325219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk) 326219820Sjeff 327219820SjeffALL_TARGETS += source-tips bootcycle-images zip-security zip-source \ 328219820Sjeff jrtfs-jar jimages profiles mac-bundles-jdk 329219820Sjeff 330219820Sjeff################################################################################ 331219820Sjeff# Docs targets 332219820Sjeff 333219820Sjeffdocs-javadoc: 334219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 335219820Sjeff 336219820Sjeffdocs-jvmtidoc: 337219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs) 338219820Sjeff 339219820Sjeffzip-docs: docs-javadoc docs-jvmtidoc 340219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk zip-docs) 341219820Sjeff 342219820SjeffALL_TARGETS += docs-javadoc docs-jvmtidoc 343219820Sjeff 344219820Sjeff################################################################################ 345219820Sjeff# Cross compilation support 346219820Sjeff 347219820Sjeffifeq ($(CREATE_BUILDJDK), true) 348219820Sjeff # This target is only called by the recursive call below. 349219820Sjeff create-buildjdk-compile-hotspot-helper: hotspot 350219820Sjeff create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy \ 351219820Sjeff jdk.jdeps-launchers 352219820Sjeffendif 353219820Sjeff 354219820Sjeffcreate-buildjdk-copy: 355219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk) 356219820Sjeff 357219820Sjeffcreate-buildjdk-compile-hotspot create-buildjdk-compile-modules: 358219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \ 359219820Sjeff $@-helper \ 360219820Sjeff SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 361219820Sjeff HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \ 362219820Sjeff CREATING_BUILDJDK=true) 363219820Sjeff 364219820SjeffALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \ 365219820Sjeff create-buildjdk-compile-modules 366219820Sjeff 367219820Sjeff################################################################################ 368219820Sjeff# Build tests 369219820Sjeff# 370219820Sjeff 371219820Sjeffprepare-test-image: 372219820Sjeff $(MKDIR) -p $(TEST_IMAGE_DIR) 373219820Sjeff $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' 374219820Sjeff 375219820Sjeffbuild-test-hotspot-jtreg-native: 376219820Sjeff +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 377219820Sjeff build-test-hotspot-jtreg-native) 378219820Sjeff 379219820Sjefftest-image-hotspot-jtreg-native: 380219820Sjeff +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 381219820Sjeff test-image-hotspot-jtreg-native) 382219820Sjeff 383219820Sjeffbuild-test-jdk-jtreg-native: 384219820Sjeff +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 385219820Sjeff build-test-jdk-jtreg-native) 386219820Sjeff 387219820Sjefftest-image-jdk-jtreg-native: 388219820Sjeff +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ 389219820Sjeff test-image-jdk-jtreg-native) 390219820Sjeff 391219820Sjeffbuild-test-lib: 392219820Sjeff +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk) 393219820Sjeff 394219820Sjeffifeq ($(BUILD_FAILURE_HANDLER), true) 395219820Sjeff # Builds the failure handler jtreg extension 396219820Sjeff build-test-failure-handler: 397219820Sjeff +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 398219820Sjeff -f BuildFailureHandler.gmk build) 399219820Sjeff 400219820Sjeff # Runs the tests for the failure handler jtreg extension 401219820Sjeff test-failure-handler: 402219820Sjeff +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 403219820Sjeff -f BuildFailureHandler.gmk test) 404219820Sjeff 405219820Sjeff # Copies the failure handler jtreg extension into the test image 406219820Sjeff test-image-failure-handler: 407219820Sjeff +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \ 408219820Sjeff -f BuildFailureHandler.gmk images) 409219820Sjeffendif 410219820Sjeff 411219820SjeffALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \ 412219820Sjeff test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \ 413219820Sjeff test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \ 414219820Sjeff test-failure-handler test-image-failure-handler 415219820Sjeff 416219820Sjeff################################################################################ 417219820Sjeff# Run tests 418219820Sjeff 419219820Sjeff# Run tests specified by $(TEST), or the default test set. 420219820Sjefftest: 421219820Sjeff $(call RunTests, $(TEST)) 422219820Sjeff 423219820Sjefftest-hotspot-jtreg: 424219820Sjeff $(call RunTests, "hotspot_all") 425219820Sjeff 426219820Sjefftest-hotspot-jtreg-native: 427219820Sjeff $(call RunTests, "hotspot_native_sanity") 428219820Sjeff 429219820Sjefftest-hotspot-internal: 430219820Sjeff $(call RunTests, "hotspot_internal") 431219820Sjeff 432219820Sjefftest-jdk-jtreg-native: 433219820Sjeff $(call RunTests, "jdk_native_sanity") 434219820Sjeff 435219820Sjefftest-make: 436219820Sjeff ($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) 437219820Sjeff 438219820SjeffALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \ 439219820Sjeff test-hotspot-internal test-jdk-jtreg-native test-make 440219820Sjeff 441219820Sjeff################################################################################ 442219820Sjeff# Install targets 443219820Sjeff 444219820Sjeffinstall: 445219820Sjeff +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk) 446219820Sjeff 447219820SjeffALL_TARGETS += install 448219820Sjeff 449219820Sjeff################################################################################ 450219820Sjeff# 451219820Sjeff# Dependency declarations between targets. 452219820Sjeff# 453219820Sjeff# These are declared in two groups. First all dependencies between targets that 454219820Sjeff# have recipes above as these dependencies may be disabled. Then the aggregator 455219820Sjeff# targets that do not have recipes of their own, which will never have their 456219820Sjeff# dependencies disabled. 457219820Sjeff# 458219820Sjeff################################################################################ 459219820Sjeff# Targets with recipes above 460219820Sjeff 461219820Sjeff# If running an *-only target, parallel execution and dependencies between 462219820Sjeff# recipe targets are disabled. This makes it possible to run a select set of 463219820Sjeff# recipe targets in order. It's the responsibility of the user to make sure 464219820Sjeff# all prerequisites are fulfilled. 465219820Sjeffifneq ($(findstring -only, $(MAKECMDGOALS)), ) 466219820Sjeff .NOTPARALLEL: 467219820Sjeffelse 468219820Sjeff $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools 469219820Sjeff 470219820Sjeff interim-langtools: $(LANGTOOLS_GENSRC_TARGETS) 471219820Sjeff 472219820Sjeff buildtools-jdk: interim-langtools interim-cldrconverter 473219820Sjeff 474219820Sjeff $(CORBA_GENSRC_TARGETS): interim-langtools 475219820Sjeff 476219820Sjeff $(HOTSPOT_GENSRC_TARGETS): interim-langtools 477219820Sjeff 478219820Sjeff $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk 479219820Sjeff 480219820Sjeff $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk 481219820Sjeff 482219820Sjeff $(GENDATA_TARGETS): interim-langtools buildtools-jdk 483219820Sjeff 484219820Sjeff interim-rmic: interim-langtools 485219820Sjeff 486219820Sjeff $(RMIC_TARGETS): interim-langtools interim-rmic 487219820Sjeff 488219820Sjeff $(JAVA_TARGETS): interim-langtools 489219820Sjeff 490219820Sjeff hotspot-ide-project: hotspot exploded-image 491219820Sjeff 492219820Sjeff import-hotspot: hotspot 493219820Sjeff 494219820Sjeff generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs 495219820Sjeff 496219820Sjeff $(LIBS_TARGETS): import-hotspot 497219820Sjeff 498 $(LAUNCHER_TARGETS): java.base-libs 499 500 ifeq ($(STATIC_BUILD), true) 501 $(LAUNCHER_TARGETS): generate-exported-symbols 502 endif 503 504 # The demos are currently linking to libjvm and libjava, just like all other 505 # jdk libs, even though they don't need to. To avoid warnings, make sure they 506 # aren't built until after libjava and libjvm are available to link to. 507 demos-jdk: $(JAVA_TARGETS) 508 509 # Declare dependency from <module>-java to <module>-gensrc 510 $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) 511 512 # Declare dependencies between java modules 513 $(foreach m, $(JAVA_MODULES), \ 514 $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \ 515 $(call FindDepsForModule,$m))))) 516 517 # Declare dependencies between <module>-rmic to <module>-java 518 $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java)) 519 520 # Declare dependencies from <module>-lib to <module>-java 521 # Skip modules that do not have java source. When creating a BUILD_JDK, the 522 # java compilation has already been done by the normal build and copied in. 523 ifneq ($(CREATING_BUILDJDK), true) 524 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java)) 525 endif 526 527 # Declare dependencies from all other <module>-lib to java.base-lib 528 $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \ 529 $(eval $t: java.base-libs)) 530 531 # jdk.accessibility depends on java.desktop 532 jdk.accessibility-libs: java.desktop-libs 533 534 # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 535 # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a 536 # virtual target. 537 jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc 538 539 # The swing beans need to have java base properly generated to avoid errors 540 # in javadoc. 541 java.desktop-gensrc-jdk: java.base-gensrc 542 543 # The annotation processing for jdk.vm.ci needs java.base classes from the 544 # current JDK. 545 jdk.vm.ci-gensrc-hotspot: java.base-java 546 547 # Explicitly add dependencies for special targets 548 java.base-java: unpack-sec 549 550 # The copy target copies files generated by gensrc 551 java.base-copy-hotspot: java.base-gensrc-hotspot 552 553 jdk.jdeps-gendata: java rmic 554 555 # Declare dependencies from <module>-strip to libs, launchers, gendata and copy 556 $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs)) 557 $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers)) 558 $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata)) 559 $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy)) 560 561 # Declare dependencies between jmod targets 562 $(foreach m, $(JMOD_MODULES), \ 563 $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m)))) 564 565 # Declare dependencies from <module>-jmod to all other module targets 566 $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip)) 567 $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java)) 568 $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata)) 569 $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic)) 570 $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs)) 571 $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers)) 572 $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy)) 573 574 # Jmods cannot be created until we have the jlink tool ready to run, which requires 575 # all java modules to be compiled and jdk.jlink-launchers. 576 $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers 577 578 ifeq ($(CREATE_BUILDJDK), true) 579 $(JMOD_TARGETS): create-buildjdk 580 endif 581 582 zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \ 583 $(filter jdk.crypto%, $(JAVA_TARGETS)) 584 585 zip-source: gensrc rmic 586 587 jrtfs-jar: interim-langtools 588 589 jimages: jmods zip-source source-tips demos samples jrtfs-jar 590 591 profiles: jmods zip-source source-tips jrtfs-jar 592 593 mac-bundles-jdk: jimages 594 595 bootcycle-images: jimages 596 597 docs-javadoc: $(GENSRC_TARGETS) rmic 598 599 docs-jvmtidoc: hotspot 600 601 test: jimages test-image 602 603 create-buildjdk-copy: jdk.jlink-java java.base-gendata 604 605 create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot 606 607 test-make: clean-test-make 608 609 build-test-lib: java 610 611 build-test-failure-handler: interim-langtools 612 613 test-failure-handler: build-test-failure-handler 614 615 test-image-failure-handler: build-test-failure-handler 616 617 build-test-hotspot-jtreg-native: buildtools-jdk 618 619 build-test-jdk-jtreg-native: buildtools-jdk 620 621 test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native 622 623 test-image-jdk-jtreg-native: build-test-jdk-jtreg-native 624 625 test-hotspot-internal: exploded-image 626 627 test-hotspot-jtreg: jimages test-image 628 629 install: product-images 630 631 generate-summary: jmods 632 633endif 634 635################################################################################ 636# Virtual targets without recipes 637 638buildtools: buildtools-langtools interim-langtools interim-rmic \ 639 buildtools-jdk 640 641gensrc: $(GENSRC_TARGETS) 642 643gendata: $(GENDATA_TARGETS) 644 645copy: $(ALL_COPY_TARGETS) 646 647java: $(JAVA_TARGETS) 648 649rmic: $(RMIC_TARGETS) 650 651libs: $(LIBS_TARGETS) 652 653launchers: $(LAUNCHER_TARGETS) 654 655jmods: $(JMOD_TARGETS) 656 657strip-binaries: $(STRIP_TARGETS) 658 659# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which 660# is actually handled by jdk.jdi-gensrc 661jdk.jdwp.agent-gensrc: jdk.jdi-gensrc 662 663# Declare dependencies from <module> to all the individual targets specific 664# to that module <module>-*, that are needed for the exploded image. 665$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc)) 666$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java)) 667$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata)) 668$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic)) 669$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs)) 670$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers)) 671$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy)) 672demos: demos-jdk 673 674samples: samples-jdk 675 676# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. 677exploded-image: $(ALL_MODULES) 678 679create-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \ 680 create-buildjdk-compile-hotspot 681 682mac-bundles: mac-bundles-jdk 683 684# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, 685# and in line with this, our targets for creating these are named *-image[s]. 686 687# This target builds the product images, e.g. the JRE and JDK image 688# (and possibly other, more specific versions) 689product-images: jimages demos samples zip-security exploded-image 690 691# When cross compiling and building a partial BUILDJDK for the build host, 692# the summary generation cannot be run. 693ifneq ($(CREATE_BUILDJDK), true) 694 product-images: generate-summary 695endif 696 697ifeq ($(OPENJDK_TARGET_OS), macosx) 698 product-images: mac-bundles 699endif 700 701# This target builds the documentation image 702docs-image: zip-docs 703 704# This target builds the test image 705test-image: prepare-test-image test-image-hotspot-jtreg-native \ 706 test-image-jdk-jtreg-native test-image-failure-handler 707 708# all-images is the top-most target, it builds all our deliverables ("images"). 709all-images: product-images test-image docs-image 710 711ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \ 712 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \ 713 create-buildjdk mac-bundles product-images docs-image test-image all-images 714 715################################################################################ 716 717# Traditional targets typically run by users. 718# These can be considered aliases for the targets now named by a more 719# "modern" naming scheme. 720default: $(DEFAULT_MAKE_TARGET) 721jdk: exploded-image 722images: product-images 723docs: docs-image 724all: all-images 725 726ALL_TARGETS += default jdk images docs all zip-docs 727 728################################################################################ 729################################################################################ 730# 731# Clean targets 732# 733################################################################################ 734# Clean targets are automatically run serially by the Makefile calling this 735# file. 736 737CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ 738 images make-support test-make bundles buildjdk 739CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) 740CLEAN_SUPPORT_DIRS += demos 741CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS)) 742CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib 743CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) 744CLEAN_PHASES := gensrc java native include docs 745CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) 746CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) 747# Construct targets of the form clean-$module-$phase 748CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ 749 $(addprefix $m-, $(CLEAN_PHASES)))) 750 751# Remove everything, except the output from configure. 752clean: $(CLEAN_DIR_TARGETS) 753 ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*) 754 $(ECHO) Cleaned all build artifacts. 755 756$(CLEAN_DIR_TARGETS): 757 $(call CleanDir,$(patsubst clean-%, %, $@)) 758 759$(CLEAN_SUPPORT_DIR_TARGETS): 760 $(call CleanSupportDir,$(patsubst clean-%, %, $@)) 761 762$(CLEAN_TEST_TARGETS): 763 $(call CleanTest,$(patsubst clean-test-%, %, $@)) 764 765$(CLEAN_PHASE_TARGETS): 766 $(call Clean-$(patsubst clean-%,%, $@)) 767 768$(CLEAN_MODULE_TARGETS): 769 $(call CleanModule,$(patsubst clean-%, %, $@)) 770 771$(CLEAN_MODULE_PHASE_TARGETS): 772 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \ 773 $(word 2, $(subst -,$(SPACE),$@))) 774 775# When removing the support dir, we must also remove jdk. Building classes has 776# the side effect of generating native headers. The headers end up in support 777# while classes and touch files end up in jdk. 778clean-support: clean-jdk 779 780# Remove everything, including configure configuration. If the output 781# directory was created by configure and now becomes empty, remove it as well. 782dist-clean: clean 783 ($(CD) $(OUTPUT_ROOT) && \ 784 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide) 785 $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 786 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 787 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 788 else \ 789 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \ 790 && $(RM) -r $(OUTPUT_ROOT)) \ 791 fi \ 792 ) 793 $(ECHO) Cleaned everything, you will have to re-run configure. 794 795ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \ 796 $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \ 797 $(CLEAN_MODULE_PHASE_TARGETS) 798 799################################################################################ 800# Declare *-only targets for each normal target 801$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) 802 803ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) 804 805################################################################################ 806 807# Include JPRT targets 808include $(SRC_ROOT)/make/Jprt.gmk 809 810################################################################################ 811 812# The following targets are intentionally not added to ALL_TARGETS since they 813# are internal only, to support Init.gmk. 814 815print-targets: 816 @$(ECHO) $(sort $(ALL_TARGETS)) 817 818print-modules: 819 @$(ECHO) $(sort $(ALL_MODULES)) 820 821create-main-targets-include: 822 $(call LogInfo, Generating main target list) 823 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ 824 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk 825 826################################################################################ 827 828.PHONY: $(ALL_TARGETS) 829 830FRC: # Force target 831