Main.gmk revision 1641:7fa1d71d8ddf
1285SN/A#
2756Saefimov# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3285SN/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4285SN/A#
5285SN/A# This code is free software; you can redistribute it and/or modify it
6285SN/A# under the terms of the GNU General Public License version 2 only, as
7285SN/A# published by the Free Software Foundation.  Oracle designates this
8285SN/A# particular file as subject to the "Classpath" exception as provided
9285SN/A# by Oracle in the LICENSE file that accompanied this code.
10285SN/A#
11285SN/A# This code is distributed in the hope that it will be useful, but WITHOUT
12285SN/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13285SN/A# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14285SN/A# version 2 for more details (a copy is included in the LICENSE file that
15285SN/A# accompanied this code).
16285SN/A#
17285SN/A# You should have received a copy of the GNU General Public License version
18285SN/A# 2 along with this work; if not, write to the Free Software Foundation,
19285SN/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20285SN/A#
21285SN/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22285SN/A# or visit www.oracle.com if you need additional information or have any
23285SN/A# questions.
24285SN/A#
25285SN/A
26285SN/A################################################################################
27285SN/A# This is the main makefile containing most actual top level targets. It needs
28285SN/A# to be called with a SPEC file defined.
29367SN/A################################################################################
30285SN/A
31285SN/A# Declare default target
32285SN/Adefault:
33285SN/A
34285SN/Aifeq ($(wildcard $(SPEC)),)
35285SN/A  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36285SN/Aendif
37285SN/A
38285SN/A# Now load the spec
39285SN/Ainclude $(SPEC)
40285SN/A
41285SN/Ainclude $(SRC_ROOT)/make/MainSupport.gmk
42285SN/A
43285SN/A# Load the vital tools for all the makefiles.
44285SN/Ainclude $(SRC_ROOT)/make/common/MakeBase.gmk
45285SN/Ainclude $(SRC_ROOT)/make/common/Modules.gmk
46285SN/A
47285SN/A# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48285SN/A# valid top level targets. It's used to declare them all as PHONY and to
49285SN/A# generate the -only targets.
50367SN/AALL_TARGETS :=
51367SN/A
52550Smkos# Hook to include the corresponding custom file, if present.
53285SN/A$(eval $(call IncludeCustomExtension, , Main.gmk))
54285SN/A
55285SN/A# All modules for the current target platform.
56285SN/A# Manually add jdk.hotspot.agent for now.
57285SN/AALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
58285SN/A
59285SN/A################################################################################
60285SN/A################################################################################
61285SN/A#
62285SN/A# Recipes for all targets. Only recipes, dependencies are declared later.
63285SN/A#
64285SN/A################################################################################
65285SN/A
66285SN/A################################################################################
67285SN/A# Interim/build tools targets, compiling tools used during the build
68285SN/A
69285SN/Abuildtools-langtools:
70285SN/A	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
71285SN/A
72285SN/Ainterim-langtools:
73285SN/A	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
74285SN/A
75285SN/Ainterim-corba:
76285SN/A	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
77285SN/A
78285SN/Ainterim-rmic:
79285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
80285SN/A
81285SN/Ainterim-cldrconverter:
82285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
83285SN/A
84285SN/Abuildtools-jdk:
85285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
86285SN/A
87285SN/AALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
88285SN/A    interim-rmic interim-cldrconverter buildtools-jdk
89285SN/A
90285SN/A################################################################################
91285SN/A# Special targets for certain modules
92285SN/A
93285SN/Aimport-hotspot:
94285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
95285SN/A
96285SN/Aunpack-sec:
97285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
98285SN/A
99285SN/AALL_TARGETS += import-hotspot unpack-sec
100285SN/A
101285SN/A################################################################################
102285SN/A# Gensrc targets, generating source before java compilation can be done
103285SN/A$(eval $(call DeclareRecipesForPhase, GENSRC, \
104285SN/A    TARGET_SUFFIX := gensrc, \
105285SN/A    FILE_PREFIX := Gensrc, \
106285SN/A    MAKE_SUBDIR := gensrc, \
107285SN/A    CHECK_MODULES := $(ALL_MODULES), \
108285SN/A    MULTIPLE_MAKEFILES := true))
109285SN/A
110285SN/AJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
111285SN/ALANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
112285SN/ACORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
113285SN/A
114285SN/AALL_TARGETS += $(GENSRC_TARGETS)
115285SN/A
116285SN/A################################################################################
117726Saefimov# Generate data targets
118285SN/A$(eval $(call DeclareRecipesForPhase, GENDATA, \
119285SN/A    TARGET_SUFFIX := gendata, \
120367SN/A    FILE_PREFIX := Gendata, \
121367SN/A    MAKE_SUBDIR := gendata, \
122367SN/A    CHECK_MODULES := $(ALL_MODULES), \
123285SN/A    USE_WRAPPER := true))
124285SN/A
125285SN/AALL_TARGETS += $(GENDATA_TARGETS)
126285SN/A
127285SN/A################################################################################
128285SN/A# Copy files targets
129285SN/A$(eval $(call DeclareRecipesForPhase, COPY, \
130285SN/A    TARGET_SUFFIX := copy, \
131285SN/A    FILE_PREFIX := Copy, \
132285SN/A    MAKE_SUBDIR := copy, \
133285SN/A    CHECK_MODULES := $(ALL_MODULES), \
134285SN/A    USE_WRAPPER := true))
135285SN/A
136285SN/AALL_TARGETS += $(COPY_TARGETS)
137285SN/A
138285SN/A################################################################################
139285SN/A# Targets for compiling all java modules. Nashorn is treated separately.
140285SN/AJAVA_MODULES := $(call FindJavaModules)
141285SN/AJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
142285SN/A
143285SN/Adefine DeclareCompileJavaRecipe
144285SN/A  $1-java:
145285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
146285SN/A	    $1 JAVA_MODULES=$1 MODULE=$1)
147285SN/Aendef
148285SN/A
149285SN/A$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
150285SN/A    $(eval $(call DeclareCompileJavaRecipe,$m)))
151285SN/A
152285SN/A# Build nashorn. Needs to be compiled separately from the rest of the modules
153285SN/A# due to nasgen.
154285SN/Ajdk.scripting.nashorn-java:
155285SN/A	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
156285SN/A
157367SN/AALL_TARGETS += $(JAVA_TARGETS)
158285SN/A
159285SN/A################################################################################
160285SN/A# Targets for running rmic.
161285SN/A$(eval $(call DeclareRecipesForPhase, RMIC, \
162285SN/A    TARGET_SUFFIX := rmic, \
163285SN/A    FILE_PREFIX := Rmic, \
164285SN/A    MAKE_SUBDIR := rmic, \
165285SN/A    CHECK_MODULES := $(ALL_MODULES)))
166367SN/A
167285SN/AALL_TARGETS += $(RMIC_TARGETS)
168285SN/A
169285SN/A################################################################################
170285SN/A# Targets for compiling native libraries
171285SN/A$(eval $(call DeclareRecipesForPhase, LIBS, \
172285SN/A    TARGET_SUFFIX := libs, \
173367SN/A    FILE_PREFIX := Lib, \
174367SN/A    MAKE_SUBDIR := lib, \
175367SN/A    CHECK_MODULES := $(ALL_MODULES), \
176367SN/A    USE_WRAPPER := true))
177285SN/A
178285SN/AALL_TARGETS += $(LIBS_TARGETS)
179285SN/A
180285SN/A################################################################################
181285SN/A# Targets for compiling native executables
182285SN/A$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
183367SN/A    TARGET_SUFFIX := launchers, \
184367SN/A    FILE_PREFIX := Launcher, \
185367SN/A    MAKE_SUBDIR := launcher, \
186367SN/A    CHECK_MODULES := $(ALL_MODULES), \
187367SN/A    USE_WRAPPER := true))
188367SN/A
189367SN/AALL_TARGETS += $(LAUNCHER_TARGETS)
190367SN/A
191285SN/A################################################################################
192285SN/A# Build hotspot target
193285SN/A
194285SN/Aifeq ($(BUILD_HOTSPOT),true)
195285SN/A  hotspot:
196285SN/A	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
197285SN/Aendif
198285SN/A
199285SN/AALL_TARGETS += hotspot
200285SN/A
201285SN/A################################################################################
202285SN/A# Build demos and samples targets
203285SN/A
204285SN/Ademos-jdk:
205285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
206285SN/A
207285SN/Asamples-jdk:
208285SN/A	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
209285SN/A
210285SN/AALL_TARGETS += demos-jdk samples-jdk
211285SN/A
212285SN/A################################################################################
213285SN/A# Image targets
214285SN/A
215285SN/A# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
216285SN/A# used to track the exact sources used to build that image.
217285SN/Asource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
218285SN/A$(SUPPORT_OUTPUTDIR)/source_tips: FRC
219285SN/A	@$(MKDIR) -p $(@D)
220285SN/A	@$(RM) $@
221285SN/A	@$(call GetSourceTips)
222285SN/A
223285SN/ABOOTCYCLE_TARGET := product-images
224285SN/Abootcycle-images:
225285SN/A	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
226285SN/A	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
227285SN/A	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
228285SN/A
229285SN/Azip-security:
230285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
231285SN/A
232285SN/Azip-source:
233285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
234285SN/A
235285SN/Astrip-binaries:
236285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
237285SN/A
238285SN/Ajrtfs-jar:
239285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
240285SN/A
241285SN/Ajimages:
242285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
243285SN/A
244285SN/Aprofiles:
245383SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
246285SN/A
247285SN/Amac-bundles-jdk:
248285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
249285SN/A
250285SN/AALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
251285SN/A    jrtfs-jar jimages profiles mac-bundles-jdk
252285SN/A
253285SN/A################################################################################
254285SN/A# Docs targets
255285SN/A
256285SN/Adocs-javadoc:
257285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
258285SN/A
259285SN/Adocs-jvmtidoc:
260285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
261285SN/A
262285SN/AALL_TARGETS += docs-javadoc docs-jvmtidoc
263285SN/A
264285SN/A################################################################################
265285SN/A# Build tests
266285SN/A#
267285SN/A
268285SN/Aprepare-test-image:
269285SN/A	$(MKDIR) -p $(TEST_IMAGE_DIR)
270285SN/A	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
271285SN/A
272285SN/Abuild-test-hotspot-jtreg-native:
273285SN/A	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
274285SN/A	    build-test-hotspot-jtreg-native)
275285SN/A
276285SN/Atest-image-hotspot-jtreg-native:
277285SN/A	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
278285SN/A	    test-image-hotspot-jtreg-native)
279285SN/A
280285SN/Abuild-test-jdk-jtreg-native:
281285SN/A	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
282285SN/A	    build-test-jdk-jtreg-native)
283285SN/A
284285SN/Atest-image-jdk-jtreg-native:
285285SN/A	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
286285SN/A	    test-image-jdk-jtreg-native)
287285SN/A
288285SN/Abuild-test-lib:
289285SN/A	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
290285SN/A
291285SN/AALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
292285SN/A    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
293285SN/A    test-image-jdk-jtreg-native build-test-lib
294285SN/A
295285SN/A################################################################################
296285SN/A# Run tests
297285SN/A
298367SN/A# Run tests specified by $(TEST), or the default test set.
299285SN/Atest:
300285SN/A	$(call RunTests, $(TEST))
301285SN/A
302367SN/Atest-hotspot-jtreg-native:
303367SN/A	$(call RunTests, "hotspot_native_sanity")
304285SN/A
305285SN/Atest-jdk-jtreg-native:
306285SN/A	$(call RunTests, "jdk_native_sanity")
307285SN/A
308285SN/Atest-make:
309285SN/A	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
310285SN/A
311285SN/AALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
312285SN/A
313285SN/A################################################################################
314285SN/A# Verification targets
315285SN/A
316285SN/Averify-modules:
317285SN/A	@$(call TargetEnter)
318285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
319285SN/A	@$(call TargetExit)
320285SN/A
321285SN/AALL_TARGETS += verify-modules
322285SN/A
323285SN/A################################################################################
324285SN/A# Install targets
325285SN/A
326285SN/Ainstall:
327285SN/A	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
328285SN/A
329285SN/AALL_TARGETS += install
330285SN/A
331285SN/A################################################################################
332285SN/A#
333285SN/A# Dependency declarations between targets.
334285SN/A#
335285SN/A# These are declared in two groups. First all dependencies between targets that
336285SN/A# have recipes above as these dependencies may be disabled. Then the aggregator
337285SN/A# targets that do not have recipes of their own, which will never have their
338285SN/A# dependencies disabled.
339285SN/A#
340285SN/A################################################################################
341285SN/A# Targets with recipes above
342285SN/A
343285SN/A# If running an *-only target, parallel execution and dependencies between
344285SN/A# recipe targets are disabled. This makes it possible to run a select set of
345285SN/A# recipe targets in order. It's the responsibility of the user to make sure
346285SN/A# all prerequisites are fulfilled.
347285SN/Aifneq ($(findstring -only, $(MAKECMDGOALS)), )
348367SN/A  .NOTPARALLEL:
349367SN/Aelse
350367SN/A  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
351367SN/A
352367SN/A  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
353285SN/A
354285SN/A  buildtools-jdk: interim-langtools interim-cldrconverter
355285SN/A
356285SN/A  $(CORBA_GENSRC_TARGETS): interim-langtools
357285SN/A
358367SN/A  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
359285SN/A
360285SN/A  interim-corba: $(CORBA_GENSRC_TARGETS)
361285SN/A
362285SN/A  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
363285SN/A
364285SN/A  interim-rmic: interim-langtools
365285SN/A
366285SN/A  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
367285SN/A
368285SN/A  $(JAVA_TARGETS): interim-langtools
369367SN/A
370285SN/A  import-hotspot: hotspot
371285SN/A
372285SN/A  $(LIBS_TARGETS): import-hotspot
373285SN/A
374285SN/A  $(LAUNCHER_TARGETS): java.base-libs
375285SN/A
376285SN/A  # The demos are currently linking to libjvm and libjava, just like all other
377367SN/A  # jdk libs, even though they don't need to. To avoid warnings, make sure they
378367SN/A  # aren't built until after libjava and libjvm are available to link to.
379367SN/A  demos-jdk: $(JAVA_TARGETS)
380285SN/A
381285SN/A  # Declare dependency from <module>-java to <module>-gensrc
382285SN/A  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
383285SN/A
384550Smkos  # Declare dependencies between java modules
385285SN/A  $(foreach m, $(JAVA_MODULES), \
386367SN/A      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
387285SN/A      $(call FindDepsForModule,$m)))))
388285SN/A
389285SN/A  # Declare dependencies between <module>-rmic to <module>-java
390285SN/A  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
391285SN/A
392285SN/A  # Declare dependencies from <module>-lib to <module>-java
393285SN/A  # Skip modules that do not have java source.
394285SN/A  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
395285SN/A
396285SN/A  # Declare dependencies from all other <module>-lib to java.base-lib
397285SN/A  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
398285SN/A      $(eval $t: java.base-libs))
399285SN/A  # Declare the special case dependency for jdk.deploy.osx where libosx
400285SN/A  # links against libosxapp.
401285SN/A  jdk.deploy.osx-libs: java.desktop-libs
402285SN/A
403285SN/A  # jdk.accessibility depends on java.desktop
404285SN/A  jdk.accessibility-libs: java.desktop-libs
405285SN/A
406285SN/A  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
407285SN/A  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
408285SN/A  # virtual target.
409285SN/A  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
410285SN/A
411285SN/A  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
412285SN/A  # loader configuration with jdk.hotspot.agent so is dependent on importing
413285SN/A  # hotspot.
414285SN/A  jdk.jdi-gensrc-jdk: import-hotspot
415285SN/A
416285SN/A  # The swing beans need to have java base properly generated to avoid errors
417285SN/A  # in javadoc.
418285SN/A  java.desktop-gensrc-jdk: java.base-gensrc
419285SN/A
420285SN/A  # Explicitly add dependencies for special targets
421285SN/A  java.base-java: unpack-sec
422285SN/A
423285SN/A  jdk.jdeps-gendata: java rmic
424285SN/A
425285SN/A  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
426285SN/A      $(filter jdk.crypto%, $(JAVA_TARGETS))
427285SN/A
428285SN/A  zip-source: gensrc rmic
429285SN/A
430285SN/A  strip-binaries: libs launchers gendata copy
431367SN/A
432285SN/A  jrtfs-jar: buildtools-jdk
433285SN/A
434285SN/A  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
435285SN/A      jrtfs-jar
436285SN/A
437285SN/A  profiles: exploded-image strip-binaries source-tips
438285SN/A
439285SN/A  mac-bundles-jdk: jimages
440285SN/A
441285SN/A  bootcycle-images: jimages
442285SN/A
443285SN/A  docs-javadoc: gensrc rmic
444285SN/A
445285SN/A  docs-jvmtidoc: hotspot
446285SN/A
447285SN/A  test: jimages test-image
448285SN/A
449285SN/A  verify-modules: exploded-image
450285SN/A
451285SN/A  test-make: clean-test-make
452285SN/A
453285SN/A  build-test-hotspot-jtreg-native: buildtools-jdk
454285SN/A
455285SN/A  build-test-jdk-jtreg-native: buildtools-jdk
456285SN/A
457285SN/A  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
458285SN/A
459285SN/A  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
460285SN/A
461285SN/Aendif
462285SN/A
463285SN/A################################################################################
464285SN/A# Virtual targets without recipes
465383SN/A
466285SN/Abuildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
467285SN/A    buildtools-jdk
468285SN/A
469285SN/Agensrc: $(GENSRC_TARGETS)
470383SN/A
471285SN/Agendata: $(GENDATA_TARGETS)
472285SN/A
473285SN/Acopy: $(COPY_TARGETS)
474285SN/A
475285SN/Ajava: $(JAVA_TARGETS)
476285SN/A
477285SN/Armic: $(RMIC_TARGETS)
478285SN/A
479285SN/Alibs: $(LIBS_TARGETS)
480285SN/A
481285SN/Alaunchers: $(LAUNCHER_TARGETS)
482285SN/A
483285SN/A# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
484285SN/A# is actually handled by jdk.jdi-gensrc
485285SN/Ajdk.jdwp.agent-gensrc: jdk.jdi-gensrc
486285SN/A
487285SN/A# Declare dependencies from <module> to all the individual targets specific
488285SN/A# to that module <module>-*.
489285SN/A$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
490285SN/A$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
491285SN/A$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
492285SN/A$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
493285SN/A$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
494285SN/A$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
495285SN/A$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
496285SN/A
497285SN/AALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
498285SN/A    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
499285SN/A
500285SN/Ademos: demos-jdk
501285SN/A
502285SN/Asamples: samples-jdk
503285SN/A
504285SN/A# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
505285SN/Aexploded-image: $(ALL_MODULE_TARGETS)
506285SN/A
507285SN/Amac-bundles: mac-bundles-jdk
508285SN/A
509285SN/A# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
510285SN/A# and in line with this, our targets for creating these are named *-image[s].
511285SN/A
512285SN/A# This target builds the product images, e.g. the JRE and JDK image
513285SN/A# (and possibly other, more specific versions)
514285SN/Aproduct-images: jimages demos samples zip-security verify-modules
515285SN/A
516285SN/Aifeq ($(OPENJDK_TARGET_OS), macosx)
517285SN/A  product-images: mac-bundles
518285SN/Aendif
519285SN/A
520285SN/A# This target builds the documentation image
521285SN/Adocs-image: docs-javadoc docs-jvmtidoc
522285SN/A
523285SN/A# This target builds the test image
524285SN/Atest-image: prepare-test-image test-image-hotspot-jtreg-native \
525285SN/A    test-image-jdk-jtreg-native
526285SN/A
527285SN/A# all-images is the top-most target, it builds all our deliverables ("images").
528285SN/Aall-images: product-images test-image docs-image
529285SN/A
530285SN/AALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
531285SN/A    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
532285SN/A    mac-bundles product-images docs-image test-image all-images
533285SN/A
534285SN/A################################################################################
535285SN/A
536285SN/A# Traditional targets typically run by users.
537285SN/A# These can be considered aliases for the targets now named by a more
538285SN/A# "modern" naming scheme.
539285SN/Adefault: exploded-image
540285SN/Ajdk: exploded-image
541285SN/Aimages: product-images
542285SN/Adocs: docs-image
543285SN/Aall: all-images
544285SN/A
545285SN/AALL_TARGETS += default jdk images docs all
546285SN/A
547285SN/A################################################################################
548285SN/A################################################################################
549285SN/A#
550285SN/A# Clean targets
551285SN/A#
552285SN/A################################################################################
553285SN/A# Clean targets are automatically run serially by the Makefile calling this
554285SN/A# file.
555285SN/A
556285SN/ACLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
557285SN/A    images make-support test-make bundles
558285SN/ACLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
559285SN/ACLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
560285SN/ACLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
561285SN/ACLEAN_PHASES := gensrc java native include docs
562285SN/ACLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
563285SN/ACLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
564285SN/A# Construct targets of the form clean-$module-$phase
565285SN/ACLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
566285SN/A    $(addprefix $m-, $(CLEAN_PHASES))))
567285SN/A
568285SN/A# Remove everything, except the output from configure.
569285SN/Aclean: $(CLEAN_DIR_TARGETS)
570285SN/A	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
571285SN/A	$(ECHO) Cleaned all build artifacts.
572285SN/A
573285SN/A$(CLEAN_DIR_TARGETS):
574285SN/A	$(call CleanDir,$(patsubst clean-%, %, $@))
575285SN/A
576285SN/A$(CLEAN_TEST_TARGETS):
577285SN/A	$(call CleanTest,$(patsubst clean-test-%, %, $@))
578285SN/A
579285SN/A$(CLEAN_PHASE_TARGETS):
580285SN/A	$(call Clean-$(patsubst clean-%,%, $@))
581285SN/A
582285SN/A$(CLEAN_MODULE_TARGETS):
583285SN/A	$(call CleanModule,$(patsubst clean-%, %, $@))
584285SN/A
585285SN/A$(CLEAN_MODULE_PHASE_TARGETS):
586285SN/A	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
587285SN/A	    $(word 2, $(subst -,$(SPACE),$@)))
588726Saefimov
589285SN/A# When removing the support dir, we must also remove jdk. Building classes has
590285SN/A# the side effect of generating native headers. The headers end up in support
591285SN/A# while classes and touch files end up in jdk.
592285SN/Aclean-support: clean-jdk
593285SN/A
594285SN/A# Remove everything, including configure configuration. If the output
595285SN/A# directory was created by configure and now becomes empty, remove it as well.
596367SN/Adist-clean: clean
597285SN/A	($(CD) $(OUTPUT_ROOT) && \
598367SN/A	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
599285SN/A	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
600285SN/A	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
601285SN/A	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
602285SN/A	  else \
603285SN/A	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
604285SN/A	        && $(RM) -r $(OUTPUT_ROOT)) \
605285SN/A	  fi \
606285SN/A	)
607285SN/A	$(ECHO) Cleaned everything, you will have to re-run configure.
608285SN/A
609285SN/AALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
610285SN/A    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
611285SN/A
612285SN/A################################################################################
613285SN/A# Declare *-only targets for each normal target
614285SN/A$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
615285SN/A
616285SN/AALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
617285SN/A
618285SN/A################################################################################
619285SN/A
620285SN/A# Include JPRT targets
621285SN/Ainclude $(SRC_ROOT)/make/Jprt.gmk
622285SN/A
623285SN/A################################################################################
624285SN/A
625285SN/A# The following targets are intentionally not added to ALL_TARGETS since they
626285SN/A# are internal only, to support Init.gmk.
627285SN/A
628285SN/Aprint-targets:
629285SN/A	  @$(ECHO) $(sort $(ALL_TARGETS))
630285SN/A
631285SN/Aprint-modules:
632285SN/A	  @$(ECHO) $(sort $(ALL_MODULES))
633285SN/A
634285SN/Acreate-main-targets-include:
635285SN/A	  @$(ECHO) $(LOG_INFO) Generating main target list
636285SN/A	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
637285SN/A	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
638285SN/A
639285SN/A################################################################################
640285SN/A
641285SN/A.PHONY: $(ALL_TARGETS)
642285SN/A
643285SN/AFRC: # Force target
644285SN/A