Main.gmk revision 2381:74485ef9aacb
133965Sjdp#
2218822Sdim# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3218822Sdim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433965Sjdp#
5130561Sobrien# This code is free software; you can redistribute it and/or modify it
633965Sjdp# under the terms of the GNU General Public License version 2 only, as
733965Sjdp# published by the Free Software Foundation.  Oracle designates this
833965Sjdp# particular file as subject to the "Classpath" exception as provided
933965Sjdp# by Oracle in the LICENSE file that accompanied this code.
1033965Sjdp#
1133965Sjdp# This code is distributed in the hope that it will be useful, but WITHOUT
1233965Sjdp# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1333965Sjdp# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1433965Sjdp# version 2 for more details (a copy is included in the LICENSE file that
1533965Sjdp# accompanied this code).
1633965Sjdp#
1733965Sjdp# You should have received a copy of the GNU General Public License version
1833965Sjdp# 2 along with this work; if not, write to the Free Software Foundation,
1933965Sjdp# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2033965Sjdp#
21218822Sdim# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22218822Sdim# or visit www.oracle.com if you need additional information or have any
2333965Sjdp# questions.
2433965Sjdp#
2533965Sjdp
2633965Sjdp################################################################################
27218822Sdim# This is the main makefile containing most actual top level targets. It needs
2833965Sjdp# to be called with a SPEC file defined.
2933965Sjdp################################################################################
3033965Sjdp
31218822Sdim# Declare default target
3233965Sjdpdefault:
3333965Sjdp
3433965Sjdpifeq ($(wildcard $(SPEC)),)
3533965Sjdp  $(error Main.gmk needs SPEC set to a proper spec.gmk)
3633965Sjdpendif
3733965Sjdp
3833965Sjdp# Now load the spec
3933965Sjdpinclude $(SPEC)
4033965Sjdp
4133965Sjdpinclude $(SRC_ROOT)/make/MainSupport.gmk
4233965Sjdp
4333965Sjdp# Load the vital tools for all the makefiles.
4433965Sjdpinclude $(SRC_ROOT)/make/common/MakeBase.gmk
4533965Sjdpinclude $(SRC_ROOT)/make/common/Modules.gmk
4633965Sjdp
47130561Sobrien# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48130561Sobrien# valid top level targets. It's used to declare them all as PHONY and to
49130561Sobrien# generate the -only targets.
50130561SobrienALL_TARGETS :=
51130561Sobrien
52130561Sobrien# Hook to include the corresponding custom file, if present.
53130561Sobrien$(eval $(call IncludeCustomExtension, , Main.gmk))
54130561Sobrien
55218822Sdim# All modules for the current target platform.
5633965SjdpALL_MODULES := $(call FindAllModules)
5733965Sjdp
5833965Sjdp################################################################################
5933965Sjdp################################################################################
6033965Sjdp#
6133965Sjdp# Recipes for all targets. Only recipes, dependencies are declared later.
6233965Sjdp#
6333965Sjdp################################################################################
6433965Sjdp
6533965Sjdp################################################################################
6633965Sjdp# Interim/build tools targets, compiling tools used during the build
6733965Sjdp
6833965Sjdp# When creating a BUILDJDK, the buildtools and interim targets have already
6933965Sjdp# been built and should not be built again.
70130561Sobrienifneq ($(CREATING_BUILDJDK), true)
71130561Sobrien  buildtools-langtools:
72130561Sobrien	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
73130561Sobrien
74130561Sobrien  interim-langtools:
75130561Sobrien	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
76130561Sobrien
7733965Sjdp  interim-rmic:
7833965Sjdp	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
79130561Sobrien
80130561Sobrien  interim-cldrconverter:
81130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
82130561Sobrien
83130561Sobrien  buildtools-jdk:
84130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
85130561Sobrien
86130561Sobrien  buildtools-modules:
87130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk)
88130561Sobrienendif
89130561Sobrien
90130561SobrienALL_TARGETS += buildtools-langtools interim-langtools \
91130561Sobrien    interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules
92130561Sobrien
93130561Sobrien################################################################################
94130561Sobrien# Special targets for certain modules
95130561Sobrien
96130561Sobrienunpack-sec:
97130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
98130561Sobrien
99130561Sobriengenerate-exported-symbols:
100130561Sobrien	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
101130561Sobrien
102130561SobrienALL_TARGETS += unpack-sec generate-exported-symbols
103130561Sobrien
104130561Sobrien################################################################################
105130561Sobrien# Gensrc targets, generating source before java compilation can be done
106130561Sobrien#
107130561Sobrien# When creating a BUILDJDK, the java targets have already been built and copied
108130561Sobrien# into the buildjdk so no need to generate sources.
109130561Sobrienifneq ($(CREATING_BUILDJDK), true)
110130561Sobrien  $(eval $(call DeclareRecipesForPhase, GENSRC, \
111130561Sobrien      TARGET_SUFFIX := gensrc, \
112130561Sobrien      FILE_PREFIX := Gensrc, \
113130561Sobrien      MAKE_SUBDIR := gensrc, \
114130561Sobrien      CHECK_MODULES := $(ALL_MODULES), \
115130561Sobrien      MULTIPLE_MAKEFILES := true))
116130561Sobrien
117130561Sobrien  JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
118130561Sobrien  LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
119130561Sobrien  CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
120130561Sobrien  HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
121130561Sobrien
122130561Sobrien  GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
123130561Sobrien  GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
124130561Sobrien      $(GENSRC_MODULEINFO_MODULES))
125130561Sobrien
126130561Sobrien  GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
127130561Sobrien  GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
128130561Sobrien      $(addsuffix -gensrc, $(GENSRC_MODULES)))
129130561Sobrien
130130561Sobrien  define DeclareModuleInfoRecipe
131130561Sobrien    $1-gensrc-moduleinfo:
132130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
133130561Sobrien	    -f GensrcModuleInfo.gmk MODULE=$1)
134130561Sobrien
135130561Sobrien    $1-gensrc: $1-gensrc-moduleinfo
136130561Sobrien  endef
137130561Sobrien
138130561Sobrien  $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
139130561Sobrienendif
140130561Sobrien
141130561SobrienALL_TARGETS += $(GENSRC_TARGETS)
142130561Sobrien
143130561Sobrien################################################################################
144130561Sobrien# Generate data targets
145130561Sobrien$(eval $(call DeclareRecipesForPhase, GENDATA, \
146130561Sobrien    TARGET_SUFFIX := gendata, \
147130561Sobrien    FILE_PREFIX := Gendata, \
148130561Sobrien    MAKE_SUBDIR := gendata, \
149130561Sobrien    CHECK_MODULES := $(ALL_MODULES), \
150130561Sobrien    USE_WRAPPER := true))
151130561Sobrien
152130561SobrienALL_TARGETS += $(GENDATA_TARGETS)
153130561Sobrien
154130561Sobrien################################################################################
155130561Sobrien# Copy files targets
156130561Sobrien$(eval $(call DeclareRecipesForPhase, COPY, \
157130561Sobrien    TARGET_SUFFIX := copy, \
158130561Sobrien    FILE_PREFIX := Copy, \
159130561Sobrien    MAKE_SUBDIR := copy, \
160130561Sobrien    CHECK_MODULES := $(ALL_MODULES), \
161130561Sobrien    USE_WRAPPER := true, \
162130561Sobrien    MULTIPLE_MAKEFILES := true))
163130561Sobrien
164130561SobrienALL_COPY_MODULES += $(COPY_MODULES)
165130561SobrienALL_COPY_TARGETS += $(COPY_TARGETS)
166130561Sobrien
167130561SobrienIMPORT_COPY_MODULES := $(call FindImportedModules)
168130561SobrienIMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
169130561SobrienALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
170130561SobrienALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
171130561Sobrien
172130561Sobriendefine DeclareImportCopyRecipe
173130561Sobrien  $1-copy:
174130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
175130561Sobrien	    -f CopyImportModules.gmk MODULE=$1)
176130561Sobrienendef
177130561Sobrien
178130561Sobrien$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
179130561Sobrien
180130561SobrienALL_TARGETS += $(ALL_COPY_TARGETS)
181130561Sobrien
182130561Sobrien################################################################################
183130561Sobrien# Targets for compiling all java modules. Nashorn is treated separately.
184130561SobrienJAVA_MODULES := $(ALL_MODULES)
185130561SobrienJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
186130561Sobrien
187130561Sobriendefine DeclareCompileJavaRecipe
188130561Sobrien  $1-java:
189130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
190130561Sobrien	    -f CompileJavaModules.gmk MODULE=$1)
191130561Sobrienendef
192130561Sobrien
193130561Sobrien$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
194130561Sobrien    $(eval $(call DeclareCompileJavaRecipe,$m)))
19533965Sjdp
19633965Sjdp# Build nashorn. Needs to be compiled separately from the rest of the modules
19733965Sjdp# due to nasgen.
19833965Sjdpjdk.scripting.nashorn-java:
19933965Sjdp	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
20033965Sjdp	    -f BuildNashorn.gmk compile)
20133965Sjdp
20233965SjdpALL_TARGETS += $(JAVA_TARGETS)
20333965Sjdp
20433965Sjdp################################################################################
20533965Sjdp# Targets for running rmic.
20633965Sjdp$(eval $(call DeclareRecipesForPhase, RMIC, \
20733965Sjdp    TARGET_SUFFIX := rmic, \
20833965Sjdp    FILE_PREFIX := Rmic, \
20933965Sjdp    MAKE_SUBDIR := rmic, \
21033965Sjdp    CHECK_MODULES := $(ALL_MODULES)))
21133965Sjdp
21233965SjdpALL_TARGETS += $(RMIC_TARGETS)
21333965Sjdp
21433965Sjdp################################################################################
21533965Sjdp# Targets for compiling native libraries
21633965Sjdp$(eval $(call DeclareRecipesForPhase, LIBS, \
21733965Sjdp    TARGET_SUFFIX := libs, \
21833965Sjdp    FILE_PREFIX := Lib, \
21933965Sjdp    MAKE_SUBDIR := lib, \
22033965Sjdp    CHECK_MODULES := $(ALL_MODULES), \
22133965Sjdp    USE_WRAPPER := true))
22233965Sjdp
22333965SjdpALL_TARGETS += $(LIBS_TARGETS)
22433965Sjdp
22533965Sjdp################################################################################
22633965Sjdp# Targets for compiling native executables
22733965Sjdp$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
22833965Sjdp    TARGET_SUFFIX := launchers, \
22933965Sjdp    FILE_PREFIX := Launcher, \
23033965Sjdp    MAKE_SUBDIR := launcher, \
23133965Sjdp    CHECK_MODULES := $(ALL_MODULES), \
23233965Sjdp    USE_WRAPPER := true))
23333965Sjdp
23433965SjdpALL_TARGETS += $(LAUNCHER_TARGETS)
23533965Sjdp
23633965Sjdp################################################################################
23733965Sjdp# Build hotspot target
23833965Sjdp
23933965SjdpHOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS))
24033965SjdpHOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS))
24133965SjdpHOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS))
24233965Sjdp
243130561Sobriendefine DeclareHotspotGensrcRecipe
244130561Sobrien  hotspot-$1-gensrc:
245130561Sobrien	$$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)')
246130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f gensrc/GenerateSources.gmk \
247130561Sobrien	    JVM_VARIANT=$1)
248130561Sobrienendef
249130561Sobrien
250130561Sobrien$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v)))
251130561Sobrien
252130561Sobriendefine DeclareHotspotLibsRecipe
253130561Sobrien  hotspot-$1-libs:
254130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibraries.gmk \
255130561Sobrien	    JVM_VARIANT=$1)
256130561Sobrienendef
257130561Sobrien
258130561Sobrien$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))
259130561Sobrien
260130561Sobrienhotspot-jsig:
261130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibjsig.gmk)
262130561Sobrien
263130561Sobrienhotspot-ide-project:
264130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk)
265130561Sobrien
266130561SobrienALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
267130561Sobrien    $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
268130561Sobrien
269130561Sobrien################################################################################
270130561Sobrien# Build demos and samples targets
271130561Sobrien
272130561Sobriendemos-jdk:
273130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
274130561Sobrien
275130561Sobriensamples-jdk:
276130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
277130561Sobrien
278130561SobrienALL_TARGETS += demos-jdk samples-jdk
279130561Sobrien
280130561Sobrien################################################################################
281130561Sobrien# Jigsaw specific data and analysis targets.
282130561Sobrien
283130561Sobriengenerate-summary:
284130561Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk)
285130561Sobrien
286130561SobrienALL_TARGETS += generate-summary
287130561Sobrien
288130561Sobrien################################################################################
289130561Sobrien# Jmod targets
290130561Sobrien
29133965SjdpJMOD_MODULES := $(ALL_MODULES)
29233965SjdpJMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
293130561Sobrien
294130561Sobriendefine DeclareJmodRecipe
295130561Sobrien  $1-jmod:
29633965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
29733965Sjdp	    MODULE=$1)
29833965Sjdpendef
29933965Sjdp
30033965Sjdp$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
30133965Sjdp
30233965SjdpALL_TARGETS += $(JMOD_TARGETS)
303130561Sobrien
304130561Sobrien################################################################################
305130561Sobrien# Images targets
306130561Sobrien
30733965Sjdpstore-source-revision:
308130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk store-source-revision)
309130561Sobrien
310130561Sobriencreate-source-revision-tracker:
311130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk create-source-revision-tracker)
312130561Sobrien
313130561SobrienBOOTCYCLE_TARGET := product-images
314130561Sobrienbootcycle-images:
315130561Sobrien        ifneq ($(COMPILE_TYPE), cross)
316130561Sobrien	  $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
317130561Sobrien	  +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
31833965Sjdp	      JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
31933965Sjdp        else
32033965Sjdp	  $(call LogWarn, Boot cycle build disabled when cross compiling)
32133965Sjdp        endif
32233965Sjdp
323130561Sobrienzip-security:
32433965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
32533965Sjdp
32633965Sjdpzip-source:
32733965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
32833965Sjdp
32933965Sjdpjrtfs-jar:
33033965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
33133965Sjdp
33233965Sjdpjdk-image:
333130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk)
334130561Sobrien
33533965Sjdpjre-image:
33633965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre)
33733965Sjdp
33833965Sjdpsymbols-image:
339130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
34033965Sjdp
34133965Sjdpprofiles:
34233965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
34333965Sjdp
34433965Sjdpmac-bundles-jdk:
34533965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
34633965Sjdp
34733965Sjdprelease-file:
34833965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ReleaseFile.gmk)
34933965Sjdp
350130561Sobrienexploded-image-optimize:
35133965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk)
35233965Sjdp
35333965SjdpALL_TARGETS += store-source-revision create-source-revision-tracker bootcycle-images zip-security \
35433965Sjdp    zip-source jrtfs-jar jdk-image jre-image \
355130561Sobrien    symbols-image profiles mac-bundles-jdk \
356130561Sobrien    release-file exploded-image-optimize
35733965Sjdp
35833965Sjdp################################################################################
35933965Sjdp# Docs targets
36033965Sjdp
36133965Sjdpdocs-javadoc:
36233965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javadoc)
36333965Sjdp
36433965Sjdpdocs-copy:
36533965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-copy)
36633965Sjdp
367130561Sobriendocs-zip:
36833965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip)
36933965Sjdp
37033965SjdpALL_TARGETS += docs-javadoc docs-copy docs-zip
37133965Sjdp
372130561Sobrien################################################################################
373130561Sobrien# Cross compilation support
37433965Sjdp
37533965Sjdpifeq ($(CREATING_BUILDJDK), true)
37633965Sjdp  # This target is only called by the recursive call below.
37733965Sjdp  create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
378130561Sobrien      java.base-copy jdk.jdeps-launchers
37933965Sjdpendif
38033965Sjdp
38133965Sjdpcreate-buildjdk-copy:
38233965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
38333965Sjdp
38433965Sjdpcreate-buildjdk-interim-image:
38533965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
38633965Sjdp	    $@-helper \
387130561Sobrien	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
38833965Sjdp	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
38933965Sjdp	    CREATING_BUILDJDK=true)
390130561Sobrien
391130561SobrienALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image
392130561Sobrien
393130561Sobrien################################################################################
394130561Sobrien# The interim-image is a small jlinked image that is used to generate artifacts
395130561Sobrien# at build time for use when linking the real images.
396130561Sobrien
397130561SobrienINTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES))
398130561Sobrien
399130561Sobriendefine DeclareInterimJmodRecipe
400130561Sobrien  $1-interim-jmod:
401130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
402130561Sobrien	    MODULE=$1 \
403130561Sobrien	    JMODS_DIR=$(INTERIM_JMODS_DIR) \
404130561Sobrien	    JMODS_TEMPDIR=$(INTERIM_JMODS_DIR)/temp \
405130561Sobrien	    INTERIM_JMOD=true \
406130561Sobrien	)
407130561Sobrienendef
408130561Sobrien
409130561Sobrien$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m)))
41033965Sjdp
41133965Sjdpinterim-image:
41233965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f InterimImage.gmk)
41333965Sjdp
414130561Sobrienifeq ($(ENABLE_GENERATE_CLASSLIST), true)
415130561Sobrien  generate-link-opt-data:
41633965Sjdp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f GenerateLinkOptData.gmk)
41733965Sjdpendif
41833965Sjdp
41933965SjdpALL_TARGETS += $(INTERIM_JMOD_TARGETS) interim-image generate-link-opt-data
42033965Sjdp
42133965Sjdp################################################################################
42233965Sjdp# Build tests
42333965Sjdp#
42433965Sjdp
42533965Sjdpprepare-test-image:
42633965Sjdp	$(MKDIR) -p $(TEST_IMAGE_DIR)
42733965Sjdp	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
42833965Sjdp
42933965Sjdpbuild-test-hotspot-jtreg-native:
43033965Sjdp	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
43133965Sjdp	    build-test-hotspot-jtreg-native)
43233965Sjdp
43333965Sjdptest-image-hotspot-jtreg-native:
43433965Sjdp	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
435130561Sobrien	    test-image-hotspot-jtreg-native)
43633965Sjdp
43733965Sjdpbuild-test-jdk-jtreg-native:
43833965Sjdp	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
43933965Sjdp	    build-test-jdk-jtreg-native)
44033965Sjdp
44133965Sjdptest-image-jdk-jtreg-native:
44233965Sjdp	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
44333965Sjdp	    test-image-jdk-jtreg-native)
444130561Sobrien
44533965Sjdpifeq ($(BUILD_GTEST), true)
44633965Sjdp  test-image-hotspot-gtest:
44733965Sjdp	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
448130561Sobrienendif
44933965Sjdp
45033965Sjdpbuild-test-lib:
45133965Sjdp	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
45233965Sjdp
45333965Sjdpifeq ($(BUILD_FAILURE_HANDLER), true)
45433965Sjdp  # Builds the failure handler jtreg extension
45533965Sjdp  build-test-failure-handler:
456130561Sobrien	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
457130561Sobrien	    -f BuildFailureHandler.gmk build)
45833965Sjdp
45933965Sjdp  # Runs the tests for the failure handler jtreg extension
46033965Sjdp  test-failure-handler:
46133965Sjdp	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
46233965Sjdp	    -f BuildFailureHandler.gmk test)
46333965Sjdp
464130561Sobrien  # Copies the failure handler jtreg extension into the test image
46533965Sjdp  test-image-failure-handler:
46633965Sjdp	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
467130561Sobrien	     -f BuildFailureHandler.gmk images)
46833965Sjdpendif
46933965Sjdp
47033965SjdpALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
47133965Sjdp    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
47233965Sjdp    test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
473130561Sobrien    test-failure-handler test-image-failure-handler test-image-hotspot-gtest
47433965Sjdp
47533965Sjdp################################################################################
47633965Sjdp# Run tests
47733965Sjdp
47833965Sjdp# Run tests specified by $(TEST), or the default test set.
47933965Sjdptest:
48033965Sjdp	$(call RunTests, $(TEST), $(JDK_IMAGE_DIR))
48133965Sjdp
48233965Sjdptest-hotspot-jtreg:
48333965Sjdp	$(call RunTests, "hotspot_all", $(JDK_IMAGE_DIR))
48433965Sjdp
48533965Sjdptest-hotspot-jtreg-native:
48633965Sjdp	$(call RunTests, "hotspot_native_sanity", $(JDK_IMAGE_DIR))
48733965Sjdp
48833965Sjdptest-hotspot-internal:
48933965Sjdp	$(call RunTests, "hotspot_internal", $(JDK_OUTPUTDIR))
49033965Sjdp
491130561Sobrientest-hotspot-gtest:
49233965Sjdp	$(call RunTests, "hotspot_gtest", $(JDK_OUTPUTDIR))
49333965Sjdp
49433965Sjdptest-jdk-jtreg-native:
49533965Sjdp	$(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR))
49633965Sjdp
49733965Sjdptest-make:
49833965Sjdp	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
49933965Sjdp
50033965SjdpALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
50133965Sjdp    test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make
50233965Sjdp
50333965Sjdp################################################################################
50433965Sjdp# Bundles
50533965Sjdp
50633965Sjdpproduct-bundles:
50733965Sjdp	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles)
50833965Sjdp
50933965Sjdptest-bundles:
51033965Sjdp	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles)
51133965Sjdp
512130561Sobriendocs-bundles:
513130561Sobrien	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles)
51433965Sjdp
51533965SjdpALL_TARGETS += product-bundles test-bundles docs-bundles
51633965Sjdp
51733965Sjdp################################################################################
51833965Sjdp# Install targets
51933965Sjdp
52033965Sjdpinstall:
521130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
52233965Sjdp
52333965SjdpALL_TARGETS += install
52433965Sjdp
52533965Sjdp################################################################################
526130561Sobrien#
527130561Sobrien# Dependency declarations between targets.
52833965Sjdp#
52933965Sjdp# These are declared in two groups. First all dependencies between targets that
53033965Sjdp# have recipes above as these dependencies may be disabled. Then the aggregator
53133965Sjdp# targets that do not have recipes of their own, which will never have their
53233965Sjdp# dependencies disabled.
53333965Sjdp#
53433965Sjdp################################################################################
535130561Sobrien# Targets with recipes above
53633965Sjdp
53733965Sjdp# If running an *-only target, parallel execution and dependencies between
53833965Sjdp# recipe targets are disabled. This makes it possible to run a select set of
53933965Sjdp# recipe targets in order. It's the responsibility of the user to make sure
540130561Sobrien# all prerequisites are fulfilled.
541130561Sobrienifneq ($(findstring -only, $(MAKECMDGOALS)), )
54233965Sjdp  .NOTPARALLEL:
54333965Sjdpelse
54433965Sjdp  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
54533965Sjdp
54633965Sjdp  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
54733965Sjdp
54833965Sjdp  buildtools-jdk: interim-langtools interim-cldrconverter
54933965Sjdp
550130561Sobrien  buildtools-modules: exploded-image-base
551130561Sobrien
55233965Sjdp  $(CORBA_GENSRC_TARGETS): interim-langtools
55333965Sjdp
55433965Sjdp  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
55533965Sjdp
55633965Sjdp  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
55733965Sjdp
55833965Sjdp  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
55933965Sjdp
560130561Sobrien  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
561130561Sobrien
56233965Sjdp  interim-rmic: interim-langtools
56333965Sjdp
56433965Sjdp  $(RMIC_TARGETS): interim-langtools interim-rmic
56533965Sjdp
56633965Sjdp  $(JAVA_TARGETS): interim-langtools
56733965Sjdp
56833965Sjdp  # Declare dependencies between hotspot-<variant>* targets
56933965Sjdp  $(foreach v, $(JVM_VARIANTS), \
57033965Sjdp      $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
57133965Sjdp      $(eval hotspot-$v-libs: hotspot-$v-gensrc) \
572130561Sobrien  )
573130561Sobrien
57433965Sjdp  hotspot-ide-project: hotspot exploded-image
57533965Sjdp
57633965Sjdp  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
57733965Sjdp
57833965Sjdp  # Building one JVM variant is enough to start building the other libs
57933965Sjdp  $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs
58033965Sjdp
58133965Sjdp  $(LAUNCHER_TARGETS): java.base-libs
58233965Sjdp
58333965Sjdp  ifeq ($(STATIC_BUILD), true)
58433965Sjdp    $(LAUNCHER_TARGETS): generate-exported-symbols
58533965Sjdp  endif
58633965Sjdp
58733965Sjdp  # The demos are currently linking to libjvm and libjava, just like all other
58833965Sjdp  # jdk libs, even though they don't need to. To avoid warnings, make sure they
589130561Sobrien  # aren't built until after libjava and libjvm are available to link to.
590130561Sobrien  demos-jdk: java.base-libs exploded-image-optimize
59133965Sjdp
59233965Sjdp  # Declare dependency from <module>-java to <module>-gensrc
59333965Sjdp  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
59433965Sjdp
595130561Sobrien  # Declare dependencies between java modules
59633965Sjdp  $(foreach m, $(JAVA_MODULES), \
59733965Sjdp      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
59833965Sjdp      $(call FindDepsForModule,$m)))))
59933965Sjdp
600130561Sobrien  # Declare dependencies between <module>-rmic to <module>-java
60133965Sjdp  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
602130561Sobrien
603130561Sobrien  # Declare dependencies from <module>-lib to <module>-java
60433965Sjdp  # Skip modules that do not have java source.
60533965Sjdp  # When creating a BUILDJDK, the java compilation has already been done by the
60633965Sjdp  # normal build and copied in.
60733965Sjdp  ifneq ($(CREATING_BUILDJDK), true)
60833965Sjdp    $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
60933965Sjdp  endif
61033965Sjdp
61133965Sjdp  # Declare dependencies from all other <module>-lib to java.base-lib
61233965Sjdp  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
61333965Sjdp      $(eval $t: java.base-libs))
61433965Sjdp
615130561Sobrien  # jdk.accessibility depends on java.desktop
616130561Sobrien  jdk.accessibility-libs: java.desktop-libs
617130561Sobrien
61833965Sjdp  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
61933965Sjdp  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
62033965Sjdp  # virtual target.
62133965Sjdp  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
62233965Sjdp
62333965Sjdp  # The swing beans need to have java base properly generated to avoid errors
624130561Sobrien  # in javadoc.
62533965Sjdp  java.desktop-gensrc-jdk: java.base-gensrc
62633965Sjdp
62733965Sjdp  # The annotation processing for jdk.vm.ci needs java.base classes from the
62833965Sjdp  # current JDK.
629130561Sobrien  jdk.vm.ci-gensrc-hotspot: java.base-java
63033965Sjdp
63133965Sjdp  # Explicitly add dependencies for special targets
632130561Sobrien  java.base-java: unpack-sec
63333965Sjdp
63433965Sjdp  jdk.jdeps-gendata: java rmic
63533965Sjdp
63633965Sjdp  # Declare dependencies between jmod targets.
637130561Sobrien  # java.base jmod needs jrt-fs.jar and access to the other jmods to be built.
63833965Sjdp  # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
63933965Sjdp  # we don't need to depend on all other jmods
64033965Sjdp  ifneq ($(CREATING_BUILDJDK), true)
64133965Sjdp    java.base-jmod: jrtfs-jar $(filter-out java.base-jmod \
64233965Sjdp        $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS))
64333965Sjdp  endif
64433965Sjdp
64533965Sjdp  # Building java.base-jmod requires all of hotspot to be built.
64633965Sjdp  java.base-jmod: hotspot
647130561Sobrien
64833965Sjdp  # Declare dependencies from <module>-jmod to all other module targets
64933965Sjdp  # When creating a BUILDJDK, the java compilation has already been done by the
65033965Sjdp  # normal build and copied in.
651130561Sobrien  ifneq ($(CREATING_BUILDJDK), true)
65233965Sjdp    $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
65333965Sjdp  endif
65433965Sjdp  $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
65533965Sjdp  $(foreach m, $(RMIC_MODULES), $(eval $m_JMOD_DEPS += $m-rmic))
65633965Sjdp  $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
657130561Sobrien  $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
65833965Sjdp  $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
65933965Sjdp  $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
660130561Sobrien  $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
66133965Sjdp
66233965Sjdp  # Jmods cannot be created until we have the jmod tool ready to run. During
66333965Sjdp  # a normal build we run it from the exploded image, but when cross compiling
66433965Sjdp  # it's run from the buildjdk, which is either created at build time or user
66533965Sjdp  # supplied.
66633965Sjdp  #
66733965Sjdp  # For the exploded image to be runnable, all java modules and
66833965Sjdp  # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
66933965Sjdp  # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
67033965Sjdp  # appropriate location otherwise jimage, jlink and jmod won't start. This
67133965Sjdp  # also applies when creating the buildjdk.
67233965Sjdp  DEFAULT_JMOD_DEPS := java.base-libs java.base-copy java.base-gendata \
673130561Sobrien      jdk.jlink-launchers
674130561Sobrien  # When cross compiling and buildjdk is to be created, depend on creating the
67533965Sjdp  # buildjdk instead of the default dependencies.
67633965Sjdp  ifeq ($(CREATE_BUILDJDK), true)
67733965Sjdp    # Avoid calling create-buildjdk from within a create-buildjdk call.
67833965Sjdp    ifneq ($(CREATING_BUILDJDK), true)
67933965Sjdp      $(JMOD_TARGETS): create-buildjdk
68033965Sjdp      buildtools-modules: create-buildjdk
68133965Sjdp    else
68233965Sjdp      # While actually creating the buildjdk, the default deps applies.
68333965Sjdp      $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
68433965Sjdp    endif
68533965Sjdp  else
68633965Sjdp    # The normal non cross compilation case uses the default deps.
68733965Sjdp    # To avoid races with the optimize target, that also needs to happen first.
68833965Sjdp    $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) \
689130561Sobrien        exploded-image-optimize
690130561Sobrien  endif
69133965Sjdp
69233965Sjdp  # All modules include the main license files from java.base.
69333965Sjdp  $(JMOD_TARGETS): java.base-copy
69433965Sjdp
69533965Sjdp  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
69633965Sjdp      $(filter jdk.crypto%, $(JAVA_TARGETS))
69733965Sjdp
69833965Sjdp  zip-source: gensrc rmic
69933965Sjdp
70033965Sjdp  jrtfs-jar: interim-langtools
70133965Sjdp
70233965Sjdp  ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
70333965Sjdp    ifeq ($(CREATE_BUILDJDK), true)
70433965Sjdp      # If creating a buildjdk, the interim image needs to be based on that.
70533965Sjdp      generate-link-opt-data: create-buildjdk
70633965Sjdp    else ifeq ($(EXTERNAL_BUILDJDK), false)
70733965Sjdp      # If an external buildjdk has been provided, we skip generating an
70833965Sjdp      # interim-image and just use the external buildjdk for generating
70933965Sjdp      # classlist.
71033965Sjdp      generate-link-opt-data: interim-image
71133965Sjdp    endif
71233965Sjdp    generate-link-opt-data: buildtools-jdk
71333965Sjdp
714130561Sobrien    # The generated classlist needs to go into java.base-jmod.
71533965Sjdp    java.base-jmod jdk-image jre-image: generate-link-opt-data
71633965Sjdp  endif
717130561Sobrien
71833965Sjdp  release-file: create-source-revision-tracker
71933965Sjdp
72033965Sjdp  jdk-image: jmods zip-source demos samples release-file
72133965Sjdp  jre-image: jmods release-file
72233965Sjdp  symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
72333965Sjdp
72433965Sjdp  profiles: jmods release-file
72533965Sjdp
726218822Sdim  mac-bundles-jdk: jdk-image jre-image
727218822Sdim
72833965Sjdp  # The optimize target can run as soon as the modules dir has been completely
72933965Sjdp  # populated (java, copy and gendata targets) and the basic libs and launchers
73033965Sjdp  # have been built.
73133965Sjdp  exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
73233965Sjdp      buildtools-modules
73333965Sjdp
73433965Sjdp  bootcycle-images: jdk-image
73533965Sjdp
73633965Sjdp  docs-javadoc: $(GENSRC_TARGETS) rmic
73733965Sjdp
73833965Sjdp  # The gensrc step for jdk.jdi creates an html file that is used by docs-copy.
73933965Sjdp  docs-copy: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
74033965Sjdp
74133965Sjdp  docs-zip: docs-javadoc docs-copy
74233965Sjdp
74333965Sjdp  test: jdk-image test-image
74433965Sjdp
74533965Sjdp  create-buildjdk-copy: jdk.jlink-java java.base-gendata \
74633965Sjdp      $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
74733965Sjdp
74833965Sjdp  create-buildjdk-interim-image: create-buildjdk-copy
74933965Sjdp
75033965Sjdp  interim-image: $(INTERIM_JMOD_TARGETS)
75133965Sjdp
75233965Sjdp  test-make: clean-test-make
75333965Sjdp
754130561Sobrien  build-test-lib: exploded-image-optimize
75533965Sjdp
75633965Sjdp  build-test-failure-handler: interim-langtools
75733965Sjdp
758130561Sobrien  test-failure-handler: build-test-failure-handler
75933965Sjdp
76033965Sjdp  test-image-failure-handler: build-test-failure-handler
76133965Sjdp
76233965Sjdp  build-test-hotspot-jtreg-native: buildtools-jdk \
763130561Sobrien      hotspot-$(JVM_VARIANT_MAIN)-libs
764130561Sobrien
76533965Sjdp  build-test-jdk-jtreg-native: buildtools-jdk
76633965Sjdp
76733965Sjdp  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
76833965Sjdp
76933965Sjdp  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
77033965Sjdp
77133965Sjdp  test-image-hotspot-gtest: hotspot
77233965Sjdp
77333965Sjdp  test-hotspot-internal: exploded-image
77433965Sjdp
775130561Sobrien  test-hotspot-jtreg: jdk-image test-image
776130561Sobrien
77733965Sjdp  test-hotspot-gtest: exploded-image test-image-hotspot-gtest
77833965Sjdp
77933965Sjdp  install: product-images
78033965Sjdp
78133965Sjdp  product-bundles: product-images
78233965Sjdp
78333965Sjdp  test-bundles: test-image
784130561Sobrien
78533965Sjdp  docs-bundles: docs-image
786130561Sobrien
787130561Sobrien  generate-summary: jmods buildtools-modules
78833965Sjdp
78933965Sjdpendif
79033965Sjdp
79133965Sjdp################################################################################
79233965Sjdp# Virtual targets without recipes
79333965Sjdp
79433965Sjdpbuildtools: buildtools-langtools interim-langtools interim-rmic \
79533965Sjdp    buildtools-jdk
79633965Sjdp
79733965Sjdphotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig
798130561Sobrien
799130561Sobrienhotspot-libs: hotspot-jsig
800130561Sobrien
80133965Sjdp# Create targets hotspot-libs and hotspot-gensrc.
80233965Sjdp$(foreach v, $(JVM_VARIANTS), \
80333965Sjdp  $(eval hotspot-libs: hotspot-$v-libs) \
80433965Sjdp  $(eval hotspot-gensrc: hotspot-$v-gensrc) \
80533965Sjdp)
80633965Sjdp
80733965Sjdpgensrc: $(GENSRC_TARGETS)
808130561Sobrien
80933965Sjdpgendata: $(GENDATA_TARGETS)
81033965Sjdp
81133965Sjdpcopy: $(ALL_COPY_TARGETS)
81233965Sjdp
81333965Sjdpjava: $(JAVA_TARGETS)
81433965Sjdp
81533965Sjdprmic: $(RMIC_TARGETS)
816130561Sobrien
81733965Sjdplibs: $(LIBS_TARGETS)
81833965Sjdp
81933965Sjdplaunchers: $(LAUNCHER_TARGETS)
82033965Sjdp
82133965Sjdpjmods: $(JMOD_TARGETS)
822130561Sobrien
823130561Sobrien# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
82433965Sjdp# is actually handled by jdk.jdi-gensrc
82533965Sjdpjdk.jdwp.agent-gensrc: jdk.jdi-gensrc
82633965Sjdp
82733965Sjdp# Declare dependencies from <module> to all the individual targets specific
828130561Sobrien# to that module <module>-*, that are needed for the exploded image.
82933965Sjdp$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
83033965Sjdp$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
83133965Sjdp$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
83233965Sjdp$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
83333965Sjdp$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
834130561Sobrien$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
83533965Sjdp$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
83633965Sjdp
83733965Sjdp# Building java.base includes building all of hotspot.
83833965Sjdpjava.base: hotspot
83933965Sjdp
840130561Sobriendemos: demos-jdk
84133965Sjdp
84233965Sjdpsamples: samples-jdk
843130561Sobrien
84433965Sjdp# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
84533965Sjdpexploded-image-base: $(ALL_MODULES)
84633965Sjdpexploded-image: exploded-image-base release-file
84733965Sjdp# When cross compiling, no need to optimize the exploded image since it won't
848130561Sobrien# be runnable on the host platform anyway.
849130561Sobrienifneq ($(COMPILE_TYPE), cross)
85033965Sjdp  exploded-image: exploded-image-optimize
85133965Sjdpendif
85233965Sjdp
85333965Sjdpcreate-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
854130561Sobrien
85533965Sjdpmac-bundles: mac-bundles-jdk
85633965Sjdp
85733965Sjdp# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
858130561Sobrien# and in line with this, our targets for creating these are named *-image[s].
85933965Sjdp
86033965Sjdp# This target builds the product images, e.g. the JRE and JDK image
86133965Sjdp# (and possibly other, more specific versions)
86233965Sjdpproduct-images: jdk-image jre-image symbols-image exploded-image
863130561Sobrien
86433965Sjdp# zip-security is actually a bundle, but for now it needs to be considered
86533965Sjdp# an image until this can be cleaned up properly.
866130561Sobrienproduct-images: zip-security
86733965Sjdp
86833965Sjdp# The module summary cannot be run when:
86933965Sjdp# * Cross compiling and building a partial BUILDJDK for the build host
87033965Sjdp# * An external buildjdk has been supplied since it may not match the
871130561Sobrien#   module selection of the target jdk
872130561Sobrienifneq ($(CREATE_BUILDJDK), true)
87333965Sjdp  ifeq ($(EXTERNAL_BUILDJDK), false)
87433965Sjdp    product-images: generate-summary
87533965Sjdp  endif
87633965Sjdpendif
87733965Sjdp
878130561Sobrienifeq ($(OPENJDK_TARGET_OS), macosx)
87933965Sjdp  product-images: mac-bundles
88033965Sjdpendif
88133965Sjdp
882130561Sobrien# This target builds the documentation image
88333965Sjdpdocs-image: docs-javadoc docs-copy
88433965Sjdp
88533965Sjdp# This target builds the test image
88633965Sjdptest-image: prepare-test-image test-image-hotspot-jtreg-native \
88733965Sjdp    test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest
88833965Sjdp
88933965Sjdp# all-images builds all our deliverables as images.
89033965Sjdpall-images: product-images test-image docs-image
89133965Sjdp
892130561Sobrien# all-bundles packages all our deliverables as tar.gz bundles.
893130561Sobrienall-bundles: product-bundles test-bundles docs-bundles
89433965Sjdp
89533965SjdpALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
89633965Sjdp    copy java rmic libs launchers jmods \
89733965Sjdp    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \
89833965Sjdp    exploded-image-base exploded-image \
89933965Sjdp    create-buildjdk mac-bundles product-images docs-image test-image all-images \
90033965Sjdp    all-bundles
90133965Sjdp
90233965Sjdp################################################################################
90333965Sjdp
90433965Sjdp# Traditional targets typically run by users.
90533965Sjdp# These can be considered aliases for the targets now named by a more
90633965Sjdp# "modern" naming scheme.
90733965Sjdpdefault: $(DEFAULT_MAKE_TARGET)
908130561Sobrienjdk: exploded-image
90933965Sjdpimages: product-images
91033965Sjdpdocs: docs-image
911130561Sobrienbundles: all-bundles
912218822Sdimall: all-images
91333965Sjdp
91433965SjdpALL_TARGETS += default jdk images docs bundles all
915218822Sdim
91633965Sjdp################################################################################
91733965Sjdp################################################################################
91833965Sjdp#
91933965Sjdp# Clean targets
92033965Sjdp#
92133965Sjdp################################################################################
92233965Sjdp# Clean targets are automatically run serially by the Makefile calling this
92333965Sjdp# file.
92433965Sjdp
92533965SjdpCLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
92633965Sjdp    images make-support test-make bundles buildjdk
92733965SjdpCLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
92833965SjdpCLEAN_SUPPORT_DIRS += demos
92933965SjdpCLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
93033965SjdpCLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
93133965SjdpCLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
93233965SjdpCLEAN_PHASES := gensrc java native include
93333965SjdpCLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
93433965SjdpCLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
935130561Sobrien# Construct targets of the form clean-$module-$phase
93633965SjdpCLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
93733965Sjdp    $(addprefix $m-, $(CLEAN_PHASES))))
938130561Sobrien
93933965Sjdp# Remove everything, except the output from configure.
94033965Sjdpclean: $(CLEAN_DIR_TARGETS)
94133965Sjdp	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
94233965Sjdp	$(ECHO) Cleaned all build artifacts.
94333965Sjdp
94433965Sjdpclean-docs:
94533965Sjdp	$(call CleanDocs)
94633965Sjdp
94733965Sjdp$(CLEAN_DIR_TARGETS):
94833965Sjdp	$(call CleanDir,$(patsubst clean-%, %, $@))
94933965Sjdp
95033965Sjdp$(CLEAN_SUPPORT_DIR_TARGETS):
95133965Sjdp	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
95233965Sjdp
95333965Sjdp$(CLEAN_TEST_TARGETS):
95433965Sjdp	$(call CleanTest,$(patsubst clean-test-%, %, $@))
95533965Sjdp
95633965Sjdp$(CLEAN_PHASE_TARGETS):
95733965Sjdp	$(call Clean-$(patsubst clean-%,%, $@))
95833965Sjdp
95933965Sjdp$(CLEAN_MODULE_TARGETS):
96033965Sjdp	$(call CleanModule,$(patsubst clean-%, %, $@))
96133965Sjdp
96233965Sjdp$(CLEAN_MODULE_PHASE_TARGETS):
96333965Sjdp	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
96433965Sjdp	    $(word 2, $(subst -,$(SPACE),$@)))
96533965Sjdp
96633965Sjdp# When removing the support dir, we must also remove jdk. Building classes has
96733965Sjdp# the side effect of generating native headers. The headers end up in support
96833965Sjdp# while classes and touch files end up in jdk.
96933965Sjdpclean-support: clean-jdk
97033965Sjdp
97133965Sjdp# Remove everything, including configure configuration. If the output
97233965Sjdp# directory was created by configure and now becomes empty, remove it as well.
97333965Sjdpdist-clean: clean
97433965Sjdp	($(CD) $(OUTPUT_ROOT) && \
97533965Sjdp	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
97633965Sjdp	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
97733965Sjdp	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
97833965Sjdp	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
979130561Sobrien	  else \
98033965Sjdp	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
98133965Sjdp	        && $(RM) -r $(OUTPUT_ROOT)) \
98233965Sjdp	  fi \
983130561Sobrien	)
98433965Sjdp	$(ECHO) Cleaned everything, you will have to re-run configure.
98533965Sjdp
98633965SjdpALL_TARGETS += clean clean-docs dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
98733965Sjdp    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
988130561Sobrien    $(CLEAN_MODULE_PHASE_TARGETS)
989130561Sobrien
99033965Sjdp################################################################################
99133965Sjdp# Declare *-only targets for each normal target
99233965Sjdp$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
99333965Sjdp
99433965SjdpALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
99533965Sjdp
99633965Sjdp################################################################################
99733965Sjdp
998130561Sobrien# Include JPRT targets
999130561Sobrieninclude $(SRC_ROOT)/make/Jprt.gmk
100033965Sjdp
100133965Sjdp################################################################################
100233965Sjdp
100333965Sjdp# The following targets are intentionally not added to ALL_TARGETS since they
100433965Sjdp# are internal only, to support Init.gmk.
100533965Sjdp
100633965Sjdpprint-targets:
100733965Sjdp	  @$(ECHO) $(sort $(ALL_TARGETS))
1008130561Sobrien
1009130561Sobrienprint-modules:
1010130561Sobrien	  @$(ECHO) $(sort $(ALL_MODULES))
101133965Sjdp
101233965Sjdpcreate-main-targets-include:
101333965Sjdp	  $(call LogInfo, Generating main target list)
101433965Sjdp	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
101533965Sjdp	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
101633965Sjdp
1017130561Sobrien################################################################################
101833965Sjdp
101933965Sjdp.PHONY: $(ALL_TARGETS)
102033965Sjdp
1021130561SobrienFRC: # Force target
102233965Sjdp