Main.gmk revision 2024:cc16e2a24f94
160484Sobrien#
2218822Sdim# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3130561Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
460484Sobrien#
560484Sobrien# This code is free software; you can redistribute it and/or modify it
660484Sobrien# under the terms of the GNU General Public License version 2 only, as
760484Sobrien# published by the Free Software Foundation.  Oracle designates this
860484Sobrien# particular file as subject to the "Classpath" exception as provided
960484Sobrien# by Oracle in the LICENSE file that accompanied this code.
1060484Sobrien#
1160484Sobrien# This code is distributed in the hope that it will be useful, but WITHOUT
1260484Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1360484Sobrien# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1460484Sobrien# version 2 for more details (a copy is included in the LICENSE file that
1560484Sobrien# accompanied this code).
1660484Sobrien#
1760484Sobrien# You should have received a copy of the GNU General Public License version
1860484Sobrien# 2 along with this work; if not, write to the Free Software Foundation,
1960484Sobrien# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20218822Sdim#
2160484Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22218822Sdim# or visit www.oracle.com if you need additional information or have any
2360484Sobrien# questions.
2460484Sobrien#
25130561Sobrien
2660484Sobrien################################################################################
2760484Sobrien# This is the main makefile containing most actual top level targets. It needs
2860484Sobrien# to be called with a SPEC file defined.
2960484Sobrien################################################################################
3060484Sobrien
3160484Sobrien# Declare default target
3260484Sobriendefault:
33130561Sobrien
34218822Sdimifeq ($(wildcard $(SPEC)),)
3560484Sobrien  $(error Main.gmk needs SPEC set to a proper spec.gmk)
3660484Sobrienendif
37218822Sdim
3860484Sobrien# Now load the spec
3960484Sobrieninclude $(SPEC)
4060484Sobrien
4160484Sobrieninclude $(SRC_ROOT)/make/MainSupport.gmk
4260484Sobrien
4360484Sobrien# Load the vital tools for all the makefiles.
4460484Sobrieninclude $(SRC_ROOT)/make/common/MakeBase.gmk
4560484Sobrieninclude $(SRC_ROOT)/make/common/Modules.gmk
46130561Sobrien
47130561Sobrien# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
4860484Sobrien# valid top level targets. It's used to declare them all as PHONY and to
4960484Sobrien# generate the -only targets.
5060484SobrienALL_TARGETS :=
5160484Sobrien
52218822Sdim# Hook to include the corresponding custom file, if present.
5360484Sobrien$(eval $(call IncludeCustomExtension, , Main.gmk))
5460484Sobrien
5560484Sobrien# All modules for the current target platform.
56218822SdimALL_MODULES := $(call FindAllModules)
5760484Sobrien
5860484Sobrien################################################################################
5960484Sobrien################################################################################
60218822Sdim#
6160484Sobrien# Recipes for all targets. Only recipes, dependencies are declared later.
6260484Sobrien#
6360484Sobrien################################################################################
6460484Sobrien
6560484Sobrien################################################################################
66218822Sdim# Interim/build tools targets, compiling tools used during the build
6760484Sobrien
6860484Sobrienbuildtools-langtools:
69218822Sdim	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
7060484Sobrien
7160484Sobrieninterim-langtools:
7260484Sobrien	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7360484Sobrien
7460484Sobrieninterim-rmic:
7560484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
7660484Sobrien
7760484Sobrieninterim-cldrconverter:
7860484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
7960484Sobrien
8060484Sobrienbuildtools-jdk:
8160484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
8260484Sobrien
8360484SobrienALL_TARGETS += buildtools-langtools interim-langtools \
8489857Sobrien    interim-rmic interim-cldrconverter buildtools-jdk
8560484Sobrien
8689857Sobrien################################################################################
8760484Sobrien# Special targets for certain modules
8860484Sobrien
8960484Sobrienimport-hotspot:
9060484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
9160484Sobrien
9289857Sobrienunpack-sec:
9389857Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
9489857Sobrien
9560484Sobriengenerate-exported-symbols:
9660484Sobrien	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
9760484Sobrien
9860484SobrienALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
9960484Sobrien
10060484Sobrien################################################################################
10177298Sobrien# Gensrc targets, generating source before java compilation can be done
10260484Sobrien$(eval $(call DeclareRecipesForPhase, GENSRC, \
10360484Sobrien    TARGET_SUFFIX := gensrc, \
10460484Sobrien    FILE_PREFIX := Gensrc, \
10560484Sobrien    MAKE_SUBDIR := gensrc, \
10660484Sobrien    CHECK_MODULES := $(ALL_MODULES), \
10760484Sobrien    MULTIPLE_MAKEFILES := true))
10860484Sobrien
10960484SobrienJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
11060484SobrienLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
11160484SobrienCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
11260484SobrienHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
11360484Sobrien
11460484SobrienGENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
11560484SobrienGENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
11660484Sobrien    $(GENSRC_MODULEINFO_MODULES))
11760484Sobrien
11860484SobrienGENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
11960484SobrienGENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
12060484Sobrien    $(addsuffix -gensrc, $(GENSRC_MODULES)))
12160484Sobrien
12260484Sobriendefine DeclareModuleInfoRecipe
12360484Sobrien  $1-gensrc-moduleinfo:
12460484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
12560484Sobrien	    -f GensrcModuleInfo.gmk MODULE=$1)
126218822Sdim
12760484Sobrien  $1-gensrc: $1-gensrc-moduleinfo
12860484Sobrienendef
12960484Sobrien
130218822Sdim$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
131218822Sdim
13260484SobrienALL_TARGETS += $(GENSRC_TARGETS)
133218822Sdim
13460484Sobrien################################################################################
13560484Sobrien# Generate data targets
13660484Sobrien$(eval $(call DeclareRecipesForPhase, GENDATA, \
13789857Sobrien    TARGET_SUFFIX := gendata, \
13889857Sobrien    FILE_PREFIX := Gendata, \
13989857Sobrien    MAKE_SUBDIR := gendata, \
14089857Sobrien    CHECK_MODULES := $(ALL_MODULES), \
14160484Sobrien    USE_WRAPPER := true))
14277298Sobrien
14360484SobrienALL_TARGETS += $(GENDATA_TARGETS)
14460484Sobrien
14560484Sobrien################################################################################
14660484Sobrien# Copy files targets
14760484Sobrien$(eval $(call DeclareRecipesForPhase, COPY, \
14889857Sobrien    TARGET_SUFFIX := copy, \
14989857Sobrien    FILE_PREFIX := Copy, \
15060484Sobrien    MAKE_SUBDIR := copy, \
15160484Sobrien    CHECK_MODULES := $(ALL_MODULES), \
15260484Sobrien    USE_WRAPPER := true, \
15377298Sobrien    MULTIPLE_MAKEFILES := true))
15460484Sobrien
15560484SobrienALL_COPY_MODULES += $(COPY_MODULES)
15660484SobrienALL_COPY_TARGETS += $(COPY_TARGETS)
15777298Sobrien
15877298SobrienIMPORT_COPY_MODULES := $(call FindImportedModules)
15960484SobrienIMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
16060484SobrienALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
16189857SobrienALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
16260484Sobrien
16389857Sobriendefine DeclareImportCopyRecipe
16460484Sobrien  $1-copy:
16577298Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
166130561Sobrien	    -f CopyImportModules.gmk MODULE=$1)
167130561Sobrienendef
168130561Sobrien
16989857Sobrien$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
17077298Sobrien
17177298SobrienALL_TARGETS += $(ALL_COPY_TARGETS)
17260484Sobrien
173130561Sobrien################################################################################
17460484Sobrien# Targets for compiling all java modules. Nashorn is treated separately.
175130561SobrienJAVA_MODULES := $(ALL_MODULES)
176130561SobrienJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
17789857Sobrien
17877298Sobriendefine DeclareCompileJavaRecipe
17977298Sobrien  $1-java:
18077298Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
181130561Sobrien	    -f CompileJavaModules.gmk MODULE=$1)
182130561Sobrienendef
183130561Sobrien
18489857Sobrien$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
18560484Sobrien    $(eval $(call DeclareCompileJavaRecipe,$m)))
18660484Sobrien
18777298Sobrien# Build nashorn. Needs to be compiled separately from the rest of the modules
18860484Sobrien# due to nasgen.
18960484Sobrienjdk.scripting.nashorn-java:
19060484Sobrien	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
19160484Sobrien	    -f BuildNashorn.gmk compile)
19260484Sobrien
19377298SobrienALL_TARGETS += $(JAVA_TARGETS)
19477298Sobrien
19589857Sobrien################################################################################
19660484Sobrien# Targets for running rmic.
19789857Sobrien$(eval $(call DeclareRecipesForPhase, RMIC, \
19889857Sobrien    TARGET_SUFFIX := rmic, \
19989857Sobrien    FILE_PREFIX := Rmic, \
20089857Sobrien    MAKE_SUBDIR := rmic, \
20189857Sobrien    CHECK_MODULES := $(ALL_MODULES)))
20289857Sobrien
20389857SobrienALL_TARGETS += $(RMIC_TARGETS)
20460484Sobrien
20560484Sobrien################################################################################
20660484Sobrien# Targets for compiling native libraries
20760484Sobrien$(eval $(call DeclareRecipesForPhase, LIBS, \
20889857Sobrien    TARGET_SUFFIX := libs, \
20960484Sobrien    FILE_PREFIX := Lib, \
21060484Sobrien    MAKE_SUBDIR := lib, \
21160484Sobrien    CHECK_MODULES := $(ALL_MODULES), \
21260484Sobrien    USE_WRAPPER := true))
21360484Sobrien
21460484SobrienALL_TARGETS += $(LIBS_TARGETS)
21577298Sobrien
21660484Sobrien################################################################################
21789857Sobrien# Targets for compiling native executables
21889857Sobrien$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
21989857Sobrien    TARGET_SUFFIX := launchers, \
220130561Sobrien    FILE_PREFIX := Launcher, \
221130561Sobrien    MAKE_SUBDIR := launcher, \
22289857Sobrien    CHECK_MODULES := $(ALL_MODULES), \
223130561Sobrien    USE_WRAPPER := true))
22460484Sobrien
22577298SobrienALL_TARGETS += $(LAUNCHER_TARGETS)
22660484Sobrien
22760484Sobrien################################################################################
22860484Sobrien# Build hotspot target
22960484Sobrien
23060484Sobrienifeq ($(BUILD_HOTSPOT),true)
23189857Sobrien  hotspot:
23260484Sobrien        ifeq ($(USE_NEW_HOTSPOT_BUILD), true)
23360484Sobrien	  +($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk)
23460484Sobrien        else
23560484Sobrien	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
23660484Sobrien        endif
23789857Sobrienendif
23860484Sobrien
23989857Sobrienhotspot-ide-project:
24060484Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk)
241130561Sobrien
24260484SobrienALL_TARGETS += hotspot hotspot-ide-project
24360484Sobrien
24460484Sobrien################################################################################
24560484Sobrien# Build demos and samples targets
24660484Sobrien
24760484Sobriendemos-jdk:
24860484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
24977298Sobrien
25060484Sobriensamples-jdk:
25160484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
25260484Sobrien
25360484SobrienALL_TARGETS += demos-jdk samples-jdk
25460484Sobrien
25560484Sobrien################################################################################
25660484Sobrien# Jigsaw specific data and analysis targets.
25777298Sobrien
25860484Sobriengenerate-summary:
25960484Sobrien	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk)
26060484Sobrien
261130561SobrienALL_TARGETS += generate-summary
262130561Sobrien
26360484Sobrien################################################################################
264130561Sobrien# Strip binaries targets
26560484Sobrien
26660484SobrienSTRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
26760484Sobrien    $(GENDATA_MODULES))
26860484SobrienSTRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
269130561Sobrien
27060484Sobriendefine DeclareStripRecipe
27160484Sobrien  $1-strip:
272130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
27360484Sobrien	    MODULE=$1)
27460484Sobrienendef
275130561Sobrien
27660484Sobrien$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
27760484Sobrien
278130561SobrienALL_TARGETS += $(STRIP_TARGETS)
27960484Sobrien
28060484Sobrien################################################################################
281130561Sobrien# Jmod targets
28260484Sobrien
28360484SobrienJMOD_MODULES := $(ALL_MODULES)
284130561SobrienJMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
28560484Sobrien
28660484Sobriendefine DeclareJmodRecipe
287130561Sobrien  $1-jmod:
28860484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
28960484Sobrien	    MODULE=$1)
29060484Sobrienendef
29160484Sobrien
29260484Sobrien$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
29360484Sobrien
29460484SobrienALL_TARGETS += $(JMOD_TARGETS)
29560484Sobrien
29660484Sobrien################################################################################
29760484Sobrien# Images targets
29860484Sobrien
299130561Sobrien# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
300130561Sobrien# used to track the exact sources used to build that image.
301130561Sobriensource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
302130561Sobrien$(SUPPORT_OUTPUTDIR)/source_tips: FRC
303130561Sobrien	$(call MakeDir, $(@D))
30460484Sobrien	@$(RM) $@
30560484Sobrien	@$(call GetSourceTips)
30660484Sobrien
30760484SobrienBOOTCYCLE_TARGET := product-images
30860484Sobrienbootcycle-images:
30960484Sobrien	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
31089857Sobrien	+$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
31160484Sobrien	    JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
31260484Sobrien
31360484Sobrienzip-security:
31460484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
31560484Sobrien
31689857Sobrienzip-source:
31789857Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
31889857Sobrien
31989857Sobrienjrtfs-jar:
32089857Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
32189857Sobrien
32289857Sobrienjimages:
32389857Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
32460484Sobrien
32560484Sobrienprofiles:
32660484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
32760484Sobrien
32860484Sobrienmac-bundles-jdk:
32960484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
33060484Sobrien
33160484SobrienALL_TARGETS += source-tips bootcycle-images zip-security zip-source \
33260484Sobrien    jrtfs-jar jimages profiles mac-bundles-jdk
33360484Sobrien
33460484Sobrien################################################################################
33560484Sobrien# Docs targets
33660484Sobrien
33760484Sobriendocs-javadoc:
33860484Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
33960484Sobrien
34060484Sobriendocs-jvmtidoc:
34177298Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
34277298Sobrien
34360484SobrienALL_TARGETS += docs-javadoc docs-jvmtidoc
34460484Sobrien
34560484Sobrien################################################################################
34660484Sobrien# Cross compilation support
34760484Sobrien
34877298Sobrienifeq ($(CREATE_BUILDJDK), true)
34960484Sobrien  # This target is only called by the recursive call below.
35077298Sobrien  create-buildjdk-compile-hotspot-helper: hotspot
35160484Sobrien  create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy
35260484Sobrienendif
353130561Sobrien
354130561Sobriencreate-buildjdk-copy:
355130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
356130561Sobrien
357130561Sobriencreate-buildjdk-compile-hotspot create-buildjdk-compile-modules:
358130561Sobrien	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
359130561Sobrien	    $@-helper \
36060484Sobrien	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
36160484Sobrien	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
36260484Sobrien	    CREATING_BUILDJDK=true)
36360484Sobrien
364130561SobrienALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \
365130561Sobrien    create-buildjdk-compile-modules
366130561Sobrien
36760484Sobrien################################################################################
36860484Sobrien# Build tests
36960484Sobrien#
370130561Sobrien
371130561Sobrienprepare-test-image:
372130561Sobrien	$(MKDIR) -p $(TEST_IMAGE_DIR)
373130561Sobrien	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
374130561Sobrien
375130561Sobrienbuild-test-hotspot-jtreg-native:
376130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
377130561Sobrien	    build-test-hotspot-jtreg-native)
378130561Sobrien
37960484Sobrientest-image-hotspot-jtreg-native:
380130561Sobrien	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
381130561Sobrien	    test-image-hotspot-jtreg-native)
382130561Sobrien
383130561Sobrienbuild-test-jdk-jtreg-native:
384130561Sobrien	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
38560484Sobrien	    build-test-jdk-jtreg-native)
386130561Sobrien
387130561Sobrientest-image-jdk-jtreg-native:
388130561Sobrien	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
38960484Sobrien	    test-image-jdk-jtreg-native)
390130561Sobrien
391130561Sobrienbuild-test-lib:
392130561Sobrien	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
39360484Sobrien
39460484SobrienALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
39589857Sobrien    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
39689857Sobrien    test-image-jdk-jtreg-native build-test-lib
39789857Sobrien
39889857Sobrien################################################################################
39989857Sobrien# Run tests
40089857Sobrien
40189857Sobrien# Run tests specified by $(TEST), or the default test set.
40289857Sobrientest:
40389857Sobrien	$(call RunTests, $(TEST))
40460484Sobrien
40560484Sobrientest-hotspot-jtreg:
40677298Sobrien	$(call RunTests, "hotspot_all")
407130561Sobrien
408130561Sobrientest-hotspot-jtreg-native:
409	$(call RunTests, "hotspot_native_sanity")
410
411test-hotspot-internal:
412	$(call RunTests, "hotspot_internal")
413
414test-jdk-jtreg-native:
415	$(call RunTests, "jdk_native_sanity")
416
417test-make:
418	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
419
420ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
421    test-hotspot-internal test-jdk-jtreg-native test-make
422
423################################################################################
424# Install targets
425
426install:
427	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
428
429ALL_TARGETS += install
430
431################################################################################
432#
433# Dependency declarations between targets.
434#
435# These are declared in two groups. First all dependencies between targets that
436# have recipes above as these dependencies may be disabled. Then the aggregator
437# targets that do not have recipes of their own, which will never have their
438# dependencies disabled.
439#
440################################################################################
441# Targets with recipes above
442
443# If running an *-only target, parallel execution and dependencies between
444# recipe targets are disabled. This makes it possible to run a select set of
445# recipe targets in order. It's the responsibility of the user to make sure
446# all prerequisites are fulfilled.
447ifneq ($(findstring -only, $(MAKECMDGOALS)), )
448  .NOTPARALLEL:
449else
450  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
451
452  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
453
454  buildtools-jdk: interim-langtools interim-cldrconverter
455
456  $(CORBA_GENSRC_TARGETS): interim-langtools
457
458  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
459
460  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
461
462  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
463
464  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
465
466  interim-rmic: interim-langtools
467
468  $(RMIC_TARGETS): interim-langtools interim-rmic
469
470  $(JAVA_TARGETS): interim-langtools
471
472  hotspot-ide-project: hotspot exploded-image
473
474  import-hotspot: hotspot
475
476  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
477
478  $(LIBS_TARGETS): import-hotspot
479
480  $(LAUNCHER_TARGETS): java.base-libs
481
482  ifeq ($(STATIC_BUILD), true)
483    $(LAUNCHER_TARGETS): generate-exported-symbols
484  endif
485
486  # The demos are currently linking to libjvm and libjava, just like all other
487  # jdk libs, even though they don't need to. To avoid warnings, make sure they
488  # aren't built until after libjava and libjvm are available to link to.
489  demos-jdk: $(JAVA_TARGETS)
490
491  # Declare dependency from <module>-java to <module>-gensrc
492  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
493
494  # Declare dependencies between java modules
495  $(foreach m, $(JAVA_MODULES), \
496      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
497      $(call FindDepsForModule,$m)))))
498
499  # Declare dependencies between <module>-rmic to <module>-java
500  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
501
502  # Declare dependencies from <module>-lib to <module>-java
503  # Skip modules that do not have java source. When creating a BUILD_JDK, the
504  # java compilation has already been done by the normal build and copied in.
505  ifneq ($(CREATING_BUILDJDK), true)
506  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
507  endif
508
509  # Declare dependencies from all other <module>-lib to java.base-lib
510  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
511      $(eval $t: java.base-libs))
512
513  # jdk.accessibility depends on java.desktop
514  jdk.accessibility-libs: java.desktop-libs
515
516  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
517  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
518  # virtual target.
519  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
520
521  # The swing beans need to have java base properly generated to avoid errors
522  # in javadoc.
523  java.desktop-gensrc-jdk: java.base-gensrc
524
525  # The annotation processing for jdk.vm.ci needs java.base classes from the
526  # current JDK.
527  jdk.vm.ci-gensrc-hotspot: java.base-java
528
529  # Explicitly add dependencies for special targets
530  java.base-java: unpack-sec
531
532  # The copy target copies files generated by gensrc
533  java.base-copy-hotspot: java.base-gensrc-hotspot
534
535  jdk.jdeps-gendata: java rmic
536
537  # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
538  $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
539  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
540  $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
541  $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
542
543  # Declare dependencies between jmod targets
544  $(foreach m, $(JMOD_MODULES), \
545      $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m))))
546
547  # Declare dependencies from <module>-jmod to all other module targets
548  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
549  $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java))
550  $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata))
551  $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic))
552  $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs))
553  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers))
554  $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy))
555
556  # Jmods cannot be created until we have the jlink tool ready to run, which requires
557  # all java modules to be compiled and jdk.jlink-launchers.
558  $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers
559
560  ifeq ($(CREATE_BUILDJDK), true)
561    $(JMOD_TARGETS): create-buildjdk
562  endif
563
564  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
565      $(filter jdk.crypto%, $(JAVA_TARGETS))
566
567  zip-source: gensrc rmic
568
569  jrtfs-jar: interim-langtools
570
571  jimages: jmods zip-source source-tips demos samples jrtfs-jar
572
573  profiles: jmods zip-source source-tips jrtfs-jar
574
575  mac-bundles-jdk: jimages
576
577  bootcycle-images: jimages
578
579  docs-javadoc: $(GENSRC_TARGETS) rmic
580
581  docs-jvmtidoc: hotspot
582
583  test: jimages test-image
584
585  create-buildjdk-copy: jdk.jlink-java java.base-gendata
586
587  create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot
588
589  test-make: clean-test-make
590
591  build-test-lib: java
592
593  build-test-hotspot-jtreg-native: buildtools-jdk
594
595  build-test-jdk-jtreg-native: buildtools-jdk
596
597  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
598
599  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
600
601  test-hotspot-internal: exploded-image
602
603  test-hotspot-jtreg: jimages test-image
604
605  install: product-images
606
607  generate-summary: jmods
608
609endif
610
611################################################################################
612# Virtual targets without recipes
613
614buildtools: buildtools-langtools interim-langtools interim-rmic \
615    buildtools-jdk
616
617gensrc: $(GENSRC_TARGETS)
618
619gendata: $(GENDATA_TARGETS)
620
621copy: $(ALL_COPY_TARGETS)
622
623java: $(JAVA_TARGETS)
624
625rmic: $(RMIC_TARGETS)
626
627libs: $(LIBS_TARGETS)
628
629launchers: $(LAUNCHER_TARGETS)
630
631jmods: $(JMOD_TARGETS)
632
633strip-binaries: $(STRIP_TARGETS)
634
635# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
636# is actually handled by jdk.jdi-gensrc
637jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
638
639# Declare dependencies from <module> to all the individual targets specific
640# to that module <module>-*, that are needed for the exploded image.
641$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
642$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
643$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
644$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
645$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
646$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
647$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
648demos: demos-jdk
649
650samples: samples-jdk
651
652# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
653exploded-image: $(ALL_MODULES)
654
655create-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \
656    create-buildjdk-compile-hotspot
657
658mac-bundles: mac-bundles-jdk
659
660# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
661# and in line with this, our targets for creating these are named *-image[s].
662
663# This target builds the product images, e.g. the JRE and JDK image
664# (and possibly other, more specific versions)
665product-images: jimages demos samples zip-security exploded-image
666
667# When cross compiling and building a partial BUILDJDK for the build host,
668# the summary generation cannot be run.
669ifneq ($(CREATE_BUILDJDK), true)
670  product-images: generate-summary
671endif
672
673ifeq ($(OPENJDK_TARGET_OS), macosx)
674  product-images: mac-bundles
675endif
676
677# This target builds the documentation image
678docs-image: docs-javadoc docs-jvmtidoc
679
680# This target builds the test image
681test-image: prepare-test-image test-image-hotspot-jtreg-native \
682    test-image-jdk-jtreg-native
683
684# all-images is the top-most target, it builds all our deliverables ("images").
685all-images: product-images test-image docs-image
686
687ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \
688    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \
689    create-buildjdk mac-bundles product-images docs-image test-image all-images
690
691################################################################################
692
693# Traditional targets typically run by users.
694# These can be considered aliases for the targets now named by a more
695# "modern" naming scheme.
696default: $(DEFAULT_MAKE_TARGET)
697jdk: exploded-image
698images: product-images
699docs: docs-image
700all: all-images
701
702ALL_TARGETS += default jdk images docs all
703
704################################################################################
705################################################################################
706#
707# Clean targets
708#
709################################################################################
710# Clean targets are automatically run serially by the Makefile calling this
711# file.
712
713CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
714    images make-support test-make bundles buildjdk
715CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
716CLEAN_SUPPORT_DIRS += demos
717CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
718CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
719CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
720CLEAN_PHASES := gensrc java native include docs
721CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
722CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
723# Construct targets of the form clean-$module-$phase
724CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
725    $(addprefix $m-, $(CLEAN_PHASES))))
726
727# Remove everything, except the output from configure.
728clean: $(CLEAN_DIR_TARGETS)
729	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
730	$(ECHO) Cleaned all build artifacts.
731
732$(CLEAN_DIR_TARGETS):
733	$(call CleanDir,$(patsubst clean-%, %, $@))
734
735$(CLEAN_SUPPORT_DIR_TARGETS):
736	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
737
738$(CLEAN_TEST_TARGETS):
739	$(call CleanTest,$(patsubst clean-test-%, %, $@))
740
741$(CLEAN_PHASE_TARGETS):
742	$(call Clean-$(patsubst clean-%,%, $@))
743
744$(CLEAN_MODULE_TARGETS):
745	$(call CleanModule,$(patsubst clean-%, %, $@))
746
747$(CLEAN_MODULE_PHASE_TARGETS):
748	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
749	    $(word 2, $(subst -,$(SPACE),$@)))
750
751# When removing the support dir, we must also remove jdk. Building classes has
752# the side effect of generating native headers. The headers end up in support
753# while classes and touch files end up in jdk.
754clean-support: clean-jdk
755
756# Remove everything, including configure configuration. If the output
757# directory was created by configure and now becomes empty, remove it as well.
758dist-clean: clean
759	($(CD) $(OUTPUT_ROOT) && \
760	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
761	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
762	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
763	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
764	  else \
765	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
766	        && $(RM) -r $(OUTPUT_ROOT)) \
767	  fi \
768	)
769	$(ECHO) Cleaned everything, you will have to re-run configure.
770
771ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
772    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
773    $(CLEAN_MODULE_PHASE_TARGETS)
774
775################################################################################
776# Declare *-only targets for each normal target
777$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
778
779ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
780
781################################################################################
782
783# Include JPRT targets
784include $(SRC_ROOT)/make/Jprt.gmk
785
786################################################################################
787
788# The following targets are intentionally not added to ALL_TARGETS since they
789# are internal only, to support Init.gmk.
790
791print-targets:
792	  @$(ECHO) $(sort $(ALL_TARGETS))
793
794print-modules:
795	  @$(ECHO) $(sort $(ALL_MODULES))
796
797create-main-targets-include:
798	  $(call LogInfo, Generating main target list)
799	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
800	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
801
802################################################################################
803
804.PHONY: $(ALL_TARGETS)
805
806FRC: # Force target
807