Main.gmk revision 1862:5f3d162d11fc
1145287Snjl#
2145287Snjl# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3145287Snjl# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4145287Snjl#
5145287Snjl# This code is free software; you can redistribute it and/or modify it
6145287Snjl# under the terms of the GNU General Public License version 2 only, as
7145287Snjl# published by the Free Software Foundation.  Oracle designates this
8145287Snjl# particular file as subject to the "Classpath" exception as provided
9145287Snjl# by Oracle in the LICENSE file that accompanied this code.
10145287Snjl#
11145287Snjl# This code is distributed in the hope that it will be useful, but WITHOUT
12145287Snjl# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13145287Snjl# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14145287Snjl# version 2 for more details (a copy is included in the LICENSE file that
15145287Snjl# accompanied this code).
16145287Snjl#
17145287Snjl# You should have received a copy of the GNU General Public License version
18145287Snjl# 2 along with this work; if not, write to the Free Software Foundation,
19145287Snjl# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20145287Snjl#
21145287Snjl# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22145287Snjl# or visit www.oracle.com if you need additional information or have any
23145287Snjl# questions.
24145287Snjl#
25145287Snjl
26145287Snjl################################################################################
27145287Snjl# This is the main makefile containing most actual top level targets. It needs
28145287Snjl# to be called with a SPEC file defined.
29145287Snjl################################################################################
30145287Snjl
31145287Snjl# Declare default target
32145287Snjldefault:
33145287Snjl
34145287Snjlifeq ($(wildcard $(SPEC)),)
35145287Snjl  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36145287Snjlendif
37145287Snjl
38145287Snjl# Now load the spec
39145287Snjlinclude $(SPEC)
40145287Snjl
41145287Snjlinclude $(SRC_ROOT)/make/MainSupport.gmk
42145287Snjl
43145287Snjl# Load the vital tools for all the makefiles.
44145287Snjlinclude $(SRC_ROOT)/make/common/MakeBase.gmk
45145287Snjl# Explicitly generate module deps makefile data
46145287Snjlinclude $(SRC_ROOT)/make/GenerateModuleDeps.gmk
47145287Snjlinclude $(SRC_ROOT)/make/common/Modules.gmk
48170874Snjl
49187597Sjkim# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
50145287Snjl# valid top level targets. It's used to declare them all as PHONY and to
51145287Snjl# generate the -only targets.
52145287SnjlALL_TARGETS :=
53145287Snjl
54145287Snjl# Hook to include the corresponding custom file, if present.
55145287Snjl$(eval $(call IncludeCustomExtension, , Main.gmk))
56145287Snjl
57145287Snjl# All modules for the current target platform.
58145287SnjlALL_MODULES := $(call FindAllModules)
59145287Snjl
60145287Snjl################################################################################
61145287Snjl################################################################################
62145287Snjl#
63145287Snjl# Recipes for all targets. Only recipes, dependencies are declared later.
64145287Snjl#
65145287Snjl################################################################################
66145287Snjl
67145287Snjl################################################################################
68145287Snjl# Interim/build tools targets, compiling tools used during the build
69145287Snjl
70145287Snjlbuildtools-langtools:
71145287Snjl	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
72145287Snjl
73145287Snjlinterim-langtools:
74145287Snjl	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
75145287Snjl
76170874Snjlinterim-rmic:
77170874Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
78145287Snjl
79145287Snjlinterim-cldrconverter:
80145287Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
81145287Snjl
82145287Snjlbuildtools-jdk:
83145287Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
84145287Snjl
85145287SnjlALL_TARGETS += buildtools-langtools interim-langtools \
86145287Snjl    interim-rmic interim-cldrconverter buildtools-jdk
87145287Snjl
88145287Snjl################################################################################
89145287Snjl# Special targets for certain modules
90145287Snjl
91145287Snjlimport-hotspot:
92145287Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
93145287Snjl
94145287Snjlunpack-sec:
95145287Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
96145287Snjl
97145287Snjlgenerate-exported-symbols:
98145287Snjl	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
99145287Snjl
100145287SnjlALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
101145287Snjl
102145287Snjl################################################################################
103145287Snjl# Gensrc targets, generating source before java compilation can be done
104145287Snjl$(eval $(call DeclareRecipesForPhase, GENSRC, \
105145287Snjl    TARGET_SUFFIX := gensrc, \
106145287Snjl    FILE_PREFIX := Gensrc, \
107145287Snjl    MAKE_SUBDIR := gensrc, \
108145287Snjl    CHECK_MODULES := $(ALL_MODULES), \
109145287Snjl    MULTIPLE_MAKEFILES := true))
110145287Snjl
111145287SnjlJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
112145287SnjlLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
113145287SnjlCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
114145287SnjlHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
115145287Snjl
116145287SnjlALL_TARGETS += $(GENSRC_TARGETS)
117145287Snjl
118145287Snjl################################################################################
119145287Snjl# Generate data targets
120145287Snjl$(eval $(call DeclareRecipesForPhase, GENDATA, \
121145287Snjl    TARGET_SUFFIX := gendata, \
122145287Snjl    FILE_PREFIX := Gendata, \
123145287Snjl    MAKE_SUBDIR := gendata, \
124145287Snjl    CHECK_MODULES := $(ALL_MODULES), \
125145287Snjl    USE_WRAPPER := true))
126145287Snjl
127145287SnjlALL_TARGETS += $(GENDATA_TARGETS)
128145287Snjl
129145287Snjl################################################################################
130145287Snjl# Copy files targets
131145287Snjl$(eval $(call DeclareRecipesForPhase, COPY, \
132145287Snjl    TARGET_SUFFIX := copy, \
133145287Snjl    FILE_PREFIX := Copy, \
134145287Snjl    MAKE_SUBDIR := copy, \
135145287Snjl    CHECK_MODULES := $(ALL_MODULES), \
136145287Snjl    USE_WRAPPER := true, \
137145287Snjl    MULTIPLE_MAKEFILES := true))
138145287Snjl
139145287SnjlALL_TARGETS += $(COPY_TARGETS)
140145287Snjl
141145287Snjl################################################################################
142145287Snjl# Targets for compiling all java modules. Nashorn is treated separately.
143145287SnjlJAVA_MODULES := $(call FindJavaModules)
144145287SnjlJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
145145287Snjl
146145287Snjldefine DeclareCompileJavaRecipe
147145287Snjl  $1-java:
148145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
149145287Snjl	    -f CompileJavaModules.gmk MODULE=$1)
150145287Snjlendef
151145287Snjl
152145287Snjl$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
153145287Snjl    $(eval $(call DeclareCompileJavaRecipe,$m)))
154170874Snjl
155170874Snjl# Build nashorn. Needs to be compiled separately from the rest of the modules
156170874Snjl# due to nasgen.
157170874Snjljdk.scripting.nashorn-java:
158170874Snjl	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
159170874Snjl	    -f BuildNashorn.gmk compile)
160170874Snjl
161170874SnjlALL_TARGETS += $(JAVA_TARGETS)
162170874Snjl
163170874Snjl################################################################################
164170874Snjl# Targets for running rmic.
165145287Snjl$(eval $(call DeclareRecipesForPhase, RMIC, \
166170874Snjl    TARGET_SUFFIX := rmic, \
167145287Snjl    FILE_PREFIX := Rmic, \
168170874Snjl    MAKE_SUBDIR := rmic, \
169170874Snjl    CHECK_MODULES := $(ALL_MODULES)))
170170874Snjl
171170874SnjlALL_TARGETS += $(RMIC_TARGETS)
172170874Snjl
173145287Snjl################################################################################
174170874Snjl# Targets for compiling native libraries
175170874Snjl$(eval $(call DeclareRecipesForPhase, LIBS, \
176145287Snjl    TARGET_SUFFIX := libs, \
177145287Snjl    FILE_PREFIX := Lib, \
178145287Snjl    MAKE_SUBDIR := lib, \
179170874Snjl    CHECK_MODULES := $(ALL_MODULES), \
180170874Snjl    USE_WRAPPER := true))
181145287Snjl
182145287SnjlALL_TARGETS += $(LIBS_TARGETS)
183170874Snjl
184170874Snjl################################################################################
185145287Snjl# Targets for compiling native executables
186170874Snjl$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
187145287Snjl    TARGET_SUFFIX := launchers, \
188170874Snjl    FILE_PREFIX := Launcher, \
189170874Snjl    MAKE_SUBDIR := launcher, \
190170874Snjl    CHECK_MODULES := $(ALL_MODULES), \
191170874Snjl    USE_WRAPPER := true))
192170874Snjl
193170874SnjlALL_TARGETS += $(LAUNCHER_TARGETS)
194170874Snjl
195145287Snjl################################################################################
196170874Snjl# Build hotspot target
197170874Snjl
198170874Snjlifeq ($(BUILD_HOTSPOT),true)
199170874Snjl  hotspot:
200170874Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
201170874Snjlendif
202170874Snjl
203170874SnjlALL_TARGETS += hotspot
204170874Snjl
205170874Snjl################################################################################
206170874Snjl# Build demos and samples targets
207170874Snjl
208170874Snjldemos-jdk:
209170874Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
210170874Snjl
211170874Snjlsamples-jdk:
212170874Snjl	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
213170874Snjl
214170874SnjlALL_TARGETS += demos-jdk samples-jdk
215170874Snjl
216170874Snjl################################################################################
217170874Snjl# Image targets
218170874Snjl
219170874Snjl# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
220170874Snjl# used to track the exact sources used to build that image.
221170874Snjlsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
222170874Snjl$(SUPPORT_OUTPUTDIR)/source_tips: FRC
223170874Snjl	$(call MakeDir, $(@D))
224170874Snjl	@$(RM) $@
225170874Snjl	@$(call GetSourceTips)
226170874Snjl
227170874SnjlBOOTCYCLE_TARGET := product-images
228170874Snjlbootcycle-images:
229170874Snjl	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
230170874Snjl	+$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
231170874Snjl	    JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
232145287Snjl
233145287Snjlzip-security:
234145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
235145287Snjl
236145287Snjlzip-source:
237145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
238145287Snjl
239145287Snjlstrip-binaries:
240145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
241145287Snjl
242145287Snjljrtfs-jar:
243145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
244145287Snjl
245145287Snjljimages:
246145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
247145287Snjl
248145287Snjlprofiles:
249145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
250145287Snjl
251145287Snjlmac-bundles-jdk:
252145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
253145287Snjl
254145287SnjlALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
255145287Snjl    jrtfs-jar jimages profiles mac-bundles-jdk
256145287Snjl
257145287Snjl################################################################################
258145287Snjl# Docs targets
259145287Snjl
260145287Snjldocs-javadoc:
261145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
262145287Snjl
263145287Snjldocs-jvmtidoc:
264145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
265145287Snjl
266145287SnjlALL_TARGETS += docs-javadoc docs-jvmtidoc
267145287Snjl
268145287Snjl################################################################################
269145287Snjl# Build tests
270145287Snjl#
271145287Snjl
272145287Snjlprepare-test-image:
273145287Snjl	$(MKDIR) -p $(TEST_IMAGE_DIR)
274145287Snjl	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
275145287Snjl
276145287Snjlbuild-test-hotspot-jtreg-native:
277145287Snjl	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
278145287Snjl	    build-test-hotspot-jtreg-native)
279145287Snjl
280145287Snjltest-image-hotspot-jtreg-native:
281145287Snjl	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
282145287Snjl	    test-image-hotspot-jtreg-native)
283145287Snjl
284145287Snjlbuild-test-jdk-jtreg-native:
285145287Snjl	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
286145287Snjl	    build-test-jdk-jtreg-native)
287145287Snjl
288145287Snjltest-image-jdk-jtreg-native:
289187594Sjkim	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
290145287Snjl	    test-image-jdk-jtreg-native)
291145287Snjl
292145287Snjlbuild-test-lib:
293145287Snjl	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
294145287Snjl
295145287SnjlALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
296145287Snjl    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
297145287Snjl    test-image-jdk-jtreg-native build-test-lib
298145287Snjl
299145287Snjl################################################################################
300145287Snjl# Run tests
301145287Snjl
302145287Snjl# Run tests specified by $(TEST), or the default test set.
303145287Snjltest:
304145287Snjl	$(call RunTests, $(TEST))
305145287Snjl
306145287Snjltest-hotspot-jtreg:
307145287Snjl	$(call RunTests, "hotspot_all")
308145287Snjl
309145287Snjltest-hotspot-jtreg-native:
310145287Snjl	$(call RunTests, "hotspot_native_sanity")
311145287Snjl
312181691Sjhbtest-hotspot-internal:
313145287Snjl	$(call RunTests, "hotspot_internal")
314145287Snjl
315145287Snjltest-jdk-jtreg-native:
316145287Snjl	$(call RunTests, "jdk_native_sanity")
317145287Snjl
318145287Snjltest-make:
319145287Snjl	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
320145287Snjl
321145287SnjlALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
322145287Snjl    test-hotspot-internal test-jdk-jtreg-native test-make
323145287Snjl
324145287Snjl################################################################################
325145287Snjl# Verification targets
326145287Snjl
327145287Snjlverify-modules:
328145287Snjl	@$(call TargetEnter)
329145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
330145287Snjl	@$(call TargetExit)
331145287Snjl
332145287SnjlALL_TARGETS += verify-modules
333145287Snjl
334145287Snjl################################################################################
335145287Snjl# Install targets
336145287Snjl
337145287Snjlinstall:
338145287Snjl	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
339145287Snjl
340145287SnjlALL_TARGETS += install
341145287Snjl
342145287Snjl################################################################################
343145287Snjl#
344145287Snjl# Dependency declarations between targets.
345145287Snjl#
346145287Snjl# These are declared in two groups. First all dependencies between targets that
347145287Snjl# have recipes above as these dependencies may be disabled. Then the aggregator
348145287Snjl# targets that do not have recipes of their own, which will never have their
349145287Snjl# dependencies disabled.
350145287Snjl#
351145287Snjl################################################################################
352145287Snjl# Targets with recipes above
353145287Snjl
354145287Snjl# If running an *-only target, parallel execution and dependencies between
355145287Snjl# recipe targets are disabled. This makes it possible to run a select set of
356145287Snjl# recipe targets in order. It's the responsibility of the user to make sure
357145287Snjl# all prerequisites are fulfilled.
358145287Snjlifneq ($(findstring -only, $(MAKECMDGOALS)), )
359145287Snjl  .NOTPARALLEL:
360145287Snjlelse
361145287Snjl  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
362145287Snjl
363145287Snjl  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
364145287Snjl
365145287Snjl  buildtools-jdk: interim-langtools interim-cldrconverter
366145287Snjl
367145287Snjl  $(CORBA_GENSRC_TARGETS): interim-langtools
368145287Snjl
369145287Snjl  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
370145287Snjl
371145287Snjl  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
372145287Snjl
373145287Snjl  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
374145287Snjl
375145287Snjl  interim-rmic: interim-langtools
376145287Snjl
377145287Snjl  $(RMIC_TARGETS): interim-langtools interim-rmic
378145287Snjl
379145287Snjl  $(JAVA_TARGETS): interim-langtools
380145287Snjl
381145287Snjl  import-hotspot: hotspot
382145287Snjl
383145287Snjl  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
384145287Snjl
385145287Snjl  $(LIBS_TARGETS): import-hotspot
386145287Snjl
387145287Snjl  $(LAUNCHER_TARGETS): java.base-libs
388145287Snjl
389145287Snjl  ifeq ($(STATIC_BUILD), true)
390145287Snjl    $(LAUNCHER_TARGETS): generate-exported-symbols
391145287Snjl  endif
392145287Snjl
393145287Snjl  # The demos are currently linking to libjvm and libjava, just like all other
394145287Snjl  # jdk libs, even though they don't need to. To avoid warnings, make sure they
395145287Snjl  # aren't built until after libjava and libjvm are available to link to.
396145287Snjl  demos-jdk: $(JAVA_TARGETS)
397145287Snjl
398145287Snjl  # Declare dependency from <module>-java to <module>-gensrc
399145287Snjl  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
400145287Snjl
401145287Snjl  # Declare dependencies between java modules
402145287Snjl  $(foreach m, $(JAVA_MODULES), \
403145287Snjl      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
404145287Snjl      $(call FindDepsForModule,$m)))))
405145287Snjl
406145287Snjl  # Declare dependencies between <module>-rmic to <module>-java
407182401Sjhb  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
408182401Sjhb
409145287Snjl  # Declare dependencies from <module>-lib to <module>-java
410145287Snjl  # Skip modules that do not have java source.
411145287Snjl  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
412145287Snjl
413145287Snjl  # Declare dependencies from all other <module>-lib to java.base-lib
414145287Snjl  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
415145287Snjl      $(eval $t: java.base-libs))
416145287Snjl  # Declare the special case dependency for jdk.deploy.osx where libosx
417145287Snjl  # links against libosxapp.
418145287Snjl  jdk.deploy.osx-libs: java.desktop-libs
419145287Snjl
420145287Snjl  # jdk.accessibility depends on java.desktop
421145287Snjl  jdk.accessibility-libs: java.desktop-libs
422145287Snjl
423145287Snjl  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
424145287Snjl  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
425145287Snjl  # virtual target.
426145287Snjl  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
427145287Snjl
428145287Snjl  # The swing beans need to have java base properly generated to avoid errors
429145287Snjl  # in javadoc.
430145287Snjl  java.desktop-gensrc-jdk: java.base-gensrc
431145287Snjl
432145287Snjl  # Explicitly add dependencies for special targets
433145287Snjl  java.base-java: unpack-sec
434145287Snjl
435145287Snjl  # The copy target copies files generated by gensrc
436145287Snjl  java.base-copy-hotspot: java.base-gensrc-hotspot
437145287Snjl
438145287Snjl  jdk.jdeps-gendata: java rmic
439145287Snjl
440145287Snjl  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
441145287Snjl      $(filter jdk.crypto%, $(JAVA_TARGETS))
442145287Snjl
443145287Snjl  zip-source: gensrc rmic
444145287Snjl
445145287Snjl  strip-binaries: libs launchers gendata copy
446145287Snjl
447145287Snjl  jrtfs-jar: buildtools-jdk
448145287Snjl
449145287Snjl  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
450145287Snjl      jrtfs-jar
451145287Snjl
452145287Snjl  profiles: exploded-image strip-binaries source-tips
453145287Snjl
454145287Snjl  mac-bundles-jdk: jimages
455145287Snjl
456145287Snjl  bootcycle-images: jimages
457145287Snjl
458145287Snjl  docs-javadoc: gensrc rmic
459145287Snjl
460145287Snjl  docs-jvmtidoc: hotspot
461145287Snjl
462145287Snjl  test: jimages test-image
463145287Snjl
464145287Snjl  verify-modules: exploded-image
465145287Snjl
466145287Snjl  test-make: clean-test-make
467145287Snjl
468145287Snjl  build-test-lib: java
469145287Snjl
470145287Snjl  build-test-hotspot-jtreg-native: buildtools-jdk
471145287Snjl
472145287Snjl  build-test-jdk-jtreg-native: buildtools-jdk
473145287Snjl
474145287Snjl  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
475145287Snjl
476145287Snjl  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
477145287Snjl
478145287Snjl  test-hotspot-internal: exploded-image
479145287Snjl
480145287Snjl  test-hotspot-jtreg: jimages test-image
481145287Snjl
482145287Snjl  install: product-images
483145287Snjl
484145287Snjlendif
485145287Snjl
486145287Snjl################################################################################
487145287Snjl# Virtual targets without recipes
488145287Snjl
489145287Snjlbuildtools: buildtools-langtools interim-langtools interim-rmic \
490145287Snjl    buildtools-jdk
491145287Snjl
492145287Snjlgensrc: $(GENSRC_TARGETS)
493145287Snjl
494145287Snjlgendata: $(GENDATA_TARGETS)
495145287Snjl
496145287Snjlcopy: $(COPY_TARGETS)
497145287Snjl
498145287Snjljava: $(JAVA_TARGETS)
499145287Snjl
500145287Snjlrmic: $(RMIC_TARGETS)
501145287Snjl
502145287Snjllibs: $(LIBS_TARGETS)
503145287Snjl
504145287Snjllaunchers: $(LAUNCHER_TARGETS)
505145287Snjl
506145287Snjl# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
507145287Snjl# is actually handled by jdk.jdi-gensrc
508145287Snjljdk.jdwp.agent-gensrc: jdk.jdi-gensrc
509145287Snjl
510145287Snjl# Declare dependencies from <module> to all the individual targets specific
511145287Snjl# to that module <module>-*, that are needed for the exploded image.
512145287Snjl$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
513145287Snjl$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
514145287Snjl$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
515$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
516$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
517$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
518$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
519
520demos: demos-jdk
521
522samples: samples-jdk
523
524# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
525exploded-image: $(ALL_MODULES)
526
527mac-bundles: mac-bundles-jdk
528
529# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
530# and in line with this, our targets for creating these are named *-image[s].
531
532# This target builds the product images, e.g. the JRE and JDK image
533# (and possibly other, more specific versions)
534product-images: jimages demos samples zip-security verify-modules
535
536ifeq ($(OPENJDK_TARGET_OS), macosx)
537  product-images: mac-bundles
538endif
539
540# This target builds the documentation image
541docs-image: docs-javadoc docs-jvmtidoc
542
543# This target builds the test image
544test-image: prepare-test-image test-image-hotspot-jtreg-native \
545    test-image-jdk-jtreg-native
546
547# all-images is the top-most target, it builds all our deliverables ("images").
548all-images: product-images test-image docs-image
549
550ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
551    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \
552    mac-bundles product-images docs-image test-image all-images
553
554################################################################################
555
556# Traditional targets typically run by users.
557# These can be considered aliases for the targets now named by a more
558# "modern" naming scheme.
559default: $(DEFAULT_MAKE_TARGET)
560jdk: exploded-image
561images: product-images
562docs: docs-image
563all: all-images
564
565ALL_TARGETS += default jdk images docs all
566
567################################################################################
568################################################################################
569#
570# Clean targets
571#
572################################################################################
573# Clean targets are automatically run serially by the Makefile calling this
574# file.
575
576CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
577    images make-support test-make bundles
578CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
579CLEAN_SUPPORT_DIRS += demos
580CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
581CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
582CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
583CLEAN_PHASES := gensrc java native include docs
584CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
585CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
586# Construct targets of the form clean-$module-$phase
587CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
588    $(addprefix $m-, $(CLEAN_PHASES))))
589
590# Remove everything, except the output from configure.
591clean: $(CLEAN_DIR_TARGETS)
592	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
593	$(ECHO) Cleaned all build artifacts.
594
595$(CLEAN_DIR_TARGETS):
596	$(call CleanDir,$(patsubst clean-%, %, $@))
597
598$(CLEAN_SUPPORT_DIR_TARGETS):
599	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
600
601$(CLEAN_TEST_TARGETS):
602	$(call CleanTest,$(patsubst clean-test-%, %, $@))
603
604$(CLEAN_PHASE_TARGETS):
605	$(call Clean-$(patsubst clean-%,%, $@))
606
607$(CLEAN_MODULE_TARGETS):
608	$(call CleanModule,$(patsubst clean-%, %, $@))
609
610$(CLEAN_MODULE_PHASE_TARGETS):
611	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
612	    $(word 2, $(subst -,$(SPACE),$@)))
613
614# When removing the support dir, we must also remove jdk. Building classes has
615# the side effect of generating native headers. The headers end up in support
616# while classes and touch files end up in jdk.
617clean-support: clean-jdk
618
619# Remove everything, including configure configuration. If the output
620# directory was created by configure and now becomes empty, remove it as well.
621dist-clean: clean
622	($(CD) $(OUTPUT_ROOT) && \
623	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
624	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
625	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
626	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
627	  else \
628	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
629	        && $(RM) -r $(OUTPUT_ROOT)) \
630	  fi \
631	)
632	$(ECHO) Cleaned everything, you will have to re-run configure.
633
634ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
635    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
636    $(CLEAN_MODULE_PHASE_TARGETS)
637
638################################################################################
639# Declare *-only targets for each normal target
640$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
641
642ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
643
644################################################################################
645
646# Include JPRT targets
647include $(SRC_ROOT)/make/Jprt.gmk
648
649################################################################################
650
651# The following targets are intentionally not added to ALL_TARGETS since they
652# are internal only, to support Init.gmk.
653
654print-targets:
655	  @$(ECHO) $(sort $(ALL_TARGETS))
656
657print-modules:
658	  @$(ECHO) $(sort $(ALL_MODULES))
659
660create-main-targets-include:
661	  $(call LogInfo, Generating main target list)
662	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
663	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
664
665################################################################################
666
667.PHONY: $(ALL_TARGETS)
668
669FRC: # Force target
670