Main.gmk revision 1515:dc3bc6fd57b2
154359Sroberto#
254359Sroberto# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
354359Sroberto# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
482498Sroberto#
554359Sroberto# This code is free software; you can redistribute it and/or modify it
682498Sroberto# under the terms of the GNU General Public License version 2 only, as
754359Sroberto# published by the Free Software Foundation.  Oracle designates this
854359Sroberto# particular file as subject to the "Classpath" exception as provided
9290001Sglebius# by Oracle in the LICENSE file that accompanied this code.
10290001Sglebius#
1154359Sroberto# This code is distributed in the hope that it will be useful, but WITHOUT
1254359Sroberto# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13290001Sglebius# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14290001Sglebius# version 2 for more details (a copy is included in the LICENSE file that
15290001Sglebius# accompanied this code).
1654359Sroberto#
1754359Sroberto# You should have received a copy of the GNU General Public License version
1854359Sroberto# 2 along with this work; if not, write to the Free Software Foundation,
19290001Sglebius# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2054359Sroberto#
2154359Sroberto# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2254359Sroberto# or visit www.oracle.com if you need additional information or have any
2354359Sroberto# questions.
2454359Sroberto#
2554359Sroberto
2654359Sroberto################################################################################
2754359Sroberto# This is the main makefile containing most actual top level targets. It needs
2854359Sroberto# to be called with a SPEC file defined.
2954359Sroberto################################################################################
3054359Sroberto
3154359Sroberto# Declare default target
3254359Srobertodefault:
3354359Sroberto
3454359Srobertoifeq ($(wildcard $(SPEC)),)
3554359Sroberto  $(error Main.gmk needs SPEC set to a proper spec.gmk)
3654359Srobertoendif
3754359Sroberto
3854359Sroberto# Now load the spec
3954359Srobertoinclude $(SPEC)
40290001Sglebius
4154359Srobertoinclude $(SRC_ROOT)/make/MainSupport.gmk
4254359Sroberto
4354359Sroberto# Load the vital tools for all the makefiles.
4454359Srobertoinclude $(SRC_ROOT)/make/common/MakeBase.gmk
4554359Srobertoinclude $(SRC_ROOT)/make/common/Modules.gmk
46182007Sroberto
4754359Sroberto# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
4854359Sroberto# valid top level targets. It's used to declare them all as PHONY and to
4954359Sroberto# generate the -only targets.
50182007SrobertoALL_TARGETS :=
51182007Sroberto
52182007Sroberto# Hook to include the corresponding custom file, if present.
53182007Sroberto$(eval $(call IncludeCustomExtension, , Main.gmk))
54182007Sroberto
55182007Sroberto# All modules for the current target platform.
56182007Sroberto# Manually add jdk.hotspot.agent for now.
57182007SrobertoALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
58182007Sroberto
59182007Sroberto################################################################################
6054359Sroberto################################################################################
6154359Sroberto#
6254359Sroberto# Recipes for all targets. Only recipes, dependencies are declared later.
6354359Sroberto#
6454359Sroberto################################################################################
6554359Sroberto
6654359Sroberto################################################################################
6754359Sroberto# Interim/build tools targets, compiling tools used during the build
6854359Sroberto
6954359Srobertobuildtools-langtools:
7054359Sroberto	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
7154359Sroberto
7254359Srobertointerim-langtools:
7354359Sroberto	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7454359Sroberto
7554359Srobertointerim-corba:
7654359Sroberto	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7754359Sroberto
7854359Srobertointerim-rmic:
7954359Sroberto	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
8054359Sroberto
8154359Srobertobuildtools-jdk:
8254359Sroberto	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
8354359Sroberto
8454359SrobertoALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
8554359Sroberto    interim-rmic buildtools-jdk
8654359Sroberto
8754359Sroberto################################################################################
8854359Sroberto# Special targets for certain modules
8954359Sroberto
9054359Srobertoimport-hotspot:
9154359Sroberto	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
9254359Sroberto
9354359Srobertounpack-sec:
94290001Sglebius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
95290001Sglebius
96290001SglebiusALL_TARGETS += import-hotspot unpack-sec
97290001Sglebius
98290001Sglebius################################################################################
9954359Sroberto# Gensrc targets, generating source before java compilation can be done
100290001Sglebius$(eval $(call DeclareRecipesForPhase, GENSRC, \
101290001Sglebius    TARGET_SUFFIX := gensrc, \
10254359Sroberto    FILE_PREFIX := Gensrc, \
103290001Sglebius    MAKE_SUBDIR := gensrc, \
10454359Sroberto    CHECK_MODULES := $(ALL_MODULES), \
105290001Sglebius    MULTIPLE_MAKEFILES := true))
106290001Sglebius
107290001SglebiusJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
10854359SrobertoLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
10954359SrobertoCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
11054359Sroberto
11154359SrobertoALL_TARGETS += $(GENSRC_TARGETS)
11254359Sroberto
11354359Sroberto################################################################################
11454359Sroberto# Generate data targets
11554359Sroberto$(eval $(call DeclareRecipesForPhase, GENDATA, \
11654359Sroberto    TARGET_SUFFIX := gendata, \
11754359Sroberto    FILE_PREFIX := Gendata, \
11854359Sroberto    MAKE_SUBDIR := gendata, \
11954359Sroberto    CHECK_MODULES := $(ALL_MODULES), \
12054359Sroberto    USE_WRAPPER := true))
12154359Sroberto
12254359SrobertoALL_TARGETS += $(GENDATA_TARGETS)
12354359Sroberto
12454359Sroberto################################################################################
12554359Sroberto# Copy files targets
12654359Sroberto$(eval $(call DeclareRecipesForPhase, COPY, \
12754359Sroberto    TARGET_SUFFIX := copy, \
12854359Sroberto    FILE_PREFIX := Copy, \
12954359Sroberto    MAKE_SUBDIR := copy, \
13054359Sroberto    CHECK_MODULES := $(ALL_MODULES), \
13154359Sroberto    USE_WRAPPER := true))
13254359Sroberto
13354359SrobertoALL_TARGETS += $(COPY_TARGETS)
13454359Sroberto
13554359Sroberto################################################################################
13654359Sroberto# Targets for compiling all java modules. Nashorn is treated separately.
13754359SrobertoJAVA_MODULES := $(call FindJavaModules)
13854359SrobertoJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
13954359Sroberto
14054359Srobertodefine DeclareCompileJavaRecipe
14154359Sroberto  $1-java:
14254359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
14354359Sroberto	    $1 JAVA_MODULES=$1)
14454359Srobertoendef
14554359Sroberto
14654359Sroberto$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
147290001Sglebius    $(eval $(call DeclareCompileJavaRecipe,$m)))
148290001Sglebius
149290001Sglebius# Build nashorn. Needs to be compiled separately from the rest of the modules
150290001Sglebius# due to nasgen.
151290001Sglebiusjdk.scripting.nashorn-java:
152290001Sglebius	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
153290001Sglebius
154290001SglebiusALL_TARGETS += $(JAVA_TARGETS)
15554359Sroberto
15654359Sroberto################################################################################
157290001Sglebius# Targets for running rmic.
15854359Sroberto$(eval $(call DeclareRecipesForPhase, RMIC, \
15954359Sroberto    TARGET_SUFFIX := rmic, \
16054359Sroberto    FILE_PREFIX := Rmic, \
16154359Sroberto    MAKE_SUBDIR := rmic, \
16254359Sroberto    CHECK_MODULES := $(ALL_MODULES)))
16354359Sroberto
16454359SrobertoALL_TARGETS += $(RMIC_TARGETS)
16554359Sroberto
16654359Sroberto################################################################################
16754359Sroberto# Targets for compiling native libraries
16854359Sroberto$(eval $(call DeclareRecipesForPhase, LIBS, \
16954359Sroberto    TARGET_SUFFIX := libs, \
17054359Sroberto    FILE_PREFIX := Lib, \
17154359Sroberto    MAKE_SUBDIR := lib, \
17254359Sroberto    CHECK_MODULES := $(ALL_MODULES), \
17354359Sroberto    USE_WRAPPER := true))
17454359Sroberto
17554359SrobertoALL_TARGETS += $(LIBS_TARGETS)
17654359Sroberto
17754359Sroberto################################################################################
178182007Sroberto# Targets for compiling native executables
17954359Sroberto$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
18054359Sroberto    TARGET_SUFFIX := launchers, \
18154359Sroberto    FILE_PREFIX := Launcher, \
18254359Sroberto    MAKE_SUBDIR := launcher, \
18354359Sroberto    CHECK_MODULES := $(ALL_MODULES), \
18454359Sroberto    USE_WRAPPER := true))
18554359Sroberto
18654359SrobertoALL_TARGETS += $(LAUNCHER_TARGETS)
18754359Sroberto
18854359Sroberto################################################################################
18954359Sroberto# Build hotspot target
19054359Sroberto
19154359Srobertoifeq ($(BUILD_HOTSPOT),true)
19254359Sroberto  hotspot:
19354359Sroberto	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
19454359Srobertoendif
19554359Sroberto
19654359SrobertoALL_TARGETS += hotspot
19754359Sroberto
198290001Sglebius################################################################################
19954359Sroberto# Build demos and samples targets
20054359Sroberto
20154359Srobertodemos:
20254359Sroberto	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
20354359Sroberto
20454359Srobertosamples:
20554359Sroberto	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
20654359Sroberto
20754359SrobertoALL_TARGETS += demos samples
20854359Sroberto
20954359Sroberto################################################################################
21054359Sroberto# Image targets
21154359Sroberto
21254359Sroberto# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
21354359Sroberto# used to track the exact sources used to build that image.
21454359Srobertosource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
21554359Sroberto$(SUPPORT_OUTPUTDIR)/source_tips: FRC
21654359Sroberto	@$(MKDIR) -p $(@D)
21754359Sroberto	@$(RM) $@
21854359Sroberto	@$(call GetSourceTips)
21954359Sroberto
22054359SrobertoBOOTCYCLE_TARGET := product-images
22154359Srobertobootcycle-images:
22254359Sroberto	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
22354359Sroberto	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
22454359Sroberto	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
22554359Sroberto
22654359Srobertozip-security:
22754359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
22854359Sroberto
22954359Srobertozip-source:
23054359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
23154359Sroberto
23254359Srobertostrip-binaries:
23354359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
23454359Sroberto
23554359Srobertojrtfs-jar:
23654359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
23754359Sroberto
23854359Srobertojimages:
23954359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
24054359Sroberto
24154359Srobertoprofiles:
24254359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
24354359Sroberto
24454359Srobertomac-bundles:
24554359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
24654359Sroberto
24754359SrobertoALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
24854359Sroberto    jrtfs-jar jimages profiles mac-bundles
24954359Sroberto
25054359Sroberto################################################################################
25154359Sroberto# Docs targets
25254359Sroberto
25354359Srobertodocs-javadoc:
25454359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
25554359Sroberto
25654359Srobertodocs-jvmtidoc:
25754359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
25854359Sroberto
25954359SrobertoALL_TARGETS += docs-javadoc docs-jvmtidoc
26054359Sroberto
26154359Sroberto################################################################################
26254359Sroberto# Build tests
263290001Sglebius#
26454359Sroberto
26554359Srobertoprepare-test-image:
26654359Sroberto	$(MKDIR) -p $(TEST_IMAGE_DIR)
26754359Sroberto	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
26854359Sroberto
26954359Srobertobuild-test-hotspot-jtreg-native:
27054359Sroberto	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27154359Sroberto	    build-test-hotspot-jtreg-native)
272290001Sglebius
27354359Srobertotest-image-hotspot-jtreg-native:
27454359Sroberto	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27554359Sroberto	    test-image-hotspot-jtreg-native)
27654359Sroberto
27754359Srobertobuild-test-jdk-jtreg-native:
27854359Sroberto	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27954359Sroberto	    build-test-jdk-jtreg-native)
28054359Sroberto
28154359Srobertotest-image-jdk-jtreg-native:
28254359Sroberto	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28354359Sroberto	    test-image-jdk-jtreg-native)
28454359Sroberto
28554359SrobertoALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
28654359Sroberto    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
28754359Sroberto    test-image-jdk-jtreg-native
28854359Sroberto
28954359Sroberto################################################################################
29054359Sroberto# Run tests
29154359Sroberto
29254359Sroberto# Run tests specified by $(TEST), or the default test set.
29354359Srobertotest:
29454359Sroberto	$(call RunTests, $(TEST))
29554359Sroberto
29654359Srobertotest-hotspot-jtreg-native:
29754359Sroberto	$(call RunTests, "hotspot_native_sanity")
29854359Sroberto
29954359Srobertotest-jdk-jtreg-native:
30054359Sroberto	$(call RunTests, "jdk_native_sanity")
30154359Sroberto
30254359Srobertotest-make:
30354359Sroberto	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
30454359Sroberto
30554359SrobertoALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
30654359Sroberto
30754359Sroberto################################################################################
30854359Sroberto# Verification targets
30954359Sroberto
31054359Srobertoverify-modules:
31154359Sroberto	@$(call TargetEnter)
31254359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
31354359Sroberto	@$(call TargetExit)
31454359Sroberto
31554359SrobertoALL_TARGETS += verify-modules
31654359Sroberto
31754359Sroberto################################################################################
31854359Sroberto# Install targets
31954359Sroberto
32054359Srobertoinstall:
32154359Sroberto	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
32254359Sroberto
32354359SrobertoALL_TARGETS += install
32454359Sroberto
32554359Sroberto################################################################################
32654359Sroberto#
32754359Sroberto# Dependency declarations between targets.
32854359Sroberto#
32954359Sroberto# These are declared in two groups. First all dependencies between targets that
330290001Sglebius# have recipes above as these dependencies may be disabled. Then the aggregator
331290001Sglebius# targets that do not have recipes of their own, which will never have their
33254359Sroberto# dependencies disabled.
33354359Sroberto#
33454359Sroberto################################################################################
33554359Sroberto# Targets with recipes above
33654359Sroberto
33754359Sroberto# If running an *-only target, parallel execution and dependencies between
33854359Sroberto# recipe targets are disabled. This makes it possible to run a select set of
33954359Sroberto# recipe targets in order. It's the responsibility of the user to make sure
34054359Sroberto# all prerequisites are fulfilled.
34154359Srobertoifneq ($(findstring -only, $(MAKECMDGOALS)), )
34254359Sroberto  .NOTPARALLEL:
34354359Srobertoelse
34454359Sroberto  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
34554359Sroberto
34654359Sroberto  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
34754359Sroberto
34854359Sroberto  buildtools-jdk: interim-langtools
34954359Sroberto
35054359Sroberto  $(CORBA_GENSRC_TARGETS): interim-langtools
35154359Sroberto
35254359Sroberto  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
35354359Sroberto
35454359Sroberto  interim-corba: $(CORBA_GENSRC_TARGETS)
35554359Sroberto
35654359Sroberto  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
35754359Sroberto
358290001Sglebius  interim-rmic: interim-langtools
35954359Sroberto
36054359Sroberto  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
36154359Sroberto
362290001Sglebius  import-hotspot: hotspot
36354359Sroberto
36454359Sroberto  $(LIBS_TARGETS): import-hotspot
36554359Sroberto
36654359Sroberto  $(LAUNCHER_TARGETS): java.base-libs
36754359Sroberto
36854359Sroberto  # The demos are currently linking to libjvm and libjava, just like all other
36954359Sroberto  # jdk libs, even though they don't need to. To avoid warnings, make sure they
370290001Sglebius  # aren't built until after libjava and libjvm are available to link to.
37154359Sroberto  demos: $(JAVA_TARGETS)
37254359Sroberto
37354359Sroberto  # Declare dependency from <module>-java to <module>-gensrc
37454359Sroberto  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
37554359Sroberto
37654359Sroberto  # Declare dependencies between java modules
37754359Sroberto  $(foreach m, $(JAVA_MODULES), \
37854359Sroberto      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
37954359Sroberto      $(call FindDepsForModule,$m)))))
38054359Sroberto
38154359Sroberto  # Declare dependencies between <module>-rmic to <module>-java
38254359Sroberto  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
38354359Sroberto
38454359Sroberto  # Declare dependencies from <module>-lib to <module>-java
38554359Sroberto  # Skip modules that do not have java source.
38654359Sroberto  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
38754359Sroberto
38854359Sroberto  # Declare dependencies from all other <module>-lib to java.base-lib
38954359Sroberto  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
39054359Sroberto      $(eval $t: java.base-libs))
39154359Sroberto  # Declare the special case dependency for jdk.deploy.osx where libosx
39254359Sroberto  # links against libosxapp.
393290001Sglebius  jdk.deploy.osx-libs: java.desktop-libs
39454359Sroberto
39554359Sroberto  # jdk.accessibility depends on java.desktop
39654359Sroberto  jdk.accessibility-libs: java.desktop-libs
39754359Sroberto
39854359Sroberto  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
39954359Sroberto  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
40054359Sroberto  # virtual target.
40154359Sroberto  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
40254359Sroberto
40354359Sroberto  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
40454359Sroberto  # loader configuration with jdk.hotspot.agent so is dependent on importing
40554359Sroberto  # hotspot.
40654359Sroberto  jdk.jdi-gensrc-jdk: import-hotspot
40754359Sroberto
40854359Sroberto  # The swing beans need to have java base properly generated to avoid errors
40954359Sroberto  # in javadoc.
41054359Sroberto  java.desktop-gensrc-jdk: java.base-gensrc
41154359Sroberto
41254359Sroberto  # Explicitly add dependencies for special targets
41354359Sroberto  java.base-java: unpack-sec
41454359Sroberto
41554359Sroberto  jdk.jdeps-gendata: java rmic
41654359Sroberto
41754359Sroberto  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
41854359Sroberto      $(filter jdk.crypto%, $(JAVA_TARGETS))
41954359Sroberto
42054359Sroberto  zip-source: gensrc rmic
42154359Sroberto
42254359Sroberto  strip-binaries: libs launchers gendata copy
42354359Sroberto
42454359Sroberto  jrtfs-jar: buildtools-jdk
42554359Sroberto
42654359Sroberto  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
42754359Sroberto      jrtfs-jar
42854359Sroberto
429132451Sroberto  profiles: exploded-image strip-binaries source-tips
43054359Sroberto
43154359Sroberto  mac-bundles: jimages
43254359Sroberto
43354359Sroberto  bootcycle-images: jimages
43454359Sroberto
43554359Sroberto  docs-javadoc: gensrc rmic
43654359Sroberto
43754359Sroberto  docs-jvmtidoc: hotspot
43854359Sroberto
43954359Sroberto  test: jimages test-image
44054359Sroberto
44154359Sroberto  verify-modules: exploded-image
44254359Sroberto
44354359Sroberto  test-make: clean-test-make
44454359Sroberto
44554359Sroberto  build-test-hotspot-jtreg-native: buildtools-jdk
44654359Sroberto
44754359Sroberto  build-test-jdk-jtreg-native: buildtools-jdk
44854359Sroberto
44954359Sroberto  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
45054359Sroberto
45154359Sroberto  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
45254359Sroberto
45354359Srobertoendif
45454359Sroberto
45554359Sroberto################################################################################
45654359Sroberto# Virtual targets without recipes
45754359Sroberto
45854359Srobertobuildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
45954359Sroberto    buildtools-jdk
46054359Sroberto
46154359Srobertogensrc: $(GENSRC_TARGETS)
46254359Sroberto
46354359Srobertogendata: $(GENDATA_TARGETS)
46454359Sroberto
46554359Srobertocopy: $(COPY_TARGETS)
46654359Sroberto
46754359Srobertojava: $(JAVA_TARGETS)
46854359Sroberto
46954359Srobertormic: $(RMIC_TARGETS)
47054359Sroberto
47154359Srobertolibs: $(LIBS_TARGETS)
47254359Sroberto
47354359Srobertolaunchers: $(LAUNCHER_TARGETS)
47454359Sroberto
47554359Sroberto# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
47654359Sroberto# is actually handled by jdk.jdi-gensrc
47754359Srobertojdk.jdwp.agent-gensrc: jdk.jdi-gensrc
47854359Sroberto
47954359Sroberto# Declare dependencies from <module> to all the individual targets specific
48054359Sroberto# to that module <module>-*.
48154359Sroberto$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
48254359Sroberto$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
48354359Sroberto$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
48454359Sroberto$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
48554359Sroberto$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
48654359Sroberto$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
48754359Sroberto$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
48854359Sroberto
48954359SrobertoALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
49054359Sroberto    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
49154359Sroberto
49254359Sroberto# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
49354359Srobertoexploded-image: $(ALL_MODULE_TARGETS)
49454359Sroberto
49554359Sroberto# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
49654359Sroberto# and in line with this, our targets for creating these are named *-image[s].
49754359Sroberto
49854359Sroberto# This target builds the product images, e.g. the JRE and JDK image
49954359Sroberto# (and possibly other, more specific versions)
50054359Srobertoproduct-images: jimages demos samples zip-security verify-modules
50154359Sroberto
50254359Srobertoifeq ($(OPENJDK_TARGET_OS), macosx)
50354359Sroberto  product-images: mac-bundles
50454359Srobertoendif
50554359Sroberto
50654359Sroberto# This target builds the documentation image
50754359Srobertodocs-image: docs-javadoc docs-jvmtidoc
50854359Sroberto
50954359Sroberto# This target builds the test image
51054359Srobertotest-image: prepare-test-image test-image-hotspot-jtreg-native \
51154359Sroberto    test-image-jdk-jtreg-native
51254359Sroberto
51354359Sroberto# all-images is the top-most target, it builds all our deliverables ("images").
51454359Srobertoall-images: product-images test-image docs-image
51554359Sroberto
51654359SrobertoALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
51754359Sroberto    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image \
51854359Sroberto    product-images docs-image test-image all-images
51954359Sroberto
52054359Sroberto################################################################################
52154359Sroberto
52254359Sroberto# Traditional targets typically run by users.
52354359Sroberto# These can be considered aliases for the targets now named by a more
52454359Sroberto# "modern" naming scheme.
52554359Srobertodefault: exploded-image
52654359Srobertojdk: exploded-image
52754359Srobertoimages: product-images
52854359Srobertodocs: docs-image
52954359Srobertoall: all-images
53054359Sroberto
53154359SrobertoALL_TARGETS += default jdk images docs all
53254359Sroberto
53354359Sroberto################################################################################
53454359Sroberto################################################################################
53554359Sroberto#
53654359Sroberto# Clean targets
53754359Sroberto#
53854359Sroberto################################################################################
53954359Sroberto# Clean targets are automatically run serially by the Makefile calling this
54054359Sroberto# file.
54154359Sroberto
54254359SrobertoCLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
54354359Sroberto    images make-support test-make bundles
54454359SrobertoCLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
54554359SrobertoCLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native
54654359SrobertoCLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
54754359SrobertoCLEAN_PHASES := gensrc java native include docs
54854359SrobertoCLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
54954359SrobertoCLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
55054359Sroberto# Construct targets of the form clean-$module-$phase
55154359SrobertoCLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
55254359Sroberto    $(addprefix $m-, $(CLEAN_PHASES))))
55354359Sroberto
55454359Sroberto# Remove everything, except the output from configure.
55554359Srobertoclean: $(CLEAN_DIR_TARGETS)
55654359Sroberto	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
55754359Sroberto	$(ECHO) Cleaned all build artifacts.
55854359Sroberto
55954359Sroberto$(CLEAN_DIR_TARGETS):
56054359Sroberto	$(call CleanDir,$(patsubst clean-%, %, $@))
56154359Sroberto
56254359Sroberto$(CLEAN_TEST_TARGETS):
56354359Sroberto	$(call CleanTest,$(patsubst clean-test-%, %, $@))
56454359Sroberto
56554359Sroberto$(CLEAN_PHASE_TARGETS):
56654359Sroberto	$(call Clean-$(patsubst clean-%,%, $@))
56754359Sroberto
56854359Sroberto$(CLEAN_MODULE_TARGETS):
56954359Sroberto	$(call CleanModule,$(patsubst clean-%, %, $@))
57054359Sroberto
57154359Sroberto$(CLEAN_MODULE_PHASE_TARGETS):
57254359Sroberto	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
57354359Sroberto	    $(word 2, $(subst -,$(SPACE),$@)))
57454359Sroberto
57554359Sroberto# When removing the support dir, we must also remove jdk. Building classes has
57654359Sroberto# the side effect of generating native headers. The headers end up in support
57754359Sroberto# while classes and touch files end up in jdk.
57854359Srobertoclean-support: clean-jdk
57954359Sroberto
58054359Sroberto# Remove everything, including configure configuration. If the output
58154359Sroberto# directory was created by configure and now becomes empty, remove it as well.
58254359Srobertodist-clean: clean
58354359Sroberto	($(CD) $(OUTPUT_ROOT) && \
58454359Sroberto	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
58554359Sroberto	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
58654359Sroberto	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
58754359Sroberto	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
58854359Sroberto	  else \
58954359Sroberto	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
59054359Sroberto	        && $(RM) -r $(OUTPUT_ROOT)) \
59154359Sroberto	  fi \
59254359Sroberto	)
59354359Sroberto	$(ECHO) Cleaned everything, you will have to re-run configure.
59454359Sroberto
59554359SrobertoALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
59654359Sroberto    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
59754359Sroberto
59854359Sroberto################################################################################
599290001Sglebius# Declare *-only targets for each normal target
60054359Sroberto$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
601
602ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
603
604################################################################################
605
606# Include JPRT targets
607include $(SRC_ROOT)/make/Jprt.gmk
608
609################################################################################
610
611# The following targets are intentionally not added to ALL_TARGETS since they
612# are internal only, to support Init.gmk.
613
614print-targets:
615	  @$(ECHO) $(sort $(ALL_TARGETS))
616
617print-modules:
618	  @$(ECHO) $(sort $(ALL_MODULES))
619
620create-main-targets-include:
621	  @$(ECHO) $(LOG_INFO) Generating main target list
622	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
623	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
624
625################################################################################
626
627.PHONY: $(ALL_TARGETS)
628
629FRC: # Force target
630