Main.gmk revision 2013:55cf2b46a77a
1114402Sru#
2151497Sru# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3114402Sru# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4114402Sru#
5114402Sru# This code is free software; you can redistribute it and/or modify it
6114402Sru# under the terms of the GNU General Public License version 2 only, as
7114402Sru# published by the Free Software Foundation.  Oracle designates this
8114402Sru# particular file as subject to the "Classpath" exception as provided
9114402Sru# by Oracle in the LICENSE file that accompanied this code.
10114402Sru#
11114402Sru# This code is distributed in the hope that it will be useful, but WITHOUT
12114402Sru# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13114402Sru# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14114402Sru# version 2 for more details (a copy is included in the LICENSE file that
15114402Sru# accompanied this code).
16114402Sru#
17114402Sru# You should have received a copy of the GNU General Public License version
18114402Sru# 2 along with this work; if not, write to the Free Software Foundation,
19114402Sru# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20151497Sru#
21114402Sru# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22114402Sru# or visit www.oracle.com if you need additional information or have any
23114402Sru# questions.
24114402Sru#
25114402Sru
26114402Sru################################################################################
27114402Sru# This is the main makefile containing most actual top level targets. It needs
28151497Sru# to be called with a SPEC file defined.
29151497Sru################################################################################
30114402Sru
31114402Sru# Declare default target
32114402Srudefault:
33114402Sru
34114402Sruifeq ($(wildcard $(SPEC)),)
35114402Sru  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36114402Sruendif
37151497Sru
38151497Sru# Now load the spec
39114402Sruinclude $(SPEC)
40114402Sru
41114402Sruinclude $(SRC_ROOT)/make/MainSupport.gmk
42114402Sru
43114402Sru# Load the vital tools for all the makefiles.
44114402Sruinclude $(SRC_ROOT)/make/common/MakeBase.gmk
45114402Sruinclude $(SRC_ROOT)/make/common/Modules.gmk
46114402Sru
47114402Sru# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48114402Sru# valid top level targets. It's used to declare them all as PHONY and to
49114402Sru# generate the -only targets.
50114402SruALL_TARGETS :=
51114402Sru
52114402Sru# Hook to include the corresponding custom file, if present.
53114402Sru$(eval $(call IncludeCustomExtension, , Main.gmk))
54114402Sru
55114402Sru# All modules for the current target platform.
56151497SruALL_MODULES := $(call FindAllModules)
57151497Sru
58151497Sru################################################################################
59114402Sru################################################################################
60114402Sru#
61114402Sru# Recipes for all targets. Only recipes, dependencies are declared later.
62114402Sru#
63114402Sru################################################################################
64114402Sru
65114402Sru################################################################################
66114402Sru# Interim/build tools targets, compiling tools used during the build
67114402Sru
68114402Srubuildtools-langtools:
69114402Sru	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
70114402Sru
71114402Sruinterim-langtools:
72114402Sru	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
73114402Sru
74114402Sruinterim-rmic:
75114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
76114402Sru
77114402Sruinterim-cldrconverter:
78114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
79114402Sru
80114402Srubuildtools-jdk:
81114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
82114402Sru
83114402SruALL_TARGETS += buildtools-langtools interim-langtools \
84114402Sru    interim-rmic interim-cldrconverter buildtools-jdk
85114402Sru
86114402Sru################################################################################
87114402Sru# Special targets for certain modules
88114402Sru
89114402Sruimport-hotspot:
90114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
91114402Sru
92114402Sruunpack-sec:
93114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
94114402Sru
95114402Srugenerate-exported-symbols:
96114402Sru	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
97114402Sru
98114402SruALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
99114402Sru
100114402Sru################################################################################
101114402Sru# Gensrc targets, generating source before java compilation can be done
102114402Sru$(eval $(call DeclareRecipesForPhase, GENSRC, \
103114402Sru    TARGET_SUFFIX := gensrc, \
104151497Sru    FILE_PREFIX := Gensrc, \
105151497Sru    MAKE_SUBDIR := gensrc, \
106151497Sru    CHECK_MODULES := $(ALL_MODULES), \
107151497Sru    MULTIPLE_MAKEFILES := true))
108114402Sru
109114402SruJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
110114402SruLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
111114402SruCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
112114402SruHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
113114402Sru
114114402SruGENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
115114402SruGENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
116114402Sru    $(GENSRC_MODULEINFO_MODULES))
117114402Sru
118114402SruGENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
119114402SruGENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
120114402Sru    $(addsuffix -gensrc, $(GENSRC_MODULES)))
121114402Sru
122114402Srudefine DeclareModuleInfoRecipe
123114402Sru  $1-gensrc-moduleinfo:
124114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
125114402Sru	    -f GensrcModuleInfo.gmk MODULE=$1)
126114402Sru
127151497Sru  $1-gensrc: $1-gensrc-moduleinfo
128151497Sruendef
129151497Sru
130151497Sru$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
131151497Sru
132151497SruALL_TARGETS += $(GENSRC_TARGETS)
133151497Sru
134114402Sru################################################################################
135114402Sru# Generate data targets
136114402Sru$(eval $(call DeclareRecipesForPhase, GENDATA, \
137114402Sru    TARGET_SUFFIX := gendata, \
138114402Sru    FILE_PREFIX := Gendata, \
139114402Sru    MAKE_SUBDIR := gendata, \
140114402Sru    CHECK_MODULES := $(ALL_MODULES), \
141114402Sru    USE_WRAPPER := true))
142114402Sru
143114402SruALL_TARGETS += $(GENDATA_TARGETS)
144114402Sru
145114402Sru################################################################################
146114402Sru# Copy files targets
147114402Sru$(eval $(call DeclareRecipesForPhase, COPY, \
148114402Sru    TARGET_SUFFIX := copy, \
149114402Sru    FILE_PREFIX := Copy, \
150114402Sru    MAKE_SUBDIR := copy, \
151114402Sru    CHECK_MODULES := $(ALL_MODULES), \
152114402Sru    USE_WRAPPER := true, \
153114402Sru    MULTIPLE_MAKEFILES := true))
154114402Sru
155114402SruALL_COPY_MODULES += $(COPY_MODULES)
156114402SruALL_COPY_TARGETS += $(COPY_TARGETS)
157114402Sru
158114402SruIMPORT_COPY_MODULES := $(call FindImportedModules)
159114402SruIMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
160114402SruALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
161114402SruALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
162114402Sru
163114402Srudefine DeclareImportCopyRecipe
164114402Sru  $1-copy:
165114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
166114402Sru	    -f CopyImportModules.gmk MODULE=$1)
167114402Sruendef
168114402Sru
169114402Sru$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
170114402Sru
171114402SruALL_TARGETS += $(ALL_COPY_TARGETS)
172114402Sru
173114402Sru################################################################################
174114402Sru# Targets for compiling all java modules. Nashorn is treated separately.
175114402SruJAVA_MODULES := $(ALL_MODULES)
176114402SruJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
177114402Sru
178114402Srudefine DeclareCompileJavaRecipe
179114402Sru  $1-java:
180114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
181114402Sru	    -f CompileJavaModules.gmk MODULE=$1)
182114402Sruendef
183114402Sru
184114402Sru$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
185114402Sru    $(eval $(call DeclareCompileJavaRecipe,$m)))
186114402Sru
187114402Sru# Build nashorn. Needs to be compiled separately from the rest of the modules
188114402Sru# due to nasgen.
189114402Srujdk.scripting.nashorn-java:
190114402Sru	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
191114402Sru	    -f BuildNashorn.gmk compile)
192114402Sru
193114402SruALL_TARGETS += $(JAVA_TARGETS)
194114402Sru
195114402Sru################################################################################
196114402Sru# Targets for running rmic.
197114402Sru$(eval $(call DeclareRecipesForPhase, RMIC, \
198114402Sru    TARGET_SUFFIX := rmic, \
199114402Sru    FILE_PREFIX := Rmic, \
200114402Sru    MAKE_SUBDIR := rmic, \
201114402Sru    CHECK_MODULES := $(ALL_MODULES)))
202114402Sru
203114402SruALL_TARGETS += $(RMIC_TARGETS)
204114402Sru
205114402Sru################################################################################
206114402Sru# Targets for compiling native libraries
207114402Sru$(eval $(call DeclareRecipesForPhase, LIBS, \
208114402Sru    TARGET_SUFFIX := libs, \
209114402Sru    FILE_PREFIX := Lib, \
210114402Sru    MAKE_SUBDIR := lib, \
211114402Sru    CHECK_MODULES := $(ALL_MODULES), \
212114402Sru    USE_WRAPPER := true))
213114402Sru
214114402SruALL_TARGETS += $(LIBS_TARGETS)
215114402Sru
216114402Sru################################################################################
217114402Sru# Targets for compiling native executables
218114402Sru$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
219114402Sru    TARGET_SUFFIX := launchers, \
220151497Sru    FILE_PREFIX := Launcher, \
221114402Sru    MAKE_SUBDIR := launcher, \
222114402Sru    CHECK_MODULES := $(ALL_MODULES), \
223114402Sru    USE_WRAPPER := true))
224114402Sru
225114402SruALL_TARGETS += $(LAUNCHER_TARGETS)
226114402Sru
227114402Sru################################################################################
228114402Sru# Build hotspot target
229114402Sru
230114402Sruifeq ($(BUILD_HOTSPOT),true)
231114402Sru  hotspot:
232114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
233114402Sruendif
234114402Sru
235114402SruALL_TARGETS += hotspot
236114402Sru
237114402Sru################################################################################
238114402Sru# Build demos and samples targets
239114402Sru
240114402Srudemos-jdk:
241114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
242114402Sru
243114402Srusamples-jdk:
244114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
245114402Sru
246114402SruALL_TARGETS += demos-jdk samples-jdk
247114402Sru
248114402Sru################################################################################
249114402Sru# Jigsaw specific data and analysis targets.
250114402Sru
251114402Srugenerate-summary:
252114402Sru	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk)
253114402Sru
254114402SruALL_TARGETS += generate-summary
255114402Sru
256114402Sru################################################################################
257114402Sru# Strip binaries targets
258114402Sru
259114402SruSTRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
260114402Sru    $(GENDATA_MODULES))
261114402SruSTRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
262114402Sru
263114402Srudefine DeclareStripRecipe
264114402Sru  $1-strip:
265114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
266114402Sru	    MODULE=$1)
267114402Sruendef
268114402Sru
269114402Sru$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
270114402Sru
271114402SruALL_TARGETS += $(STRIP_TARGETS)
272114402Sru
273114402Sru################################################################################
274114402Sru# Jmod targets
275151497Sru
276114402SruJMOD_MODULES := $(ALL_MODULES)
277114402SruJMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
278114402Sru
279114402Srudefine DeclareJmodRecipe
280114402Sru  $1-jmod:
281114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
282114402Sru	    MODULE=$1)
283114402Sruendef
284114402Sru
285114402Sru$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
286114402Sru
287114402SruALL_TARGETS += $(JMOD_TARGETS)
288114402Sru
289114402Sru################################################################################
290114402Sru# Images targets
291114402Sru
292114402Sru# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
293114402Sru# used to track the exact sources used to build that image.
294114402Srusource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
295114402Sru$(SUPPORT_OUTPUTDIR)/source_tips: FRC
296114402Sru	$(call MakeDir, $(@D))
297114402Sru	@$(RM) $@
298114402Sru	@$(call GetSourceTips)
299114402Sru
300114402SruBOOTCYCLE_TARGET := product-images
301114402Srubootcycle-images:
302114402Sru	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
303114402Sru	+$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
304114402Sru	    JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
305114402Sru
306114402Sruzip-security:
307114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
308114402Sru
309114402Sruzip-source:
310114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
311114402Sru
312114402Srujrtfs-jar:
313114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
314114402Sru
315114402Srujimages:
316114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
317114402Sru
318114402Sruprofiles:
319114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
320114402Sru
321114402Srumac-bundles-jdk:
322114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
323114402Sru
324114402SruALL_TARGETS += source-tips bootcycle-images zip-security zip-source \
325114402Sru    jrtfs-jar jimages profiles mac-bundles-jdk
326114402Sru
327114402Sru################################################################################
328114402Sru# Docs targets
329114402Sru
330114402Srudocs-javadoc:
331114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
332114402Sru
333114402Srudocs-jvmtidoc:
334114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
335114402Sru
336114402SruALL_TARGETS += docs-javadoc docs-jvmtidoc
337114402Sru
338114402Sru################################################################################
339114402Sru# Cross compilation support
340114402Sru
341114402Sruifeq ($(CREATE_BUILDJDK), true)
342114402Sru  # This target is only called by the recursive call below.
343114402Sru  create-buildjdk-compile-hotspot-helper: hotspot
344114402Sru  create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy \
345114402Sru      jdk.jdeps-launchers
346114402Sruendif
347114402Sru
348114402Srucreate-buildjdk-copy:
349114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
350114402Sru
351114402Srucreate-buildjdk-compile-hotspot create-buildjdk-compile-modules:
352114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
353114402Sru	    $@-helper \
354114402Sru	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
355114402Sru	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
356114402Sru	    CREATING_BUILDJDK=true)
357114402Sru
358114402SruALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \
359114402Sru    create-buildjdk-compile-modules
360114402Sru
361114402Sru################################################################################
362114402Sru# Build tests
363114402Sru#
364114402Sru
365114402Sruprepare-test-image:
366114402Sru	$(MKDIR) -p $(TEST_IMAGE_DIR)
367114402Sru	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
368114402Sru
369114402Srubuild-test-hotspot-jtreg-native:
370114402Sru	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
371114402Sru	    build-test-hotspot-jtreg-native)
372114402Sru
373114402Srutest-image-hotspot-jtreg-native:
374114402Sru	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
375114402Sru	    test-image-hotspot-jtreg-native)
376114402Sru
377114402Srubuild-test-jdk-jtreg-native:
378114402Sru	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
379114402Sru	    build-test-jdk-jtreg-native)
380114402Sru
381114402Srutest-image-jdk-jtreg-native:
382114402Sru	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
383114402Sru	    test-image-jdk-jtreg-native)
384114402Sru
385114402Srubuild-test-lib:
386114402Sru	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
387114402Sru
388114402Sru# Builds the failure handler jtreg extension
389114402Srubuild-test-failure-handler:
390114402Sru	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
391114402Sru	    -f BuildFailureHandler.gmk build)
392114402Sru
393114402Sru# Runs the tests for the failure handler jtreg extension
394114402Srutest-failure-handler:
395114402Sru	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
396114402Sru	    -f BuildFailureHandler.gmk test)
397114402Sru
398114402Sru# Copies the failure handler jtreg extension into the test image
399114402Srutest-image-failure-handler:
400114402Sru	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
401114402Sru	     -f BuildFailureHandler.gmk images)
402114402Sru
403114402SruALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
404114402Sru    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
405114402Sru    test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
406114402Sru    test-failure-handler test-image-failure-handler
407114402Sru
408114402Sru################################################################################
409114402Sru# Run tests
410114402Sru
411114402Sru# Run tests specified by $(TEST), or the default test set.
412114402Srutest:
413114402Sru	$(call RunTests, $(TEST))
414114402Sru
415114402Srutest-hotspot-jtreg:
416114402Sru	$(call RunTests, "hotspot_all")
417114402Sru
418114402Srutest-hotspot-jtreg-native:
419114402Sru	$(call RunTests, "hotspot_native_sanity")
420114402Sru
421114402Srutest-hotspot-internal:
422114402Sru	$(call RunTests, "hotspot_internal")
423114402Sru
424114402Srutest-jdk-jtreg-native:
425114402Sru	$(call RunTests, "jdk_native_sanity")
426114402Sru
427114402Srutest-make:
428114402Sru	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
429114402Sru
430114402SruALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
431114402Sru    test-hotspot-internal test-jdk-jtreg-native test-make
432114402Sru
433114402Sru################################################################################
434114402Sru# Install targets
435114402Sru
436114402Sruinstall:
437114402Sru	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
438114402Sru
439114402SruALL_TARGETS += install
440114402Sru
441114402Sru################################################################################
442114402Sru#
443114402Sru# Dependency declarations between targets.
444114402Sru#
445114402Sru# These are declared in two groups. First all dependencies between targets that
446114402Sru# have recipes above as these dependencies may be disabled. Then the aggregator
447114402Sru# targets that do not have recipes of their own, which will never have their
448114402Sru# dependencies disabled.
449114402Sru#
450114402Sru################################################################################
451114402Sru# Targets with recipes above
452114402Sru
453114402Sru# If running an *-only target, parallel execution and dependencies between
454114402Sru# recipe targets are disabled. This makes it possible to run a select set of
455114402Sru# recipe targets in order. It's the responsibility of the user to make sure
456114402Sru# all prerequisites are fulfilled.
457114402Sruifneq ($(findstring -only, $(MAKECMDGOALS)), )
458114402Sru  .NOTPARALLEL:
459114402Sruelse
460114402Sru  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
461114402Sru
462151497Sru  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
463151497Sru
464151497Sru  buildtools-jdk: interim-langtools interim-cldrconverter
465114402Sru
466114402Sru  $(CORBA_GENSRC_TARGETS): interim-langtools
467114402Sru
468114402Sru  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
469114402Sru
470114402Sru  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
471114402Sru
472114402Sru  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
473114402Sru
474114402Sru  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
475114402Sru
476114402Sru  interim-rmic: interim-langtools
477114402Sru
478114402Sru  $(RMIC_TARGETS): interim-langtools interim-rmic
479114402Sru
480114402Sru  $(JAVA_TARGETS): interim-langtools
481114402Sru
482114402Sru  import-hotspot: hotspot
483114402Sru
484114402Sru  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
485114402Sru
486114402Sru  $(LIBS_TARGETS): import-hotspot
487114402Sru
488151497Sru  $(LAUNCHER_TARGETS): java.base-libs
489114402Sru
490114402Sru  ifeq ($(STATIC_BUILD), true)
491114402Sru    $(LAUNCHER_TARGETS): generate-exported-symbols
492114402Sru  endif
493114402Sru
494114402Sru  # The demos are currently linking to libjvm and libjava, just like all other
495114402Sru  # jdk libs, even though they don't need to. To avoid warnings, make sure they
496114402Sru  # aren't built until after libjava and libjvm are available to link to.
497114402Sru  demos-jdk: $(JAVA_TARGETS)
498151497Sru
499114402Sru  # Declare dependency from <module>-java to <module>-gensrc
500114402Sru  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
501114402Sru
502114402Sru  # Declare dependencies between java modules
503151497Sru  $(foreach m, $(JAVA_MODULES), \
504114402Sru      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
505114402Sru      $(call FindDepsForModule,$m)))))
506114402Sru
507151497Sru  # Declare dependencies between <module>-rmic to <module>-java
508114402Sru  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
509114402Sru
510151497Sru  # Declare dependencies from <module>-lib to <module>-java
511114402Sru  # Skip modules that do not have java source. When creating a BUILD_JDK, the
512114402Sru  # java compilation has already been done by the normal build and copied in.
513151497Sru  ifneq ($(CREATING_BUILDJDK), true)
514114402Sru  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
515114402Sru  endif
516114402Sru
517114402Sru  # Declare dependencies from all other <module>-lib to java.base-lib
518114402Sru  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
519114402Sru      $(eval $t: java.base-libs))
520114402Sru
521114402Sru  # jdk.accessibility depends on java.desktop
522114402Sru  jdk.accessibility-libs: java.desktop-libs
523114402Sru
524114402Sru  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
525114402Sru  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
526114402Sru  # virtual target.
527114402Sru  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
528151497Sru
529114402Sru  # The swing beans need to have java base properly generated to avoid errors
530114402Sru  # in javadoc.
531151497Sru  java.desktop-gensrc-jdk: java.base-gensrc
532114402Sru
533114402Sru  # The annotation processing for jdk.vm.ci needs java.base classes from the
534114402Sru  # current JDK.
535114402Sru  jdk.vm.ci-gensrc-hotspot: java.base-java
536114402Sru
537114402Sru  # Explicitly add dependencies for special targets
538114402Sru  java.base-java: unpack-sec
539114402Sru
540114402Sru  # The copy target copies files generated by gensrc
541114402Sru  java.base-copy-hotspot: java.base-gensrc-hotspot
542114402Sru
543114402Sru  jdk.jdeps-gendata: java rmic
544114402Sru
545114402Sru  # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
546114402Sru  $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
547114402Sru  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
548114402Sru  $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
549114402Sru  $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
550114402Sru
551114402Sru  # Declare dependencies between jmod targets
552114402Sru  $(foreach m, $(JMOD_MODULES), \
553114402Sru      $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m))))
554114402Sru
555114402Sru  # Declare dependencies from <module>-jmod to all other module targets
556114402Sru  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
557114402Sru  $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java))
558114402Sru  $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata))
559114402Sru  $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic))
560114402Sru  $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs))
561114402Sru  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers))
562114402Sru  $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy))
563114402Sru
564151497Sru  # Jmods cannot be created until we have the jlink tool ready to run, which requires
565114402Sru  # all java modules to be compiled and jdk.jlink-launchers.
566114402Sru  $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers
567114402Sru
568114402Sru  ifeq ($(CREATE_BUILDJDK), true)
569114402Sru    $(JMOD_TARGETS): create-buildjdk
570114402Sru  endif
571114402Sru
572114402Sru  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
573114402Sru      $(filter jdk.crypto%, $(JAVA_TARGETS))
574114402Sru
575114402Sru  zip-source: gensrc rmic
576114402Sru
577114402Sru  jrtfs-jar: interim-langtools
578114402Sru
579114402Sru  jimages: jmods zip-source source-tips demos samples jrtfs-jar
580114402Sru
581114402Sru  profiles: jmods zip-source source-tips jrtfs-jar
582114402Sru
583114402Sru  mac-bundles-jdk: jimages
584114402Sru
585114402Sru  bootcycle-images: jimages
586114402Sru
587114402Sru  docs-javadoc: $(GENSRC_TARGETS) rmic
588114402Sru
589114402Sru  docs-jvmtidoc: hotspot
590114402Sru
591114402Sru  test: jimages test-image
592114402Sru
593114402Sru  create-buildjdk-copy: jdk.jlink-java java.base-gendata
594114402Sru
595114402Sru  create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot
596114402Sru
597114402Sru  test-make: clean-test-make
598114402Sru
599114402Sru  build-test-lib: java
600114402Sru
601114402Sru  build-test-failure-handler: interim-langtools
602114402Sru
603114402Sru  test-failure-handler: build-test-failure-handler
604114402Sru
605114402Sru  test-image-failure-handler: build-test-failure-handler
606114402Sru
607114402Sru  build-test-hotspot-jtreg-native: buildtools-jdk
608114402Sru
609114402Sru  build-test-jdk-jtreg-native: buildtools-jdk
610114402Sru
611114402Sru  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
612114402Sru
613114402Sru  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
614114402Sru
615114402Sru  test-hotspot-internal: exploded-image
616114402Sru
617114402Sru  test-hotspot-jtreg: jimages test-image
618114402Sru
619114402Sru  install: product-images
620114402Sru
621114402Sru  generate-summary: jmods
622114402Sru
623114402Sruendif
624114402Sru
625114402Sru################################################################################
626114402Sru# Virtual targets without recipes
627114402Sru
628114402Srubuildtools: buildtools-langtools interim-langtools interim-rmic \
629114402Sru    buildtools-jdk
630114402Sru
631114402Srugensrc: $(GENSRC_TARGETS)
632114402Sru
633114402Srugendata: $(GENDATA_TARGETS)
634114402Sru
635114402Srucopy: $(ALL_COPY_TARGETS)
636114402Sru
637114402Srujava: $(JAVA_TARGETS)
638114402Sru
639114402Srurmic: $(RMIC_TARGETS)
640114402Sru
641114402Srulibs: $(LIBS_TARGETS)
642114402Sru
643114402Srulaunchers: $(LAUNCHER_TARGETS)
644114402Sru
645114402Srujmods: $(JMOD_TARGETS)
646114402Sru
647114402Srustrip-binaries: $(STRIP_TARGETS)
648114402Sru
649114402Sru# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
650114402Sru# is actually handled by jdk.jdi-gensrc
651114402Srujdk.jdwp.agent-gensrc: jdk.jdi-gensrc
652114402Sru
653114402Sru# Declare dependencies from <module> to all the individual targets specific
654114402Sru# to that module <module>-*, that are needed for the exploded image.
655114402Sru$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
656114402Sru$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
657114402Sru$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
658114402Sru$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
659151497Sru$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
660114402Sru$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
661114402Sru$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
662114402Srudemos: demos-jdk
663114402Sru
664114402Srusamples: samples-jdk
665114402Sru
666114402Sru# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
667114402Sruexploded-image: $(ALL_MODULES)
668114402Sru
669114402Srucreate-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \
670114402Sru    create-buildjdk-compile-hotspot
671114402Sru
672114402Srumac-bundles: mac-bundles-jdk
673114402Sru
674114402Sru# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
675114402Sru# and in line with this, our targets for creating these are named *-image[s].
676114402Sru
677114402Sru# This target builds the product images, e.g. the JRE and JDK image
678114402Sru# (and possibly other, more specific versions)
679114402Sruproduct-images: jimages demos samples zip-security exploded-image
680114402Sru
681114402Sru# When cross compiling and building a partial BUILDJDK for the build host,
682114402Sru# the summary generation cannot be run.
683114402Sruifneq ($(CREATE_BUILDJDK), true)
684114402Sru  product-images: generate-summary
685114402Sruendif
686114402Sru
687114402Sruifeq ($(OPENJDK_TARGET_OS), macosx)
688114402Sru  product-images: mac-bundles
689151497Sruendif
690114402Sru
691114402Sru# This target builds the documentation image
692114402Srudocs-image: docs-javadoc docs-jvmtidoc
693114402Sru
694114402Sru# This target builds the test image
695114402Srutest-image: prepare-test-image test-image-hotspot-jtreg-native \
696114402Sru    test-image-jdk-jtreg-native test-image-failure-handler
697114402Sru
698114402Sru# all-images is the top-most target, it builds all our deliverables ("images").
699114402Sruall-images: product-images test-image docs-image
700114402Sru
701114402SruALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \
702114402Sru    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \
703114402Sru    create-buildjdk mac-bundles product-images docs-image test-image all-images
704114402Sru
705114402Sru################################################################################
706114402Sru
707114402Sru# Traditional targets typically run by users.
708114402Sru# These can be considered aliases for the targets now named by a more
709114402Sru# "modern" naming scheme.
710114402Srudefault: $(DEFAULT_MAKE_TARGET)
711114402Srujdk: exploded-image
712114402Sruimages: product-images
713114402Srudocs: docs-image
714114402Sruall: all-images
715114402Sru
716114402SruALL_TARGETS += default jdk images docs all
717114402Sru
718114402Sru################################################################################
719114402Sru################################################################################
720114402Sru#
721114402Sru# Clean targets
722114402Sru#
723114402Sru################################################################################
724114402Sru# Clean targets are automatically run serially by the Makefile calling this
725114402Sru# file.
726114402Sru
727114402SruCLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
728114402Sru    images make-support test-make bundles buildjdk
729114402SruCLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
730114402SruCLEAN_SUPPORT_DIRS += demos
731114402SruCLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
732114402SruCLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
733114402SruCLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
734114402SruCLEAN_PHASES := gensrc java native include docs
735114402SruCLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
736114402SruCLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
737114402Sru# Construct targets of the form clean-$module-$phase
738114402SruCLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
739114402Sru    $(addprefix $m-, $(CLEAN_PHASES))))
740114402Sru
741114402Sru# Remove everything, except the output from configure.
742114402Sruclean: $(CLEAN_DIR_TARGETS)
743114402Sru	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
744114402Sru	$(ECHO) Cleaned all build artifacts.
745114402Sru
746114402Sru$(CLEAN_DIR_TARGETS):
747114402Sru	$(call CleanDir,$(patsubst clean-%, %, $@))
748114402Sru
749114402Sru$(CLEAN_SUPPORT_DIR_TARGETS):
750114402Sru	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
751114402Sru
752151497Sru$(CLEAN_TEST_TARGETS):
753151497Sru	$(call CleanTest,$(patsubst clean-test-%, %, $@))
754114402Sru
755114402Sru$(CLEAN_PHASE_TARGETS):
756151497Sru	$(call Clean-$(patsubst clean-%,%, $@))
757114402Sru
758114402Sru$(CLEAN_MODULE_TARGETS):
759114402Sru	$(call CleanModule,$(patsubst clean-%, %, $@))
760114402Sru
761114402Sru$(CLEAN_MODULE_PHASE_TARGETS):
762114402Sru	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
763114402Sru	    $(word 2, $(subst -,$(SPACE),$@)))
764114402Sru
765114402Sru# When removing the support dir, we must also remove jdk. Building classes has
766114402Sru# the side effect of generating native headers. The headers end up in support
767114402Sru# while classes and touch files end up in jdk.
768114402Sruclean-support: clean-jdk
769114402Sru
770114402Sru# Remove everything, including configure configuration. If the output
771114402Sru# directory was created by configure and now becomes empty, remove it as well.
772114402Srudist-clean: clean
773114402Sru	($(CD) $(OUTPUT_ROOT) && \
774114402Sru	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
775114402Sru	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
776114402Sru	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
777114402Sru	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
778151497Sru	  else \
779114402Sru	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
780114402Sru	        && $(RM) -r $(OUTPUT_ROOT)) \
781114402Sru	  fi \
782114402Sru	)
783114402Sru	$(ECHO) Cleaned everything, you will have to re-run configure.
784114402Sru
785151497SruALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
786114402Sru    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
787114402Sru    $(CLEAN_MODULE_PHASE_TARGETS)
788114402Sru
789114402Sru################################################################################
790114402Sru# Declare *-only targets for each normal target
791114402Sru$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
792114402Sru
793114402SruALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
794114402Sru
795114402Sru################################################################################
796114402Sru
797114402Sru# Include JPRT targets
798114402Sruinclude $(SRC_ROOT)/make/Jprt.gmk
799114402Sru
800114402Sru################################################################################
801114402Sru
802114402Sru# The following targets are intentionally not added to ALL_TARGETS since they
803114402Sru# are internal only, to support Init.gmk.
804114402Sru
805114402Sruprint-targets:
806114402Sru	  @$(ECHO) $(sort $(ALL_TARGETS))
807114402Sru
808114402Sruprint-modules:
809114402Sru	  @$(ECHO) $(sort $(ALL_MODULES))
810114402Sru
811114402Srucreate-main-targets-include:
812114402Sru	  $(call LogInfo, Generating main target list)
813114402Sru	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
814114402Sru	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
815114402Sru
816114402Sru################################################################################
817114402Sru
818114402Sru.PHONY: $(ALL_TARGETS)
819114402Sru
820114402SruFRC: # Force target
821114402Sru