# # Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. Oracle designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). # # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. #
################################################################################ # This is the main makefile containing most actual top level targets. It needs # to be called with a SPEC file defined. ################################################################################
# Declare default target
default:
ifeq ($(wildcard $(SPEC)),)
$(error Main.gmk needs SPEC set to a proper spec.gmk) endif
# Now load the spec include $(SPEC)
# Load the vital tools for all the makefiles. include $(TOPDIR)/make/common/MakeBase.gmk include $(TOPDIR)/make/common/Modules.gmk include $(TOPDIR)/make/common/FindTests.gmk
include $(TOPDIR)/make/MainSupport.gmk
# Are we requested to ignore dependencies? ifneq ($(findstring -only, $(MAKECMDGOALS)), )
DEPS := none endif
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all # valid top level targets. It's used to declare them all as PHONY and to # generate the -only targets.
ALL_TARGETS :=
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, Main.gmk))
# All modules for the current target platform.
ALL_MODULES := $(call FindAllModules)
################################################################################ ################################################################################ # # Recipes for all targets. Only recipes, dependencies are declared later. # ################################################################################
################################################################################ # Interim/build tools targets, compiling tools used during the build
################################################################################ # Targets for compiling static versions of certain native libraries. These do # not end up in the jmods or the normal JDK image, but are instead bundled into # a special deliverable.
$(eval $(call DeclareRecipesForPhase, STATIC_LIBS, \
TARGET_SUFFIX := static-libs, \
FILE_PREFIX := Lib, \
CHECK_MODULES := $(ALL_MODULES), \
EXTRA_ARGS := STATIC_LIBS=true, \
))
# The demos are currently linking to libjvm and libjava, just like all other # jdk libs, even though they don't need to. To avoid warnings, make sure they # aren't built until after libjava and libjvm are available to link to.
$(eval $(call SetupTarget, demos-jdk, \
MAKEFILE := CompileDemos, \
DEPS := java.base-libs exploded-image buildtools-jdk, \
))
# If building full docs, to complete docs-*-api we need both the javadoc and # graphs targets.
$(eval $(call SetupTarget, docs-jdk-api-javadoc, \
MAKEFILE := Docs, \
TARGET := docs-jdk-api-javadoc, \
))
################################################################################ # Cross compilation support
ifeq ($(CREATING_BUILDJDK), true) # This target is only called by the recursive call below.
create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
java.base-copy jdk.jdeps-launchers endif
################################################################################ # The interim-image is a small jlinked image that is used to generate artifacts # at build time for use when linking the real images.
# ALL_NAMED_TESTS is defined in FindTests.gmk
$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
ALL_TEST_TARGETS := $(addprefix test-, $(ALL_NAMED_TESTS))
# We only support the "exploded-test-gtest" shortcut
ALL_EXPLODED_TESTS := gtest
ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-test-, $(ALL_EXPLODED_TESTS))
################################################################################ # # Dependency declarations between targets. # # These are declared in two groups. First all dependencies between targets that # have recipes above as these dependencies may be disabled. Then the aggregator # targets that do not have recipes of their own, which will never have their # dependencies disabled. # ################################################################################ # Targets with recipes above
# If running an *-only target, parallel execution and dependencies between # recipe targets are disabled. This makes it possible to run a select set of # recipe targets in order. It's the responsibility of the user to make sure # all prerequisites are fulfilled. ifeq ($(DEPS), none)
.NOTPARALLEL: else
$(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
# If not already set, set the JVM variant target so that the JVM will be built.
JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
JVM_MAIN_GENSRC_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
# Building one JVM variant is enough to start building the other libs
$(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS)
# Static libs depend on hotspot gensrc
$(STATIC_LIBS_TARGETS): $(JVM_MAIN_GENSRC_TARGETS)
# Declare dependency from <module>-java to <module>-gensrc
$(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
# Declare dependencies between java modules
$(foreach m, $(JAVA_MODULES), \
$(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
$(call FindDepsForModule,$m))))) # Declare dependencies between the module meta targets
$(foreach m, $(ALL_MODULES), $(eval $m: $(call FindDepsForModule,$m)))
# Declare dependencies from <module>-lib to <module>-java # Skip modules that do not have java source.
$(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
# Declare dependencies from all other <module>-lib to java.base-lib
$(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
$(eval $t: java.base-libs))
# jdk.accessibility depends on java.desktop
jdk.accessibility-libs: java.desktop-libs
# This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a # virtual target.
jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
# jdk.jfr-gendata uses TOOL_JFR_GEN from buildtools-hotspot
jdk.jfr-gendata: buildtools-hotspot
# The swing beans need to have java base properly generated to avoid errors # in javadoc. The X11 wrappers need the java.base include files to have been # copied and processed.
java.desktop-gensrc-src: java.base-gensrc java.base-copy
jdk.jdeps-gendata: java
# The ct.sym generation uses all the moduleinfos as input
jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS)
# Declare dependencies between jmod targets. # java.base jmod needs jrt-fs.jar and access to the other jmods to be built. # When creating the BUILDJDK, we don't need to add hashes to java.base, thus # we don't need to depend on all other jmods ifneq ($(CREATING_BUILDJDK), true)
java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS)) endif
# If not already set, set the JVM target so that the JVM will be built.
JVM_MAIN_TARGETS ?= hotspot
# Building java.base-jmod requires all of VM (ie hotspot) to be built.
java.base-jmod: $(JVM_MAIN_TARGETS)
# Declare dependencies from <module>-jmod to all other module targets
$(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
$(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
$(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
# Setup the minimal set of generated native source dependencies for hotspot
$(foreach v, $(JVM_VARIANTS), \
$(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
$(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
$(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
)
# For the full JDK compile commands, create all possible generated sources
$(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
$(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
# The -static-libs targets depend on -java as well as java.base-copy.
$(foreach m, $(filter $(JAVA_MODULES), $(STATIC_LIBS_MODULES)), \
$(eval $m-static-libs: $m-java java.base-copy))
# Jmods cannot be created until we have the jmod tool ready to run. During # a normal build we run it from the exploded image, but when cross compiling # it's run from the buildjdk, which is either created at build time or user # supplied. ifeq ($(CREATE_BUILDJDK), true) ifneq ($(CREATING_BUILDJDK), true) # When cross compiling and buildjdk is to be created, simply depend on # creating the buildjdk.
$(JMOD_TARGETS): create-buildjdk
buildtools-modules: create-buildjdk else # While actually creating the buildjdk, we need to list the bare # minimum dependencies needed before running jmod, to avoid building # more than necessary. This includes: # * all java modules # * jdk.jlink-launchers # * copy jvm.cfg (done in java.base-copy) # * tzdb.dat (done in java.base-gendata) # Without all of these jimage, jlink and jmod won't start.
$(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): java.base-libs java.base-copy \
java.base-gendata jdk.jlink-launchers java endif elseifeq ($(EXTERNAL_BUILDJDK), false) # The normal non cross compilation usecase needs to wait for the full # exploded-image to avoid a race with the optimize target.
$(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): exploded-image # The buildtools-modules are used for the exploded-image-optimize target, # but can be built either using the exploded-image or an external BUILDJDK.
buildtools-modules: exploded-image-base endif
# All modules include the main license files from java.base.
$(JMOD_TARGETS): java.base-copy
ifeq ($(ENABLE_GENERATE_CLASSLIST), true) ifeq ($(CREATE_BUILDJDK), true) # If creating a buildjdk, the interim image needs to be based on that.
generate-link-opt-data: create-buildjdk elseifeq ($(EXTERNAL_BUILDJDK), false) # If an external buildjdk has been provided, we skip generating an # interim-image and just use the external buildjdk for generating # classlist.
generate-link-opt-data: interim-image endif
generate-link-opt-data: buildtools-jdk
# The generated classlist needs to go into java.base-jmod.
java.base-jmod jdk.jlink-jmod jdk-image legacy-jre-image: generate-link-opt-data endif
################################################################################ # Virtual targets without recipes
# If not already set, set the JVM specific tools targets
JVM_TOOLS_TARGETS ?= buildtools-hotspot
buildtools: buildtools-langtools interim-langtools \
buildtools-jdk $(JVM_TOOLS_TARGETS)
# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which # is actually handled by jdk.jdi-gensrc
jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
# Declare dependencies from <module> to all the individual targets specific # to that module <module>-*, that are needed for the exploded image.
$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
# Building java.base includes building all of hotspot.
java.base: $(JVM_MAIN_TARGETS)
demos: demos-jdk
# The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
exploded-image-base: $(ALL_MODULES)
exploded-image: exploded-image-base release-file # When cross compiling, no need to optimize the exploded image since it won't # be runnable on the host platform anyway. ifneq ($(COMPILE_TYPE), cross)
exploded-image: exploded-image-optimize endif
# The runnable-buildjdk target guarantees that the buildjdk is done # building and ready to be used. The exact set of dependencies it needs # depends on what kind of buildjdk is used for the current configuration.
runnable-buildjdk: ifeq ($(CREATE_BUILDJDK), true) ifneq ($(CREATING_BUILDJDK), true)
runnable-buildjdk: create-buildjdk endif elseifeq ($(EXTERNAL_BUILDJDK), false)
runnable-buildjdk: exploded-image endif
# If we're building full docs, we must also generate the module graphs to # get non-broken api documentation. ifeq ($(ENABLE_FULL_DOCS), true)
docs-jdk-api: docs-jdk-api-graphs
docs-javase-api: docs-javase-api-graphs
docs-reference-api: docs-reference-api-graphs
# We must generate javadoc first so we know what graphs are needed
docs-jdk-api-graphs: docs-jdk-api-javadoc
docs-javase-api-graphs: docs-javase-api-javadoc
docs-reference-api-graphs: docs-reference-api-javadoc endif
# alias for backwards compatibility
docs-javadoc: docs-jdk-api
mac-bundles: mac-jdk-bundle
# The $(OUTPUTDIR)/images directory contain the resulting deliverables, # and in line with this, our targets for creating these are named *-image[s].
# This target builds the product images, e.g. the JDK image # (and possibly other, more specific versions)
product-images: jdk-image symbols-image exploded-image
# This target builds the legacy images, e.g. the legacy JRE image
legacy-images: legacy-jre-image
# zip-security is actually a bundle, but for now it needs to be considered # an image until this can be cleaned up properly.
product-images: zip-security
# The module summary cannot be run when: # * Cross compiling and building a partial BUILDJDK for the build host # * An external buildjdk has been supplied since it may not match the # module selection of the target jdk ifneq ($(CREATE_BUILDJDK), true) ifeq ($(EXTERNAL_BUILDJDK), false)
product-images: generate-summary endif endif
# These targets build the various documentation images
docs-jdk-image: docs-jdk
docs-javase-image: docs-javase
docs-reference-image: docs-reference # The docs-jdk-image is what most users expect to be built
docs-image: docs-jdk-image
all-docs-images: docs-jdk-image docs-javase-image docs-reference-image
# This target builds the test image
test-image: prepare-test-image test-image-jdk-jtreg-native \
test-image-demos-jdk test-image-libtest-jtreg-native \
test-image-lib-native
ifneq ($(JVM_TEST_IMAGE_TARGETS), ) # If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the # standard hotspot set of tests.
test-image: $(JVM_TEST_IMAGE_TARGETS) else
test-image: test-image-hotspot-jtreg-native ifneq ($(GTEST_FRAMEWORK_SRC), )
test-image: test-image-hotspot-gtest endif endif
# Traditional targets typically run by users. # These can be considered aliases for the targets now named by a more # "modern" naming scheme.
default: $(DEFAULT_MAKE_TARGET)
jdk: exploded-image
images: product-images
docs: docs-image
bundles: all-bundles all: all-images
ALL_TARGETS += default jdk images docs bundles all
# Aliases used for running tests.
# Let "run-test" be an alias for "test"
$(foreach t, $(ALL_NAMED_TESTS), $(eval run-test-$t: test-$t))
RUN_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
run-test: test
exploded-run-test: exploded-test
# "make check" is a common idiom for running basic testing
check: test-tier1
# Keep some old names as aliases
test-hotspot-jtreg: test-hotspot_all
test-hotspot-jtreg-native: test-hotspot_native_sanity
test-hotspot-gtest: exploded-test-gtest
test-jdk-jtreg-native: test-jdk_native_sanity
################################################################################ ################################################################################ # # Clean targets # ################################################################################ # Clean targets are automatically run serially by the Makefile calling this # file.
# When removing the support dir, we must also remove jdk. Building classes has # the side effect of generating native headers. The headers end up in support # while classes and touch files end up in jdk.
clean-support: clean-jdk
clean-test: clean-test-results clean-test-support
# When cleaning images, also clean the support/images directory.
clean-images: clean-support/images
# Remove everything, including configure configuration. If the output # directory was created by configure and now becomes empty, remove it as well.
dist-clean: clean
($(CD) $(OUTPUTDIR) && \
$(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide \
configure.log* build.log*)
$(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \ if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ else \
($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
&& $(RM) -r $(OUTPUTDIR)) \ fi \
)
$(ECHO) Cleaned everything, you will have to re-run configure.
################################################################################ # Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
################################################################################ # Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, Main-post.gmk))
.PHONY: $(ALL_TARGETS)
FRC: # Force target
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.