Main.gmk revision 1990:4f4adcdff6b4
1109998Smarkm#
2296465Sdelphij# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3296465Sdelphij# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4296465Sdelphij#
5109998Smarkm# This code is free software; you can redistribute it and/or modify it
6109998Smarkm# under the terms of the GNU General Public License version 2 only, as
7109998Smarkm# published by the Free Software Foundation.  Oracle designates this
8109998Smarkm# particular file as subject to the "Classpath" exception as provided
9109998Smarkm# by Oracle in the LICENSE file that accompanied this code.
10109998Smarkm#
11109998Smarkm# This code is distributed in the hope that it will be useful, but WITHOUT
12109998Smarkm# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13109998Smarkm# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14296465Sdelphij# version 2 for more details (a copy is included in the LICENSE file that
15109998Smarkm# accompanied this code).
16109998Smarkm#
17109998Smarkm# You should have received a copy of the GNU General Public License version
18109998Smarkm# 2 along with this work; if not, write to the Free Software Foundation,
19109998Smarkm# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20109998Smarkm#
21109998Smarkm# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22109998Smarkm# or visit www.oracle.com if you need additional information or have any
23109998Smarkm# questions.
24109998Smarkm#
25109998Smarkm
26109998Smarkm################################################################################
27109998Smarkm# This is the main makefile containing most actual top level targets. It needs
28109998Smarkm# to be called with a SPEC file defined.
29109998Smarkm################################################################################
30109998Smarkm
31109998Smarkm# Declare default target
32109998Smarkmdefault:
33109998Smarkm
34109998Smarkmifeq ($(wildcard $(SPEC)),)
35109998Smarkm  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36109998Smarkmendif
37109998Smarkm
38109998Smarkm# Now load the spec
39109998Smarkminclude $(SPEC)
40109998Smarkm
41109998Smarkminclude $(SRC_ROOT)/make/MainSupport.gmk
42109998Smarkm
43109998Smarkm# Load the vital tools for all the makefiles.
44109998Smarkminclude $(SRC_ROOT)/make/common/MakeBase.gmk
45109998Smarkminclude $(SRC_ROOT)/make/common/Modules.gmk
46109998Smarkm
47109998Smarkm# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48109998Smarkm# valid top level targets. It's used to declare them all as PHONY and to
49109998Smarkm# generate the -only targets.
50109998SmarkmALL_TARGETS :=
51109998Smarkm
52109998Smarkm# Hook to include the corresponding custom file, if present.
53109998Smarkm$(eval $(call IncludeCustomExtension, , Main.gmk))
54109998Smarkm
55109998Smarkm# All modules for the current target platform.
56109998SmarkmALL_MODULES := $(call FindAllModules)
57109998Smarkm
58109998Smarkm################################################################################
59109998Smarkm################################################################################
60109998Smarkm#
61109998Smarkm# Recipes for all targets. Only recipes, dependencies are declared later.
62109998Smarkm#
63109998Smarkm################################################################################
64109998Smarkm
65109998Smarkm################################################################################
66109998Smarkm# Interim/build tools targets, compiling tools used during the build
67109998Smarkm
68109998Smarkmbuildtools-langtools:
69109998Smarkm	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
70109998Smarkm
71296465Sdelphijinterim-langtools:
72296465Sdelphij	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
73296465Sdelphij
74109998Smarkminterim-rmic:
75109998Smarkm	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
76296465Sdelphij
77296465Sdelphijinterim-cldrconverter:
78296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
79296465Sdelphij
80296465Sdelphijbuildtools-jdk:
81296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
82296465Sdelphij
83296465SdelphijALL_TARGETS += buildtools-langtools interim-langtools \
84296465Sdelphij    interim-rmic interim-cldrconverter buildtools-jdk
85296465Sdelphij
86296465Sdelphij################################################################################
87296465Sdelphij# Special targets for certain modules
88296465Sdelphij
89109998Smarkmimport-hotspot:
90296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
91296465Sdelphij
92296465Sdelphijunpack-sec:
93296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
94109998Smarkm
95109998Smarkmgenerate-exported-symbols:
96296465Sdelphij	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
97296465Sdelphij
98296465SdelphijALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
99296465Sdelphij
100296465Sdelphij################################################################################
101296465Sdelphij# Gensrc targets, generating source before java compilation can be done
102296465Sdelphij$(eval $(call DeclareRecipesForPhase, GENSRC, \
103109998Smarkm    TARGET_SUFFIX := gensrc, \
104109998Smarkm    FILE_PREFIX := Gensrc, \
105109998Smarkm    MAKE_SUBDIR := gensrc, \
106109998Smarkm    CHECK_MODULES := $(ALL_MODULES), \
107109998Smarkm    MULTIPLE_MAKEFILES := true))
108109998Smarkm
109109998SmarkmJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
110296465SdelphijLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
111109998SmarkmCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
112296465SdelphijHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
113296465Sdelphij
114109998SmarkmGENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
115109998SmarkmGENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
116296465Sdelphij    $(GENSRC_MODULEINFO_MODULES))
117109998Smarkm
118296465SdelphijGENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
119109998SmarkmGENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
120109998Smarkm    $(addsuffix -gensrc, $(GENSRC_MODULES)))
121109998Smarkm
122109998Smarkmdefine DeclareModuleInfoRecipe
123296465Sdelphij  $1-gensrc-moduleinfo:
124296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
125296465Sdelphij	    -f GensrcModuleInfo.gmk MODULE=$1)
126296465Sdelphij
127296465Sdelphij  $1-gensrc: $1-gensrc-moduleinfo
128109998Smarkmendef
129296465Sdelphij
130109998Smarkm$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
131296465Sdelphij
132296465SdelphijALL_TARGETS += $(GENSRC_TARGETS)
133109998Smarkm
134296465Sdelphij################################################################################
135296465Sdelphij# Generate data targets
136109998Smarkm$(eval $(call DeclareRecipesForPhase, GENDATA, \
137296465Sdelphij    TARGET_SUFFIX := gendata, \
138296465Sdelphij    FILE_PREFIX := Gendata, \
139109998Smarkm    MAKE_SUBDIR := gendata, \
140296465Sdelphij    CHECK_MODULES := $(ALL_MODULES), \
141296465Sdelphij    USE_WRAPPER := true))
142296465Sdelphij
143296465SdelphijALL_TARGETS += $(GENDATA_TARGETS)
144109998Smarkm
145296465Sdelphij################################################################################
146109998Smarkm# Copy files targets
147296465Sdelphij$(eval $(call DeclareRecipesForPhase, COPY, \
148296465Sdelphij    TARGET_SUFFIX := copy, \
149109998Smarkm    FILE_PREFIX := Copy, \
150296465Sdelphij    MAKE_SUBDIR := copy, \
151296465Sdelphij    CHECK_MODULES := $(ALL_MODULES), \
152296465Sdelphij    USE_WRAPPER := true, \
153296465Sdelphij    MULTIPLE_MAKEFILES := true))
154296465Sdelphij
155296465SdelphijALL_COPY_MODULES += $(COPY_MODULES)
156296465SdelphijALL_COPY_TARGETS += $(COPY_TARGETS)
157109998Smarkm
158296465SdelphijIMPORT_COPY_MODULES := $(call FindImportedModules)
159109998SmarkmIMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
160296465SdelphijALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
161109998SmarkmALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
162109998Smarkm
163296465Sdelphijdefine DeclareImportCopyRecipe
164296465Sdelphij  $1-copy:
165296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
166296465Sdelphij	    -f CopyImportModules.gmk MODULE=$1)
167296465Sdelphijendef
168296465Sdelphij
169296465Sdelphij$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
170296465Sdelphij
171109998SmarkmALL_TARGETS += $(ALL_COPY_TARGETS)
172296465Sdelphij
173296465Sdelphij################################################################################
174296465Sdelphij# Targets for compiling all java modules. Nashorn is treated separately.
175296465SdelphijJAVA_MODULES := $(ALL_MODULES)
176296465SdelphijJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
177296465Sdelphij
178109998Smarkmdefine DeclareCompileJavaRecipe
179296465Sdelphij  $1-java:
180296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
181296465Sdelphij	    -f CompileJavaModules.gmk MODULE=$1)
182296465Sdelphijendef
183296465Sdelphij
184296465Sdelphij$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
185296465Sdelphij    $(eval $(call DeclareCompileJavaRecipe,$m)))
186296465Sdelphij
187109998Smarkm# Build nashorn. Needs to be compiled separately from the rest of the modules
188296465Sdelphij# due to nasgen.
189109998Smarkmjdk.scripting.nashorn-java:
190296465Sdelphij	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
191296465Sdelphij	    -f BuildNashorn.gmk compile)
192296465Sdelphij
193296465SdelphijALL_TARGETS += $(JAVA_TARGETS)
194109998Smarkm
195296465Sdelphij################################################################################
196296465Sdelphij# Targets for running rmic.
197109998Smarkm$(eval $(call DeclareRecipesForPhase, RMIC, \
198109998Smarkm    TARGET_SUFFIX := rmic, \
199296465Sdelphij    FILE_PREFIX := Rmic, \
200296465Sdelphij    MAKE_SUBDIR := rmic, \
201296465Sdelphij    CHECK_MODULES := $(ALL_MODULES)))
202296465Sdelphij
203109998SmarkmALL_TARGETS += $(RMIC_TARGETS)
204296465Sdelphij
205109998Smarkm################################################################################
206296465Sdelphij# Targets for compiling native libraries
207296465Sdelphij$(eval $(call DeclareRecipesForPhase, LIBS, \
208296465Sdelphij    TARGET_SUFFIX := libs, \
209109998Smarkm    FILE_PREFIX := Lib, \
210296465Sdelphij    MAKE_SUBDIR := lib, \
211296465Sdelphij    CHECK_MODULES := $(ALL_MODULES), \
212296465Sdelphij    USE_WRAPPER := true))
213296465Sdelphij
214296465SdelphijALL_TARGETS += $(LIBS_TARGETS)
215296465Sdelphij
216296465Sdelphij################################################################################
217109998Smarkm# Targets for compiling native executables
218296465Sdelphij$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
219109998Smarkm    TARGET_SUFFIX := launchers, \
220296465Sdelphij    FILE_PREFIX := Launcher, \
221296465Sdelphij    MAKE_SUBDIR := launcher, \
222296465Sdelphij    CHECK_MODULES := $(ALL_MODULES), \
223296465Sdelphij    USE_WRAPPER := true))
224296465Sdelphij
225296465SdelphijALL_TARGETS += $(LAUNCHER_TARGETS)
226296465Sdelphij
227296465Sdelphij################################################################################
228296465Sdelphij# Build hotspot target
229109998Smarkm
230296465Sdelphijifeq ($(BUILD_HOTSPOT),true)
231296465Sdelphij  hotspot:
232109998Smarkm	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
233109998Smarkmendif
234109998Smarkm
235296465SdelphijALL_TARGETS += hotspot
236296465Sdelphij
237296465Sdelphij################################################################################
238296465Sdelphij# Build demos and samples targets
239296465Sdelphij
240296465Sdelphijdemos-jdk:
241296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
242296465Sdelphij
243296465Sdelphijsamples-jdk:
244296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
245296465Sdelphij
246296465SdelphijALL_TARGETS += demos-jdk samples-jdk
247296465Sdelphij
248296465Sdelphij################################################################################
249296465Sdelphij# Jigsaw specific data and analysis targets.
250296465Sdelphij
251296465Sdelphijgenerate-summary:
252296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk)
253296465Sdelphij
254296465SdelphijALL_TARGETS += generate-summary
255296465Sdelphij
256296465Sdelphij################################################################################
257296465Sdelphij# Strip binaries targets
258296465Sdelphij
259296465SdelphijSTRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
260296465Sdelphij    $(GENDATA_MODULES))
261296465SdelphijSTRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
262109998Smarkm
263296465Sdelphijdefine DeclareStripRecipe
264296465Sdelphij  $1-strip:
265109998Smarkm	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
266296465Sdelphij	    MODULE=$1)
267109998Smarkmendef
268296465Sdelphij
269296465Sdelphij$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
270296465Sdelphij
271296465SdelphijALL_TARGETS += $(STRIP_TARGETS)
272296465Sdelphij
273296465Sdelphij################################################################################
274296465Sdelphij# Jmod targets
275109998Smarkm
276109998SmarkmJMOD_MODULES := $(ALL_MODULES)
277109998SmarkmJMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
278296465Sdelphij
279296465Sdelphijdefine DeclareJmodRecipe
280296465Sdelphij  $1-jmod:
281296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
282296465Sdelphij	    MODULE=$1)
283296465Sdelphijendef
284296465Sdelphij
285296465Sdelphij$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
286296465Sdelphij
287296465SdelphijALL_TARGETS += $(JMOD_TARGETS)
288109998Smarkm
289296465Sdelphij################################################################################
290296465Sdelphij# Images targets
291296465Sdelphij
292296465Sdelphij# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
293296465Sdelphij# used to track the exact sources used to build that image.
294109998Smarkmsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
295296465Sdelphij$(SUPPORT_OUTPUTDIR)/source_tips: FRC
296296465Sdelphij	$(call MakeDir, $(@D))
297296465Sdelphij	@$(RM) $@
298296465Sdelphij	@$(call GetSourceTips)
299109998Smarkm
300296465SdelphijBOOTCYCLE_TARGET := product-images
301296465Sdelphijbootcycle-images:
302109998Smarkm	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
303296465Sdelphij	+$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
304296465Sdelphij	    JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
305296465Sdelphij
306296465Sdelphijzip-security:
307109998Smarkm	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
308109998Smarkm
309109998Smarkmzip-source:
310296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
311296465Sdelphij
312296465Sdelphijjrtfs-jar:
313296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
314296465Sdelphij
315109998Smarkmjimages:
316296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
317296465Sdelphij
318296465Sdelphijprofiles:
319296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
320109998Smarkm
321296465Sdelphijmac-bundles-jdk:
322296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
323296465Sdelphij
324296465SdelphijALL_TARGETS += source-tips bootcycle-images zip-security zip-source \
325296465Sdelphij    jrtfs-jar jimages profiles mac-bundles-jdk
326109998Smarkm
327296465Sdelphij################################################################################
328109998Smarkm# Docs targets
329296465Sdelphij
330109998Smarkmdocs-javadoc:
331109998Smarkm	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
332109998Smarkm
333296465Sdelphijdocs-jvmtidoc:
334296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
335296465Sdelphij
336296465SdelphijALL_TARGETS += docs-javadoc docs-jvmtidoc
337296465Sdelphij
338109998Smarkm################################################################################
339296465Sdelphij# Cross compilation support
340296465Sdelphij
341296465Sdelphijifeq ($(CREATE_BUILDJDK), true)
342296465Sdelphij  # This target is only called by the recursive call below.
343109998Smarkm  create-buildjdk-compile-hotspot-helper: hotspot
344296465Sdelphij  create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy \
345296465Sdelphij      jdk.jdeps-launchers
346296465Sdelphijendif
347296465Sdelphij
348109998Smarkmcreate-buildjdk-copy:
349296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
350296465Sdelphij
351109998Smarkmcreate-buildjdk-compile-hotspot create-buildjdk-compile-modules:
352296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
353296465Sdelphij	    $@-helper \
354296465Sdelphij	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
355296465Sdelphij	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
356296465Sdelphij	    CREATING_BUILDJDK=true)
357296465Sdelphij
358296465SdelphijALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \
359296465Sdelphij    create-buildjdk-compile-modules
360109998Smarkm
361296465Sdelphij################################################################################
362296465Sdelphij# Build tests
363296465Sdelphij#
364296465Sdelphij
365296465Sdelphijprepare-test-image:
366296465Sdelphij	$(MKDIR) -p $(TEST_IMAGE_DIR)
367296465Sdelphij	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
368109998Smarkm
369296465Sdelphijbuild-test-hotspot-jtreg-native:
370296465Sdelphij	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
371296465Sdelphij	    build-test-hotspot-jtreg-native)
372296465Sdelphij
373109998Smarkmtest-image-hotspot-jtreg-native:
374296465Sdelphij	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
375109998Smarkm	    test-image-hotspot-jtreg-native)
376296465Sdelphij
377109998Smarkmbuild-test-jdk-jtreg-native:
378296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
379109998Smarkm	    build-test-jdk-jtreg-native)
380296465Sdelphij
381296465Sdelphijtest-image-jdk-jtreg-native:
382296465Sdelphij	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
383109998Smarkm	    test-image-jdk-jtreg-native)
384296465Sdelphij
385296465Sdelphijbuild-test-lib:
386296465Sdelphij	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
387296465Sdelphij
388296465SdelphijALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
389296465Sdelphij    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
390296465Sdelphij    test-image-jdk-jtreg-native build-test-lib
391296465Sdelphij
392109998Smarkm################################################################################
393296465Sdelphij# Run tests
394109998Smarkm
395296465Sdelphij# Run tests specified by $(TEST), or the default test set.
396109998Smarkmtest:
397296465Sdelphij	$(call RunTests, $(TEST))
398296465Sdelphij
399296465Sdelphijtest-hotspot-jtreg:
400296465Sdelphij	$(call RunTests, "hotspot_all")
401109998Smarkm
402109998Smarkmtest-hotspot-jtreg-native:
403109998Smarkm	$(call RunTests, "hotspot_native_sanity")
404296465Sdelphij
405296465Sdelphijtest-hotspot-internal:
406296465Sdelphij	$(call RunTests, "hotspot_internal")
407296465Sdelphij
408296465Sdelphijtest-jdk-jtreg-native:
409296465Sdelphij	$(call RunTests, "jdk_native_sanity")
410296465Sdelphij
411296465Sdelphijtest-make:
412296465Sdelphij	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
413296465Sdelphij
414296465SdelphijALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
415296465Sdelphij    test-hotspot-internal test-jdk-jtreg-native test-make
416296465Sdelphij
417296465Sdelphij################################################################################
418296465Sdelphij# Install targets
419296465Sdelphij
420296465Sdelphijinstall:
421296465Sdelphij	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
422296465Sdelphij
423109998SmarkmALL_TARGETS += install
424109998Smarkm
425109998Smarkm################################################################################
426296465Sdelphij#
427296465Sdelphij# Dependency declarations between targets.
428296465Sdelphij#
429296465Sdelphij# These are declared in two groups. First all dependencies between targets that
430296465Sdelphij# have recipes above as these dependencies may be disabled. Then the aggregator
431296465Sdelphij# targets that do not have recipes of their own, which will never have their
432109998Smarkm# dependencies disabled.
433109998Smarkm#
434109998Smarkm################################################################################
435109998Smarkm# Targets with recipes above
436296465Sdelphij
437296465Sdelphij# If running an *-only target, parallel execution and dependencies between
438296465Sdelphij# recipe targets are disabled. This makes it possible to run a select set of
439296465Sdelphij# recipe targets in order. It's the responsibility of the user to make sure
440296465Sdelphij# all prerequisites are fulfilled.
441296465Sdelphijifneq ($(findstring -only, $(MAKECMDGOALS)), )
442296465Sdelphij  .NOTPARALLEL:
443296465Sdelphijelse
444296465Sdelphij  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
445109998Smarkm
446109998Smarkm  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
447109998Smarkm
448109998Smarkm  buildtools-jdk: interim-langtools interim-cldrconverter
449296465Sdelphij
450296465Sdelphij  $(CORBA_GENSRC_TARGETS): interim-langtools
451296465Sdelphij
452296465Sdelphij  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
453296465Sdelphij
454296465Sdelphij  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
455296465Sdelphij
456296465Sdelphij  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
457109998Smarkm
458109998Smarkm  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
459109998Smarkm
460296465Sdelphij  interim-rmic: interim-langtools
461296465Sdelphij
462296465Sdelphij  $(RMIC_TARGETS): interim-langtools interim-rmic
463296465Sdelphij
464296465Sdelphij  $(JAVA_TARGETS): interim-langtools
465296465Sdelphij
466296465Sdelphij  import-hotspot: hotspot
467296465Sdelphij
468109998Smarkm  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
469109998Smarkm
470296465Sdelphij  $(LIBS_TARGETS): import-hotspot
471296465Sdelphij
472296465Sdelphij  $(LAUNCHER_TARGETS): java.base-libs
473296465Sdelphij
474109998Smarkm  ifeq ($(STATIC_BUILD), true)
475109998Smarkm    $(LAUNCHER_TARGETS): generate-exported-symbols
476109998Smarkm  endif
477109998Smarkm
478296465Sdelphij  # The demos are currently linking to libjvm and libjava, just like all other
479296465Sdelphij  # jdk libs, even though they don't need to. To avoid warnings, make sure they
480296465Sdelphij  # aren't built until after libjava and libjvm are available to link to.
481109998Smarkm  demos-jdk: $(JAVA_TARGETS)
482109998Smarkm
483296465Sdelphij  # Declare dependency from <module>-java to <module>-gensrc
484296465Sdelphij  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
485296465Sdelphij
486109998Smarkm  # Declare dependencies between java modules
487109998Smarkm  $(foreach m, $(JAVA_MODULES), \
488296465Sdelphij      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
489296465Sdelphij      $(call FindDepsForModule,$m)))))
490296465Sdelphij
491109998Smarkm  # Declare dependencies between <module>-rmic to <module>-java
492109998Smarkm  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
493296465Sdelphij
494296465Sdelphij  # Declare dependencies from <module>-lib to <module>-java
495296465Sdelphij  # Skip modules that do not have java source. When creating a BUILD_JDK, the
496109998Smarkm  # java compilation has already been done by the normal build and copied in.
497109998Smarkm  ifneq ($(CREATING_BUILDJDK), true)
498296465Sdelphij  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
499296465Sdelphij  endif
500296465Sdelphij
501109998Smarkm  # Declare dependencies from all other <module>-lib to java.base-lib
502109998Smarkm  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
503296465Sdelphij      $(eval $t: java.base-libs))
504296465Sdelphij
505296465Sdelphij  # jdk.accessibility depends on java.desktop
506109998Smarkm  jdk.accessibility-libs: java.desktop-libs
507109998Smarkm
508296465Sdelphij  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
509296465Sdelphij  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
510296465Sdelphij  # virtual target.
511109998Smarkm  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
512109998Smarkm
513296465Sdelphij  # The swing beans need to have java base properly generated to avoid errors
514296465Sdelphij  # in javadoc.
515296465Sdelphij  java.desktop-gensrc-jdk: java.base-gensrc
516109998Smarkm
517109998Smarkm  # The annotation processing for jdk.vm.ci needs java.base classes from the
518296465Sdelphij  # current JDK.
519296465Sdelphij  jdk.vm.ci-gensrc-hotspot: java.base-java
520296465Sdelphij
521109998Smarkm  # Explicitly add dependencies for special targets
522109998Smarkm  java.base-java: unpack-sec
523109998Smarkm
524109998Smarkm  # The copy target copies files generated by gensrc
525296465Sdelphij  java.base-copy-hotspot: java.base-gensrc-hotspot
526296465Sdelphij
527296465Sdelphij  jdk.jdeps-gendata: java rmic
528109998Smarkm
529296465Sdelphij  # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
530296465Sdelphij  $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
531296465Sdelphij  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
532109998Smarkm  $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
533296465Sdelphij  $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
534109998Smarkm
535296465Sdelphij  # Declare dependencies between jmod targets
536109998Smarkm  $(foreach m, $(JMOD_MODULES), \
537296465Sdelphij      $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m))))
538109998Smarkm
539296465Sdelphij  # Declare dependencies from <module>-jmod to all other module targets
540109998Smarkm  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
541296465Sdelphij  $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java))
542296465Sdelphij  $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata))
543296465Sdelphij  $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic))
544109998Smarkm  $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs))
545296465Sdelphij  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers))
546109998Smarkm  $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy))
547296465Sdelphij
548109998Smarkm  # Jmods cannot be created until we have the jlink tool ready to run, which requires
549296465Sdelphij  # all java modules to be compiled and jdk.jlink-launchers.
550296465Sdelphij  $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers
551109998Smarkm
552296465Sdelphij  ifeq ($(CREATE_BUILDJDK), true)
553296465Sdelphij    $(JMOD_TARGETS): create-buildjdk
554296465Sdelphij  endif
555296465Sdelphij
556296465Sdelphij  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
557109998Smarkm      $(filter jdk.crypto%, $(JAVA_TARGETS))
558109998Smarkm
559127128Snectar  zip-source: gensrc rmic
560296465Sdelphij
561296465Sdelphij  jrtfs-jar: interim-langtools
562296465Sdelphij
563296465Sdelphij  jimages: jmods zip-source source-tips demos samples jrtfs-jar
564296465Sdelphij
565296465Sdelphij  profiles: jmods zip-source source-tips jrtfs-jar
566109998Smarkm
567296465Sdelphij  mac-bundles-jdk: jimages
568296465Sdelphij
569296465Sdelphij  bootcycle-images: jimages
570296465Sdelphij
571296465Sdelphij  docs-javadoc: $(GENSRC_TARGETS) rmic
572296465Sdelphij
573296465Sdelphij  docs-jvmtidoc: hotspot
574296465Sdelphij
575296465Sdelphij  test: jimages test-image
576296465Sdelphij
577296465Sdelphij  create-buildjdk-copy: jdk.jlink-java java.base-gendata
578296465Sdelphij
579296465Sdelphij  create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot
580296465Sdelphij
581296465Sdelphij  test-make: clean-test-make
582296465Sdelphij
583296465Sdelphij  build-test-lib: java
584296465Sdelphij
585296465Sdelphij  build-test-hotspot-jtreg-native: buildtools-jdk
586296465Sdelphij
587296465Sdelphij  build-test-jdk-jtreg-native: buildtools-jdk
588296465Sdelphij
589296465Sdelphij  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
590296465Sdelphij
591296465Sdelphij  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
592296465Sdelphij
593  test-hotspot-internal: exploded-image
594
595  test-hotspot-jtreg: jimages test-image
596
597  install: product-images
598
599  generate-summary: jmods
600
601endif
602
603################################################################################
604# Virtual targets without recipes
605
606buildtools: buildtools-langtools interim-langtools interim-rmic \
607    buildtools-jdk
608
609gensrc: $(GENSRC_TARGETS)
610
611gendata: $(GENDATA_TARGETS)
612
613copy: $(ALL_COPY_TARGETS)
614
615java: $(JAVA_TARGETS)
616
617rmic: $(RMIC_TARGETS)
618
619libs: $(LIBS_TARGETS)
620
621launchers: $(LAUNCHER_TARGETS)
622
623jmods: $(JMOD_TARGETS)
624
625strip-binaries: $(STRIP_TARGETS)
626
627# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
628# is actually handled by jdk.jdi-gensrc
629jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
630
631# Declare dependencies from <module> to all the individual targets specific
632# to that module <module>-*, that are needed for the exploded image.
633$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
634$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
635$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
636$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
637$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
638$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
639$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
640demos: demos-jdk
641
642samples: samples-jdk
643
644# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
645exploded-image: $(ALL_MODULES)
646
647create-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \
648    create-buildjdk-compile-hotspot
649
650mac-bundles: mac-bundles-jdk
651
652# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
653# and in line with this, our targets for creating these are named *-image[s].
654
655# This target builds the product images, e.g. the JRE and JDK image
656# (and possibly other, more specific versions)
657product-images: jimages demos samples zip-security exploded-image
658
659# When cross compiling and building a partial BUILDJDK for the build host,
660# the summary generation cannot be run.
661ifneq ($(CREATE_BUILDJDK), true)
662  product-images: generate-summary
663endif
664
665ifeq ($(OPENJDK_TARGET_OS), macosx)
666  product-images: mac-bundles
667endif
668
669# This target builds the documentation image
670docs-image: docs-javadoc docs-jvmtidoc
671
672# This target builds the test image
673test-image: prepare-test-image test-image-hotspot-jtreg-native \
674    test-image-jdk-jtreg-native
675
676# all-images is the top-most target, it builds all our deliverables ("images").
677all-images: product-images test-image docs-image
678
679ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \
680    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \
681    create-buildjdk mac-bundles product-images docs-image test-image all-images
682
683################################################################################
684
685# Traditional targets typically run by users.
686# These can be considered aliases for the targets now named by a more
687# "modern" naming scheme.
688default: $(DEFAULT_MAKE_TARGET)
689jdk: exploded-image
690images: product-images
691docs: docs-image
692all: all-images
693
694ALL_TARGETS += default jdk images docs all
695
696################################################################################
697################################################################################
698#
699# Clean targets
700#
701################################################################################
702# Clean targets are automatically run serially by the Makefile calling this
703# file.
704
705CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
706    images make-support test-make bundles buildjdk
707CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
708CLEAN_SUPPORT_DIRS += demos
709CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
710CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
711CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
712CLEAN_PHASES := gensrc java native include docs
713CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
714CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
715# Construct targets of the form clean-$module-$phase
716CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
717    $(addprefix $m-, $(CLEAN_PHASES))))
718
719# Remove everything, except the output from configure.
720clean: $(CLEAN_DIR_TARGETS)
721	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
722	$(ECHO) Cleaned all build artifacts.
723
724$(CLEAN_DIR_TARGETS):
725	$(call CleanDir,$(patsubst clean-%, %, $@))
726
727$(CLEAN_SUPPORT_DIR_TARGETS):
728	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
729
730$(CLEAN_TEST_TARGETS):
731	$(call CleanTest,$(patsubst clean-test-%, %, $@))
732
733$(CLEAN_PHASE_TARGETS):
734	$(call Clean-$(patsubst clean-%,%, $@))
735
736$(CLEAN_MODULE_TARGETS):
737	$(call CleanModule,$(patsubst clean-%, %, $@))
738
739$(CLEAN_MODULE_PHASE_TARGETS):
740	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
741	    $(word 2, $(subst -,$(SPACE),$@)))
742
743# When removing the support dir, we must also remove jdk. Building classes has
744# the side effect of generating native headers. The headers end up in support
745# while classes and touch files end up in jdk.
746clean-support: clean-jdk
747
748# Remove everything, including configure configuration. If the output
749# directory was created by configure and now becomes empty, remove it as well.
750dist-clean: clean
751	($(CD) $(OUTPUT_ROOT) && \
752	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
753	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
754	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
755	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
756	  else \
757	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
758	        && $(RM) -r $(OUTPUT_ROOT)) \
759	  fi \
760	)
761	$(ECHO) Cleaned everything, you will have to re-run configure.
762
763ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
764    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
765    $(CLEAN_MODULE_PHASE_TARGETS)
766
767################################################################################
768# Declare *-only targets for each normal target
769$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
770
771ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
772
773################################################################################
774
775# Include JPRT targets
776include $(SRC_ROOT)/make/Jprt.gmk
777
778################################################################################
779
780# The following targets are intentionally not added to ALL_TARGETS since they
781# are internal only, to support Init.gmk.
782
783print-targets:
784	  @$(ECHO) $(sort $(ALL_TARGETS))
785
786print-modules:
787	  @$(ECHO) $(sort $(ALL_MODULES))
788
789create-main-targets-include:
790	  $(call LogInfo, Generating main target list)
791	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
792	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
793
794################################################################################
795
796.PHONY: $(ALL_TARGETS)
797
798FRC: # Force target
799