Main.gmk revision 1641:7fa1d71d8ddf
1139749Simp#
272016Scg# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
372016Scg# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
472016Scg#
572016Scg# This code is free software; you can redistribute it and/or modify it
672016Scg# under the terms of the GNU General Public License version 2 only, as
772016Scg# published by the Free Software Foundation.  Oracle designates this
872016Scg# particular file as subject to the "Classpath" exception as provided
972016Scg# by Oracle in the LICENSE file that accompanied this code.
1072016Scg#
1172016Scg# This code is distributed in the hope that it will be useful, but WITHOUT
1272016Scg# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1372016Scg# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1472016Scg# version 2 for more details (a copy is included in the LICENSE file that
1572016Scg# accompanied this code).
1672016Scg#
1772016Scg# You should have received a copy of the GNU General Public License version
1872016Scg# 2 along with this work; if not, write to the Free Software Foundation,
1972016Scg# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2072016Scg#
2172016Scg# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2272016Scg# or visit www.oracle.com if you need additional information or have any
2372016Scg# questions.
2472016Scg#
2572016Scg
2672016Scg################################################################################
2772016Scg# This is the main makefile containing most actual top level targets. It needs
2872016Scg# to be called with a SPEC file defined.
2972016Scg################################################################################
30108533Sschweikh
3172016Scg# Declare default target
3273772Scgdefault:
3378362Scg
3472016Scgifeq ($(wildcard $(SPEC)),)
3572016Scg  $(error Main.gmk needs SPEC set to a proper spec.gmk)
3672016Scgendif
3774994Sorion
3874994Sorion# Now load the spec
3974994Sorioninclude $(SPEC)
4074994Sorion
4172016Scginclude $(SRC_ROOT)/make/MainSupport.gmk
4272016Scg
4372016Scg# Load the vital tools for all the makefiles.
4472016Scginclude $(SRC_ROOT)/make/common/MakeBase.gmk
4572016Scginclude $(SRC_ROOT)/make/common/Modules.gmk
4672016Scg
47119287Simp# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48119287Simp# valid top level targets. It's used to declare them all as PHONY and to
4972016Scg# generate the -only targets.
5074994SorionALL_TARGETS :=
51158980Snetchild
5274994Sorion# Hook to include the corresponding custom file, if present.
5372016Scg$(eval $(call IncludeCustomExtension, , Main.gmk))
54158980Snetchild
5572016Scg# All modules for the current target platform.
5682180Scg# Manually add jdk.hotspot.agent for now.
5782180ScgALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
5872016Scg
5972016Scg################################################################################
6072016Scg################################################################################
6172016Scg#
6272016Scg# Recipes for all targets. Only recipes, dependencies are declared later.
63187375Skeramida#
6472016Scg################################################################################
6572016Scg
6684771Sorion################################################################################
6772016Scg# Interim/build tools targets, compiling tools used during the build
6872016Scg
6972016Scgbuildtools-langtools:
7072016Scg	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
7172016Scg
7272016Scginterim-langtools:
7372016Scg	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7472016Scg
7572016Scginterim-corba:
7672016Scg	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7772016Scg
7872016Scginterim-rmic:
7972016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
8072016Scg
8174994Sorioninterim-cldrconverter:
8272016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
8372016Scg
8472016Scgbuildtools-jdk:
8572016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
8672016Scg
8772016ScgALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
8872016Scg    interim-rmic interim-cldrconverter buildtools-jdk
8972016Scg
9072016Scg################################################################################
9172016Scg# Special targets for certain modules
9272016Scg
9374994Sorionimport-hotspot:
9472016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
9574994Sorion
9674994Sorionunpack-sec:
9774994Sorion	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
9874994Sorion
9974994SorionALL_TARGETS += import-hotspot unpack-sec
10074994Sorion
10174994Sorion################################################################################
10272016Scg# Gensrc targets, generating source before java compilation can be done
10372016Scg$(eval $(call DeclareRecipesForPhase, GENSRC, \
10474994Sorion    TARGET_SUFFIX := gensrc, \
10574994Sorion    FILE_PREFIX := Gensrc, \
10673772Scg    MAKE_SUBDIR := gensrc, \
10774994Sorion    CHECK_MODULES := $(ALL_MODULES), \
10874994Sorion    MULTIPLE_MAKEFILES := true))
10974994Sorion
11075174SorionJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
11174994SorionLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
11274994SorionCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
113107285Scg
11472016ScgALL_TARGETS += $(GENSRC_TARGETS)
11588032Sorion
11684771Sorion################################################################################
11774994Sorion# Generate data targets
118158980Snetchild$(eval $(call DeclareRecipesForPhase, GENDATA, \
119158980Snetchild    TARGET_SUFFIX := gendata, \
120158980Snetchild    FILE_PREFIX := Gendata, \
121158980Snetchild    MAKE_SUBDIR := gendata, \
122158980Snetchild    CHECK_MODULES := $(ALL_MODULES), \
123158980Snetchild    USE_WRAPPER := true))
124158980Snetchild
12572016ScgALL_TARGETS += $(GENDATA_TARGETS)
12672016Scg
12772016Scg################################################################################
12872016Scg# Copy files targets
12972016Scg$(eval $(call DeclareRecipesForPhase, COPY, \
13072016Scg    TARGET_SUFFIX := copy, \
13172016Scg    FILE_PREFIX := Copy, \
13272016Scg    MAKE_SUBDIR := copy, \
13372016Scg    CHECK_MODULES := $(ALL_MODULES), \
13472016Scg    USE_WRAPPER := true))
13572016Scg
13672016ScgALL_TARGETS += $(COPY_TARGETS)
13774763Scg
13872016Scg################################################################################
13972016Scg# Targets for compiling all java modules. Nashorn is treated separately.
14072016ScgJAVA_MODULES := $(call FindJavaModules)
14172016ScgJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
14272016Scg
14374994Soriondefine DeclareCompileJavaRecipe
14472016Scg  $1-java:
14572016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
14672016Scg	    $1 JAVA_MODULES=$1 MODULE=$1)
14774994Sorionendef
14872016Scg
14974994Sorion$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
15072016Scg    $(eval $(call DeclareCompileJavaRecipe,$m)))
15174994Sorion
15272016Scg# Build nashorn. Needs to be compiled separately from the rest of the modules
15372016Scg# due to nasgen.
15472016Scgjdk.scripting.nashorn-java:
15572016Scg	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
15672016Scg
15772016ScgALL_TARGETS += $(JAVA_TARGETS)
15872016Scg
15974994Sorion################################################################################
16072016Scg# Targets for running rmic.
16172016Scg$(eval $(call DeclareRecipesForPhase, RMIC, \
16272016Scg    TARGET_SUFFIX := rmic, \
16374994Sorion    FILE_PREFIX := Rmic, \
16472016Scg    MAKE_SUBDIR := rmic, \
16572016Scg    CHECK_MODULES := $(ALL_MODULES)))
16674994Sorion
16772016ScgALL_TARGETS += $(RMIC_TARGETS)
16872016Scg
16974994Sorion################################################################################
17072016Scg# Targets for compiling native libraries
17172016Scg$(eval $(call DeclareRecipesForPhase, LIBS, \
17272016Scg    TARGET_SUFFIX := libs, \
17372016Scg    FILE_PREFIX := Lib, \
17472016Scg    MAKE_SUBDIR := lib, \
17578362Scg    CHECK_MODULES := $(ALL_MODULES), \
17672016Scg    USE_WRAPPER := true))
17772016Scg
17872016ScgALL_TARGETS += $(LIBS_TARGETS)
17972016Scg
18074994Sorion################################################################################
18172016Scg# Targets for compiling native executables
18272016Scg$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
18374994Sorion    TARGET_SUFFIX := launchers, \
18472016Scg    FILE_PREFIX := Launcher, \
18572016Scg    MAKE_SUBDIR := launcher, \
18672016Scg    CHECK_MODULES := $(ALL_MODULES), \
18774994Sorion    USE_WRAPPER := true))
18872016Scg
18972016ScgALL_TARGETS += $(LAUNCHER_TARGETS)
19073772Scg
19174994Sorion################################################################################
19272016Scg# Build hotspot target
19374994Sorion
19472016Scgifeq ($(BUILD_HOTSPOT),true)
19572016Scg  hotspot:
19672016Scg	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
19774994Sorionendif
19872016Scg
19972016ScgALL_TARGETS += hotspot
20072016Scg
20174994Sorion################################################################################
20272016Scg# Build demos and samples targets
20374994Sorion
20472016Scgdemos-jdk:
20572016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
20672016Scg
20772016Scgsamples-jdk:
20872016Scg	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
20973772Scg
21072016ScgALL_TARGETS += demos-jdk samples-jdk
21172016Scg
21272016Scg################################################################################
21372016Scg# Image targets
21472016Scg
21572016Scg# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
21673772Scg# used to track the exact sources used to build that image.
21772016Scgsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
21872016Scg$(SUPPORT_OUTPUTDIR)/source_tips: FRC
21972016Scg	@$(MKDIR) -p $(@D)
22073772Scg	@$(RM) $@
22172016Scg	@$(call GetSourceTips)
22272016Scg
22372016ScgBOOTCYCLE_TARGET := product-images
22472016Scgbootcycle-images:
22572016Scg	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
22672016Scg	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
22772016Scg	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
22872016Scg
22972016Scgzip-security:
23072016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
23172016Scg
23272016Scgzip-source:
23373772Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
23473772Scg
23572016Scgstrip-binaries:
23672016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
23772016Scg
23872016Scgjrtfs-jar:
23972016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
24072016Scg
24172016Scgjimages:
24272016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
24372016Scg
24474994Sorionprofiles:
24574994Sorion	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
24672016Scg
24772016Scgmac-bundles-jdk:
24878362Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
24972016Scg
250102328SorionALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
25174994Sorion    jrtfs-jar jimages profiles mac-bundles-jdk
252111183Scognet
25374994Sorion################################################################################
254102328Sorion# Docs targets
25574994Sorion
25674994Soriondocs-javadoc:
25774994Sorion	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
25875174Sorion
25974994Soriondocs-jvmtidoc:
26074994Sorion	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
26175174Sorion
26278362ScgALL_TARGETS += docs-javadoc docs-jvmtidoc
26374994Sorion
26475174Sorion################################################################################
26575174Sorion# Build tests
26675174Sorion#
26775174Sorion
26875174Sorionprepare-test-image:
26975174Sorion	$(MKDIR) -p $(TEST_IMAGE_DIR)
27078362Scg	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
27178362Scg
27275174Sorionbuild-test-hotspot-jtreg-native:
27375174Sorion	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27474994Sorion	    build-test-hotspot-jtreg-native)
27572016Scg
27672016Scgtest-image-hotspot-jtreg-native:
27774994Sorion	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27874994Sorion	    test-image-hotspot-jtreg-native)
27972016Scg
28074994Sorionbuild-test-jdk-jtreg-native:
28172016Scg	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28275174Sorion	    build-test-jdk-jtreg-native)
28378362Scg
28478362Scgtest-image-jdk-jtreg-native:
28575290Sorion	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28674994Sorion	    test-image-jdk-jtreg-native)
28774994Sorion
28872016Scgbuild-test-lib:
28972016Scg	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
29072016Scg
29174994SorionALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
29272016Scg    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
29375174Sorion    test-image-jdk-jtreg-native build-test-lib
29478362Scg
29575174Sorion################################################################################
29678362Scg# Run tests
29775174Sorion
29874994Sorion# Run tests specified by $(TEST), or the default test set.
29974994Soriontest:
30072016Scg	$(call RunTests, $(TEST))
30172016Scg
30274994Soriontest-hotspot-jtreg-native:
30374994Sorion	$(call RunTests, "hotspot_native_sanity")
30472016Scg
30574994Soriontest-jdk-jtreg-native:
30672016Scg	$(call RunTests, "jdk_native_sanity")
30775174Sorion
30878362Scgtest-make:
30978362Scg	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
31075290Sorion
31174994SorionALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
31274994Sorion
31372016Scg################################################################################
31472016Scg# Verification targets
31572016Scg
31674994Sorionverify-modules:
31772016Scg	@$(call TargetEnter)
31872016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
31972016Scg	@$(call TargetExit)
32072016Scg
32172016ScgALL_TARGETS += verify-modules
32273772Scg
32372016Scg################################################################################
32472016Scg# Install targets
32572016Scg
32672016Scginstall:
32772016Scg	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
32874994Sorion
32972016ScgALL_TARGETS += install
33074994Sorion
33174994Sorion################################################################################
33274994Sorion#
33372016Scg# Dependency declarations between targets.
33472016Scg#
33572016Scg# These are declared in two groups. First all dependencies between targets that
33672016Scg# have recipes above as these dependencies may be disabled. Then the aggregator
33772016Scg# targets that do not have recipes of their own, which will never have their
33872016Scg# dependencies disabled.
33972016Scg#
34078362Scg################################################################################
34174994Sorion# Targets with recipes above
34272016Scg
34374994Sorion# If running an *-only target, parallel execution and dependencies between
34474994Sorion# recipe targets are disabled. This makes it possible to run a select set of
34572016Scg# recipe targets in order. It's the responsibility of the user to make sure
34674994Sorion# all prerequisites are fulfilled.
34774994Sorionifneq ($(findstring -only, $(MAKECMDGOALS)), )
34874994Sorion  .NOTPARALLEL:
34974994Sorionelse
35074994Sorion  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
35174994Sorion
35274994Sorion  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
353168847Sariff
35472016Scg  buildtools-jdk: interim-langtools interim-cldrconverter
35572016Scg
35672016Scg  $(CORBA_GENSRC_TARGETS): interim-langtools
35772016Scg
35872016Scg  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
35983214Sgreen
36075174Sorion  interim-corba: $(CORBA_GENSRC_TARGETS)
36175174Sorion
36272016Scg  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
36375174Sorion
36472016Scg  interim-rmic: interim-langtools
36583214Sgreen
36672016Scg  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
36772016Scg
36872016Scg  $(JAVA_TARGETS): interim-langtools
36972016Scg
37073772Scg  import-hotspot: hotspot
37173772Scg
37272016Scg  $(LIBS_TARGETS): import-hotspot
37374994Sorion
37483214Sgreen  $(LAUNCHER_TARGETS): java.base-libs
37572016Scg
37672016Scg  # The demos are currently linking to libjvm and libjava, just like all other
37772016Scg  # jdk libs, even though they don't need to. To avoid warnings, make sure they
37872016Scg  # aren't built until after libjava and libjvm are available to link to.
37972016Scg  demos-jdk: $(JAVA_TARGETS)
38072016Scg
38172016Scg  # Declare dependency from <module>-java to <module>-gensrc
38272016Scg  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
38372016Scg
38472016Scg  # Declare dependencies between java modules
38572016Scg  $(foreach m, $(JAVA_MODULES), \
38672016Scg      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
38772016Scg      $(call FindDepsForModule,$m)))))
38872016Scg
38972016Scg  # Declare dependencies between <module>-rmic to <module>-java
39072016Scg  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
39172016Scg
39283214Sgreen  # Declare dependencies from <module>-lib to <module>-java
39372016Scg  # Skip modules that do not have java source.
39472016Scg  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
39572016Scg
39672016Scg  # Declare dependencies from all other <module>-lib to java.base-lib
39772016Scg  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
39872016Scg      $(eval $t: java.base-libs))
39972016Scg  # Declare the special case dependency for jdk.deploy.osx where libosx
40072016Scg  # links against libosxapp.
40172016Scg  jdk.deploy.osx-libs: java.desktop-libs
40272016Scg
40372016Scg  # jdk.accessibility depends on java.desktop
40472016Scg  jdk.accessibility-libs: java.desktop-libs
40572016Scg
40683214Sgreen  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
40773772Scg  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
40872016Scg  # virtual target.
40972016Scg  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
41072016Scg
41172016Scg  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
41273772Scg  # loader configuration with jdk.hotspot.agent so is dependent on importing
41372016Scg  # hotspot.
41473772Scg  jdk.jdi-gensrc-jdk: import-hotspot
41574994Sorion
41683214Sgreen  # The swing beans need to have java base properly generated to avoid errors
41772016Scg  # in javadoc.
41872016Scg  java.desktop-gensrc-jdk: java.base-gensrc
41972016Scg
42083214Sgreen  # Explicitly add dependencies for special targets
42172016Scg  java.base-java: unpack-sec
42288032Sorion
42388032Sorion  jdk.jdeps-gendata: java rmic
42472016Scg
42588032Sorion  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
42672016Scg      $(filter jdk.crypto%, $(JAVA_TARGETS))
42772016Scg
42872016Scg  zip-source: gensrc rmic
42972016Scg
43072016Scg  strip-binaries: libs launchers gendata copy
43188032Sorion
43288032Sorion  jrtfs-jar: buildtools-jdk
43372016Scg
43488032Sorion  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
43572016Scg      jrtfs-jar
43672016Scg
43772016Scg  profiles: exploded-image strip-binaries source-tips
43872016Scg
43972016Scg  mac-bundles-jdk: jimages
44072016Scg
44172016Scg  bootcycle-images: jimages
44272016Scg
44372016Scg  docs-javadoc: gensrc rmic
44472016Scg
44572016Scg  docs-jvmtidoc: hotspot
44672016Scg
44772016Scg  test: jimages test-image
44883214Sgreen
44972016Scg  verify-modules: exploded-image
45072016Scg
45173772Scg  test-make: clean-test-make
45272016Scg
45372016Scg  build-test-hotspot-jtreg-native: buildtools-jdk
45472016Scg
45572016Scg  build-test-jdk-jtreg-native: buildtools-jdk
45672016Scg
45772016Scg  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
45872016Scg
45972016Scg  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
46072016Scg
46174994Sorionendif
46284771Sorion
46372016Scg################################################################################
46472016Scg# Virtual targets without recipes
46584771Sorion
46684771Sorionbuildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
46772016Scg    buildtools-jdk
46872016Scg
46972016Scggensrc: $(GENSRC_TARGETS)
47082834Sorion
47172016Scggendata: $(GENDATA_TARGETS)
47272016Scg
47372016Scgcopy: $(COPY_TARGETS)
47472016Scg
47572016Scgjava: $(JAVA_TARGETS)
47674994Sorion
47774994Sorionrmic: $(RMIC_TARGETS)
47872016Scg
479170521Sarifflibs: $(LIBS_TARGETS)
480170521Sariff
481170521Sarifflaunchers: $(LAUNCHER_TARGETS)
48283214Sgreen
48372016Scg# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
48472016Scg# is actually handled by jdk.jdi-gensrc
48572016Scgjdk.jdwp.agent-gensrc: jdk.jdi-gensrc
48674994Sorion
48772016Scg# Declare dependencies from <module> to all the individual targets specific
488170521Sariff# to that module <module>-*.
48972016Scg$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
49074994Sorion$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
49172016Scg$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
49272016Scg$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
49373772Scg$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
49472016Scg$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
49572016Scg$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
49674994Sorion
49772016ScgALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
498170521Sariff    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
49972016Scg
50074994Soriondemos: demos-jdk
50172016Scg
50272016Scgsamples: samples-jdk
50372016Scg
50483214Sgreen# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
50572016Scgexploded-image: $(ALL_MODULE_TARGETS)
50672016Scg
50772016Scgmac-bundles: mac-bundles-jdk
50872016Scg
50972016Scg# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
51072016Scg# and in line with this, our targets for creating these are named *-image[s].
51174994Sorion
51274994Sorion# This target builds the product images, e.g. the JRE and JDK image
51372016Scg# (and possibly other, more specific versions)
51472016Scgproduct-images: jimages demos samples zip-security verify-modules
51583214Sgreen
51672016Scgifeq ($(OPENJDK_TARGET_OS), macosx)
51774994Sorion  product-images: mac-bundles
51872016Scgendif
51974994Sorion
52072016Scg# This target builds the documentation image
52183214Sgreendocs-image: docs-javadoc docs-jvmtidoc
52273772Scg
52372016Scg# This target builds the test image
52474994Soriontest-image: prepare-test-image test-image-hotspot-jtreg-native \
52572016Scg    test-image-jdk-jtreg-native
52672016Scg
52772016Scg# all-images is the top-most target, it builds all our deliverables ("images").
52872016Scgall-images: product-images test-image docs-image
52973772Scg
53073772ScgALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
53172016Scg    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
53274994Sorion    mac-bundles product-images docs-image test-image all-images
53372016Scg
534122461Sscottl################################################################################
53572016Scg
53683214Sgreen# Traditional targets typically run by users.
53774994Sorion# These can be considered aliases for the targets now named by a more
538122461Sscottl# "modern" naming scheme.
53972016Scgdefault: exploded-image
540122461Sscottljdk: exploded-image
541122461Sscottlimages: product-images
542122461Sscottldocs: docs-image
543122461Sscottlall: all-images
544122461Sscottl
54572016ScgALL_TARGETS += default jdk images docs all
546122461Sscottl
547122461Sscottl################################################################################
548122461Sscottl################################################################################
549122461Sscottl#
55072016Scg# Clean targets
551122461Sscottl#
552122461Sscottl################################################################################
553122461Sscottl# Clean targets are automatically run serially by the Makefile calling this
55472016Scg# file.
555122461Sscottl
556122461SscottlCLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
557122461Sscottl    images make-support test-make bundles
558122461SscottlCLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
55973772ScgCLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
560122461SscottlCLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
561122461SscottlCLEAN_PHASES := gensrc java native include docs
562122461SscottlCLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
56372016ScgCLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
564122461Sscottl# Construct targets of the form clean-$module-$phase
565122461SscottlCLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
566122461Sscottl    $(addprefix $m-, $(CLEAN_PHASES))))
567122461Sscottl
56872016Scg# Remove everything, except the output from configure.
569158980Snetchildclean: $(CLEAN_DIR_TARGETS)
570158980Snetchild	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
571158980Snetchild	$(ECHO) Cleaned all build artifacts.
57283214Sgreen
57372016Scg$(CLEAN_DIR_TARGETS):
57472016Scg	$(call CleanDir,$(patsubst clean-%, %, $@))
57572016Scg
57674763Scg$(CLEAN_TEST_TARGETS):
57772016Scg	$(call CleanTest,$(patsubst clean-test-%, %, $@))
57872016Scg
57972016Scg$(CLEAN_PHASE_TARGETS):
58072016Scg	$(call Clean-$(patsubst clean-%,%, $@))
58172016Scg
58272016Scg$(CLEAN_MODULE_TARGETS):
58372016Scg	$(call CleanModule,$(patsubst clean-%, %, $@))
58472016Scg
58572016Scg$(CLEAN_MODULE_PHASE_TARGETS):
58672016Scg	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
58772016Scg	    $(word 2, $(subst -,$(SPACE),$@)))
58872016Scg
58972016Scg# When removing the support dir, we must also remove jdk. Building classes has
59072016Scg# the side effect of generating native headers. The headers end up in support
59172016Scg# while classes and touch files end up in jdk.
59272016Scgclean-support: clean-jdk
59372016Scg
59472016Scg# Remove everything, including configure configuration. If the output
59572016Scg# directory was created by configure and now becomes empty, remove it as well.
59672016Scgdist-clean: clean
59773772Scg	($(CD) $(OUTPUT_ROOT) && \
59874994Sorion	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
59972016Scg	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
60074994Sorion	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
60174994Sorion	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
60272016Scg	  else \
60372016Scg	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
60473772Scg	        && $(RM) -r $(OUTPUT_ROOT)) \
60574994Sorion	  fi \
60672016Scg	)
60774994Sorion	$(ECHO) Cleaned everything, you will have to re-run configure.
60874994Sorion
60972016ScgALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
61072016Scg    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
61172016Scg
61272016Scg################################################################################
61372016Scg# Declare *-only targets for each normal target
61472016Scg$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
61572016Scg
61672016ScgALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
61772016Scg
61872016Scg################################################################################
61973772Scg
62072016Scg# Include JPRT targets
62172016Scginclude $(SRC_ROOT)/make/Jprt.gmk
62272016Scg
62372016Scg################################################################################
62472016Scg
62573772Scg# The following targets are intentionally not added to ALL_TARGETS since they
62672016Scg# are internal only, to support Init.gmk.
62772016Scg
62872016Scgprint-targets:
62972016Scg	  @$(ECHO) $(sort $(ALL_TARGETS))
63072016Scg
63172016Scgprint-modules:
63272016Scg	  @$(ECHO) $(sort $(ALL_MODULES))
63372016Scg
63473772Scgcreate-main-targets-include:
63573772Scg	  @$(ECHO) $(LOG_INFO) Generating main target list
63673772Scg	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
63773772Scg	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
63874994Sorion
63974994Sorion################################################################################
64072016Scg
64172016Scg.PHONY: $(ALL_TARGETS)
64272016Scg
64372016ScgFRC: # Force target
64472016Scg