8219971: Introduce SetupExecute in build system

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2019-03-05 11:07:19 +01:00
parent b0d139de19
commit d9153b8e3c
15 changed files with 403 additions and 169 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2019, 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
@ -26,6 +26,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include Modules.gmk
ifeq ($(MODULE), )
@ -37,7 +38,8 @@ $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
################################################################################
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
JMOD_FILE := $(MODULE).jmod
LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
$(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
@ -152,26 +154,27 @@ endif
# to avoid false incremental rebuilds.
ifeq ($(INTERIM_JMOD), true)
DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
INTERIM_MSG := interim$(SPACE)
endif
JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
# Create jmods in a temp dir and then move them into place to keep the
# Create jmods in the support dir and then move them into place to keep the
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
$(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
$(JMOD) create \
--module-version $(VERSION_SHORT) \
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
DEPS := $(DEPS), \
OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
--target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
--module-path $(JMODS_DIR) \
$(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) \
)
$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
))
TARGETS += $(JMODS_DIR)/$(MODULE).jmod
TARGETS += $(create_$(JMOD_FILE))
################################################################################

View File

@ -1,4 +1,4 @@
# Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2019, 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
@ -26,6 +26,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include Modules.gmk
include ModuleTools.gmk
include ProcessMarkdown.gmk
@ -195,10 +196,13 @@ define setup_gengraph_dot_to_png
# For each module needing a graph, create a png file from the dot file
# generated by the GenGraphs tool and store it in the target dir.
$$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER)
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \
$$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC))
$$(eval $$(call SetupExecute, gengraphs_png_$1_$2, \
INFO := Running dot for module graphs for $2, \
DEPS := $$(gengraphs_$1_TARGET), \
OUTPUT_FILE := $$($1_$2_PNG_TARGET), \
SUPPORT_DIR := $$($1_GENGRAPHS_DIR), \
COMMAND := $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC), \
))
$1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
endef
@ -336,18 +340,18 @@ define SetupApiDocsGenerationBody
$1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
$$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
# Javadoc creates a lot of files but use index.html as a marker
$$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
$$($1_SOURCE_DEPS) $$($1_OVERVIEW)
$$(call LogWarn, Generating $1 javadoc for \
$$(words $$($1_ALL_MODULES)) modules)
$$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
$$(call MakeDir, $$($1_TARGET_DIR))
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \
$$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) \
$$($1_OPTIONS) $$($1_LOG_OPTION))
$$(eval $$(call SetupExecute, javadoc_$1, \
WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \
INFO := Javadoc modules: $$($1_ALL_MODULES), \
DEPS := $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_SOURCE_DEPS) \
$$($1_OVERVIEW), \
OUTPUT_DIR := $$($1_TARGET_DIR), \
SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/docs, \
COMMAND := $$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) $$($1_OPTIONS) \
$$($1_LOG_OPTION), \
))
$1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html
$1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET)
ifeq ($$(ENABLE_FULL_DOCS), true)
# We have asked ModuleGraph to generate links to png files. Now we must
@ -367,19 +371,18 @@ define SetupApiDocsGenerationBody
$$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties
$1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs
$1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
$$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
$$(call LogInfo, Running gengraphs for $1 documentation)
$$(call MakeDir, $$($1_GENGRAPHS_DIR))
$$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
$$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
--dot-attributes $$(GENGRAPHS_PROPS) && \
$$(TOUCH) $$($1_GENGRAPHS_MARKER))
$$(eval $$(call SetupExecute, gengraphs_$1, \
INFO := Running gengraphs for $1 documentation, \
DEPS := $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS), \
OUTPUT_DIR := $$($1_GENGRAPHS_DIR), \
COMMAND := $$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
--dot-attributes $$(GENGRAPHS_PROPS), \
))
# For each module needing a graph, create a png file from the dot file
# generated by the GenGraphs tool and store it in the target dir.
# They will depend on $1_GENGRAPHS_MARKER, and will be added to $1.
# They will depend on gengraphs_$1_TARGET, and will be added to $1.
$$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
$$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \
)

View File

@ -29,19 +29,21 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include $(TOPDIR)/make/ModuleTools.gmk
################################################################################
PACKAGES_ATTRIBUTE_TARGET := $(JDK_OUTPUTDIR)/_packages_attribute.done
ALL_MODULEINFO_CLASSES := $(wildcard $(JDK_OUTPUTDIR)/modules/*/module-info.class)
$(PACKAGES_ATTRIBUTE_TARGET): $(ALL_MODULEINFO_CLASSES) $(BUILD_JIGSAW_CLASSES)
$(call LogInfo, Optimizing the exploded image)
$(call ExecuteWithLog, $@, $(TOOL_ADD_PACKAGES_ATTRIBUTE) $(JDK_OUTPUTDIR))
$(TOUCH) $@
$(eval $(call SetupExecute, optimize_image, \
INFO := Optimizing the exploded image, \
DEPS := $(ALL_MODULEINFO_CLASSES) $(BUILD_JIGSAW_CLASSES), \
OUTPUT_DIR := $(JDK_OUTPUTDIR), \
COMMAND := $(TOOL_ADD_PACKAGES_ATTRIBUTE) $(JDK_OUTPUTDIR), \
))
TARGETS := $(PACKAGES_ATTRIBUTE_TARGET)
TARGETS := $(optimize_image_TARGET)
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2019, 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
@ -27,9 +27,9 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include Modules.gmk
TOOL_TARGETS :=
JDK_TARGETS :=
JRE_TARGETS :=
@ -56,9 +56,6 @@ BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod)
# Use this file inside the image as target for make rule
JIMAGE_TARGET_FILE := release
JLINK_ORDER_RESOURCES := **module-info.class
JLINK_JLI_CLASSES :=
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
@ -88,40 +85,57 @@ ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true)
JLINK_JDK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods
endif
$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
$(call LogWarn, Creating jdk image)
$(RM) -r $(JDK_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
$(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
$(JLINK_JDK_EXTRA_OPTS) \
--output $(JDK_IMAGE_DIR) \
)
ifeq ($(BUILD_CDS_ARCHIVE), true)
$(call LogWarn, Creating CDS archive for jdk image)
$(FIXPATH) $(JDK_IMAGE_DIR)/bin/java \
-Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
endif
$(TOUCH) $@
$(eval $(call SetupExecute, jlink_jdk, \
WARN := Creating jdk image, \
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JDK_MODULES_LIST), \
OUTPUT_DIR := $(JDK_IMAGE_DIR), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
PRE_COMMAND := $(RM) -r $(JDK_IMAGE_DIR), \
COMMAND := $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
$(JLINK_JDK_EXTRA_OPTS) --output $(JDK_IMAGE_DIR), \
))
$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
$(call LogWarn, Creating legacy jre image)
$(RM) -r $(JRE_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
$(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
$(JLINK_JRE_EXTRA_OPTS) \
--output $(JRE_IMAGE_DIR) \
)
ifeq ($(BUILD_CDS_ARCHIVE), true)
$(call LogWarn, Creating CDS archive for jre image)
$(FIXPATH) $(JRE_IMAGE_DIR)/bin/java \
-Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
endif
$(TOUCH) $@
JLINK_JDK_TARGETS := $(jlink_jdk)
TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
$(eval $(call SetupExecute, jlink_jre, \
WARN := Creating legacy jre image, \
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JDK_MODULES_LIST), \
OUTPUT_DIR := $(JDK_IMAGE_DIR), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
$(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
))
JLINK_JRE_TARGETS := $(jlink_jre)
ifeq ($(BUILD_CDS_ARCHIVE), true)
CDS_ARCHIVE := lib/server/classes.jsa
$(eval $(call SetupExecute, gen_cds_archive_jdk, \
WARN := Creating CDS archive for jdk image, \
DEPS := $(jlink_jdk), \
OUTPUT_FILE := $(JDK_IMAGE_DIR)/$(CDS_ARCHIVE), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
COMMAND := $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
-Xmx128M -Xms128M $(LOG_INFO), \
))
JDK_TARGETS += $(gen_cds_archive_jdk)
$(eval $(call SetupExecute, gen_cds_archive_jre, \
WARN := Creating CDS archive for jre image, \
DEPS := $(jlink_jre), \
OUTPUT_FILE := $(JRE_IMAGE_DIR)/$(CDS_ARCHIVE), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
COMMAND := $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
-Xmx128M -Xms128M $(LOG_INFO), \
))
JDK_TARGETS += $(gen_cds_archive_jdk)
endif
################################################################################
# src.zip
@ -244,11 +258,11 @@ $(eval $(call IncludeCustomExtension, Images-post.gmk))
################################################################################
$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
$(JRE_TARGETS): $(JLINK_JRE_TARGETS)
$(JDK_TARGETS): $(JLINK_JDK_TARGETS)
jdk: $(TOOL_JDK_TARGETS) $(JDK_TARGETS)
jre: $(TOOL_JRE_TARGETS) $(JRE_TARGETS)
jdk: $(JLINK_JDK_TARGETS) $(JDK_TARGETS)
jre: $(JLINK_JRE_TARGETS) $(JRE_TARGETS)
symbols: $(SYMBOLS_TARGETS)
all: jdk jre symbols

View File

@ -456,7 +456,7 @@ define DeclareInterimJmodRecipe
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
MODULE=$1 \
JMODS_DIR=$(INTERIM_JMODS_DIR) \
JMODS_TEMPDIR=$(INTERIM_JMODS_DIR)/temp \
JMODS_SUPPORT_DIR=$(INTERIM_JMODS_DIR)/support \
INTERIM_JMOD=true \
)
endef
@ -1120,7 +1120,8 @@ ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \
# file.
CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
images make-support test-make bundles buildjdk test-results test-support
images make-support test-make bundles buildjdk test-results test-support \
support/images
CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
CLEAN_SUPPORT_DIRS += demos
CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
@ -1170,6 +1171,9 @@ 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2019, 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
@ -29,6 +29,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include NativeCompilation.gmk
include ToolsJdk.gmk
@ -47,17 +48,21 @@ ifeq ($(COMPILE_TYPE), cross)
endif
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
GENERATOR_SOURCE_FILE := $(X11WRAPPERS_OUTPUT)/src/data_generator.c
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
WRAPPER_OUTPUT_FILE := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
BITS := $(OPENJDK_TARGET_CPU_BITS)
# Generate the C code for the program that will output the offset file.
$(X11WRAPPERS_OUTPUT)/src/data_generator.c: $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating X11 wrapper data generator source code)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, \
$(TOOL_WRAPPERGENERATOR) gen_c_source $@ $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS))
$(eval $(call SetupExecute, gensrc_generator, \
INFO := Generating X11 wrapper data generator source code, \
DEPS := $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK), \
OUTPUT_FILE := $(GENERATOR_SOURCE_FILE), \
COMMAND := $(TOOL_WRAPPERGENERATOR) gen_c_source $(GENERATOR_SOURCE_FILE) \
$(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS), \
))
DATA_GENERATOR_INCLUDES := \
-I$(TOPDIR)/src/hotspot/share/include \
@ -75,7 +80,7 @@ DATA_GENERATOR_INCLUDES := \
$(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
PROGRAM := data_generator, \
OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
EXTRA_FILES := $(X11WRAPPERS_OUTPUT)/src/data_generator.c, \
EXTRA_FILES := $(GENERATOR_SOURCE_FILE), \
CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES) $(CFLAGS_JDKEXE), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
LIBS := $(X_LIBS), \
@ -83,16 +88,19 @@ $(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
))
# Run the executable to create the data file.
$(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt: $(BUILD_DATA_GENERATOR_TARGET)
$(call LogInfo, Generating X11 wrapper data files)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $(X11WRAPPERS_OUTPUT)/generation, \
$(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $@)
$(eval $(call SetupExecute, run_wrappergen, \
INFO := Generating X11 wrapper data files, \
DEPS := $(BUILD_DATA_GENERATOR), \
OUTPUT_FILE := $(WRAPPER_OUTPUT_FILE), \
COMMAND := $(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $(WRAPPER_OUTPUT_FILE), \
))
wrapper-information: $(run_wrappergen)
$(ECHO) IMPORTANT: If you update the X11 wrapper data files, they most certainly
$(ECHO) need to be updated for both 32 and 64 bit platforms. You have now
$(ECHO) updated them for $(BITS) bit platforms only.
TARGETS += $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
TARGETS += $(run_wrappergen) wrapper-information
################################################################################

198
make/common/Execute.gmk Normal file
View File

@ -0,0 +1,198 @@
#
# Copyright (c) 2019, 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.
#
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including Execute.gmk)
endif
################################################################################
#
# Code for handling the SetupExecute macro.
#
################################################################################
################################################################################
# Setup make rules for executing an arbitrary command.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name.
#
# You need to specify a COMMAND, the actual command line to execute. You are
# strongly recommended to provide a INFO with the text to display for LOG=info
# on what operation is performed. You can use DEPS to provide additional
# dependencies for your command to run. You can optionally include a PRE_COMMAND
# and a POST_COMMAND, intended for simple pre- and post-processing. The latter
# might be e.g. a mv from a temporary file to the final destination, the former
# e.g. a simple sed replacement on the input file. If the operations are
# unrelated to the main COMMAND, this is not a suitable solution.
#
# If your command outputs a variety of files, or if it's really a single file
# but you don't really care about the output from the perspective, you can just
# supply an OUTPUT_DIR. You are supposed to make sure the command creates files
# in this directory (which will be created for you if it does not exist), but
# this can't be enforced by SetupExecute. Additional support files (like logs
# and markers) are created in this directory. If you want support files in a
# separate directory (e.g. if you're targeting an OUTPUT_DIR in the image
# directly), you can specify a SUPPORT_DIR. If your command outputs only a
# single file, you can get rid of the marker files (but not the log files) by
# specifying OUTPUT_FILE. Note that if you specify an OUTPUT_FILE, support log
# files will be placed in the same directory as the OUTPUT_FILE. If you do not
# want that, use SUPPORT_DIR as well.
#
# After the call to SetupExecute, $1 will contain references to all generated
# files (that make knows about), and $1_TARGET will contain a reference to the
# final target (that is OUTPUT_FILE if it exists, or the $1_exec.marker file
# otherwise).
#
# All the above keep functioning as expected even if PRE_COMMAND and
# POST_COMMAND are given. One special case worth noting is that if OUTPUT_FILE
# and POST_COMMAND is both given, the actual OUTPUT_FILE is considered to be a
# result of running the POST_COMMAND.
#
# Remaining parameters are named arguments. These include:
# COMMAND : The command to execute
# PRE_COMMAND : A helper command to execute before COMMAND
# POST_COMMAND: A helper command to execute after COMMAND
# OUTPUT_DIR : The directory that will contain the result from the command
# OUTPUT_FILE : Use this if the command results in a single output file
# SUPPORT_DIR : Where to store generated support files
# INFO : Message to display at LOG=info level when running command (optional)
# WARN : Message to display at LOG=warn level when running command (optional)
# DEPS : Dependencies for the execution to take place
#
# Setup make rules for copying files, with an option to do more complex
SetupExecute = $(NamedParamsMacroTemplate)
define SetupExecuteBody
ifeq ($$($1_COMMAND), )
$$(error COMMAND is missing in SetupExecute $1)
endif
ifneq ($$($1_OUTPUT_FILE), )
ifneq ($$($1_OUTPUT_DIR), )
$$(error Cannot specify both OUTPUT_DIR and OUTPUT_FILE in SetupExecute $1)
endif
# We need to know output dir since we will make sure it is created.
$1_OUTPUT_DIR := $$(patsubst %/,%, $$(dir $$($1_OUTPUT_FILE)))
ifeq ($$($1_SUPPORT_DIR), )
# If support dir is not given, use base dir of output file.
$1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
endif
else ifneq ($$($1_OUTPUT_DIR), )
ifeq ($$($1_SUPPORT_DIR), )
# If support dir is not given, use output dir.
$1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
endif
else
$$(error OUTPUT_DIR or OUTPUT_FILE is required in SetupExecute $1)
endif
$1_BASE := $$($1_SUPPORT_DIR)/_$1
$1_PRE_MARKER := $$($1_BASE)_pre.marker
$1_EXEC_MARKER := $$($1_BASE)_exec.marker
$1_POST_MARKER := $$($1_BASE)_post.marker
ifeq ($$($1_OUTPUT_FILE), )
# No specified output file, use markers everywhere
$1_EXEC_RESULT := $$($1_EXEC_MARKER)
ifeq ($$($1_POST_COMMAND), )
$1_FINAL_RESULT := $$($1_EXEC_MARKER)
else
$1_FINAL_RESULT := $$($1_POST_MARKER)
endif
else
# If we have a single output file, we don't need a separate marker
ifeq ($$($1_POST_COMMAND), )
$1_EXEC_RESULT := $$($1_OUTPUT_FILE)
$1_FINAL_RESULT := $$($1_EXEC_RESULT)
else
$1_EXEC_RESULT := $$($1_EXEC_MARKER)
$1_FINAL_RESULT := $$($1_OUTPUT_FILE)
endif
endif
ifeq ($$($1_INFO)$$($1_WARN), )
# If neither info nor warn is provided, add basic info text.
$1_INFO := Running commands for $1
endif
ifneq ($$($1_PRE_COMMAND), )
$$($1_PRE_MARKER): $$($1_DEPS)
ifneq ($$($1_WARN), )
$$(call LogWarn, $$($1_WARN))
endif
ifneq ($$($1_INFO), )
$$(call LogInfo, $$($1_INFO))
endif
$$(call MakeDir, $$($1_SUPPORT_DIR) $$($1_OUTPUT_DIR))
$$(call ExecuteWithLog, $$($1_BASE)_pre, \
$$($1_PRE_COMMAND))
$$(TOUCH) $$@
$$($1_EXEC_RESULT): $$($1_PRE_MARKER)
$$(call ExecuteWithLog, $$($1_BASE)_exec, \
$$($1_COMMAND))
ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
$$(TOUCH) $$@
endif
$1 := $$($1_PRE_MARKER) $$($1_EXEC_RESULT)
else
$$($1_EXEC_RESULT): $$($1_DEPS)
ifneq ($$($1_WARN), )
$$(call LogWarn, $$($1_WARN))
endif
ifneq ($$($1_INFO), )
$$(call LogInfo, $$($1_INFO))
endif
$$(call MakeDir, $$(call EncodeSpace, $$($1_SUPPORT_DIR)) $$(call EncodeSpace, $$($1_OUTPUT_DIR)))
$$(call ExecuteWithLog, $$($1_BASE)_exec, \
$$($1_COMMAND))
ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
$$(TOUCH) $$@
endif
$1 := $$($1_EXEC_RESULT)
endif
ifneq ($$($1_POST_COMMAND), )
$$($1_FINAL_RESULT): $$($1_EXEC_RESULT)
$$(call ExecuteWithLog, $$($1_BASE)_post, \
$$($1_POST_COMMAND))
$$(TOUCH) $$@
$1 += $$($1_FINAL_RESULT)
endif
# Export all our generated targets in $1, and the final target in $1_TARGET.
$1_TARGET := $$($1_FINAL_RESULT)
endef

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2019, 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
@ -27,6 +27,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include TextFileProcessing.gmk

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2019, 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
@ -26,27 +26,22 @@
# Generate java sources using the X11 offsets that are precalculated in files
# make/data/x11wrappergen/sizes-<address size>.txt.
GENSRC_X11WRAPPERS_OUTPUT_TOP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
GENSRC_X11WRAPPERS_MARKER := $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/_x11wrappers.marker
# Put the generated Java classes used to interface X11 from awt here.
GENSRC_X11WRAPPERS_OUTPUTDIR := $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/sun/awt/X11
GENSRC_X11WRAPPERS_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
# The pre-calculated offset file are stored here:
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
GENSRC_X11WRAPPERS_DATA := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(OPENJDK_TARGET_CPU_BITS).txt
# Run the tool on the offset files to generate several Java classes used in awt.
$(GENSRC_X11WRAPPERS_MARKER): $(BUILD_TOOLS_JDK) $(GENSRC_X11WRAPPERS_DATA) \
$(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt
$(call MakeDir, $(GENSRC_X11WRAPPERS_OUTPUTDIR))
$(call LogInfo, Generating X11 wrapper source files)
$(call ExecuteWithLog, $@, \
$(TOOL_WRAPPERGENERATOR) gen_java $(GENSRC_X11WRAPPERS_OUTPUTDIR) \
$(eval $(call SetupExecute, gen_x11wrappers, \
INFO := Generating X11 wrapper source files, \
DEPS := $(BUILD_TOOLS_JDK) $(GENSRC_X11WRAPPERS_DATA) \
$(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt, \
OUTPUT_DIR := $(GENSRC_X11WRAPPERS_OUTPUTDIR), \
COMMAND := $(TOOL_WRAPPERGENERATOR) gen_java $(GENSRC_X11WRAPPERS_OUTPUTDIR) \
$(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(GENSRC_X11WRAPPERS_DATA) \
$(OPENJDK_TARGET_CPU_BITS))
$(TOUCH) $@
$(OPENJDK_TARGET_CPU_BITS), \
))
GENSRC_JAVA_DESKTOP += $(GENSRC_X11WRAPPERS_MARKER)
GENSRC_JAVA_DESKTOP += $(gen_x11wrappers_TARGET)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2019, 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
@ -27,6 +27,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include TextFileProcessing.gmk
@ -35,10 +36,10 @@ include HotspotCommon.gmk
# The real work is done in these files
include gensrc/GensrcJfr.gmk
include gensrc/GensrcAdlc.gmk
include gensrc/GensrcDtrace.gmk
include gensrc/GensrcJvmti.gmk
include gensrc/GensrcJfr.gmk
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GenerateSources.gmk))

View File

@ -166,18 +166,16 @@ ifeq ($(call check-jvm-feature, compiler2), true)
##############################################################################
# Run the adlc tool on the single concatenated ad source file, and store the
# output in support/adlc for further processing.
ADLC_RUN_MARKER := $(ADLC_SUPPORT_DIR)/_adlc_run.marker
$(ADLC_RUN_MARKER): $(BUILD_ADLC) $(SINGLE_AD_SRCFILE)
$(call LogInfo, Generating adlc files)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \
$(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \
$(eval $(call SetupExecute, adlc_run, \
INFO := Generating adlc files, \
DEPS := $(BUILD_ADLC) $(SINGLE_AD_SRCFILE), \
OUTPUT_DIR := $(ADLC_SUPPORT_DIR), \
COMMAND := $(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \
-c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
-h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
-a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp)
$(TOUCH) $@
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp, \
))
##############################################################################
# Finally copy the generated files from support/adlc into gensrc/adfiles,
@ -197,7 +195,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
)
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER)
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(adlc_run_TARGET)
$(call LogInfo, Postprocessing adlc file $*)
$(call MakeDir, $(@D))
$(NAWK) \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2019, 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
@ -64,9 +64,9 @@ ifeq ($(call check-jvm-feature, dtrace), true)
include lib/JvmFeatures.gmk
include lib/JvmFlags.gmk
# We cannot compile until the JVMTI and JFR gensrc has finished
# We cannot compile until the JVMTI and JFR gensrc has finished.
# JFR_FILES is defined in GensrcJfr.gmk.
JVMTI_H := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h
JFR_FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles/jfrEventClasses.hpp
$(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
NAME := dtraceGenOffsets, \
@ -87,12 +87,14 @@ ifeq ($(call check-jvm-feature, dtrace), true)
# Argument 1: Output filename
# Argument 2: dtrace-gen-offset tool command line option
define SetupDtraceOffsetsGeneration
$1: $$(BUILD_DTRACE_GEN_OFFSETS)
$$(call LogInfo, Generating dtrace $2 file $$(@F))
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
$$(eval $$(call SetupExecute, dtrace_offset_$$(strip $2), \
INFO := Generating dtrace $2 file, \
DEPS := $$(BUILD_DTRACE_GEN_OFFSETS), \
OUTPUT_FILE := $1, \
COMMAND := ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $1 ), \
))
TARGETS += $1
TARGETS += $$(dtrace_offset_$$(strip $2)_TARGET)
endef
JVM_OFFSETS_H := $(DTRACE_GENSRC_DIR)/JvmOffsets.h

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2019, 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
@ -57,11 +57,12 @@ JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
METADATA_XML := $(JFR_SRCDIR)/metadata.xml
METADATA_XSD := $(JFR_SRCDIR)/metadata.xsd
$(JFR_OUTPUTDIR)/jfrEventClasses.hpp: $(METADATA_XML) $(METADATA_XSD) \
$(BUILD_JFR_TOOLS)
$(call LogInfo, Generating $(@F))
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, $(TOOL_JFR_GEN) $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR))
test -f $@
$(eval $(call SetupExecute, jfr_gen, \
INFO := Generating JFR header files, \
DEPS := $(METADATA_XML) $(METADATA_XSD) $(BUILD_JFR_TOOLS), \
OUTPUT_DIR := $(JFR_OUTPUTDIR), \
COMMAND := $(TOOL_JFR_GEN) $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR), \
))
TARGETS += $(JFR_OUTPUTDIR)/jfrEventClasses.hpp
JFR_FILES := $(jfr_gen_TARGET)
TARGETS += $(JFR_FILES)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2019, 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
@ -28,6 +28,7 @@ $(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJvmti.gmk))
################################################################################
# Build tools needed for the JVMTI source code generation
# FIXME: jvmtiGen.java should move to make/src, jvmtiEnvFill.java should be removed.
JVMTI_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/prims
JVMTI_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jvmti
@ -64,16 +65,17 @@ TOOL_JVMTI_ENV_FILL := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiEnvFill
# DEPS -- Additional dependencies
SetupXslTransform = $(NamedParamsMacroTemplate)
define SetupXslTransformBody
$$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSL_FILE) $$($1_DEPS) $$(BUILD_JVMTI_TOOLS)
$$(call LogInfo, Generating $$(@F))
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) \
-XSL $$($1_XSL_FILE) -OUT $$@ $$($1_ARGS))
# jvmtiGen does not return error code properly on fail.
# NOTE: We should really fix jvmtiGen.java instead.
test -f $$@
$1_OUTPUT_FILE := $$($1_OUTPUT_DIR)/$1
TARGETS += $$($1_OUTPUT_DIR)/$1
$$(eval $$(call SetupExecute, jvmti_gen_$1, \
INFO := Generating jvmti file $1, \
DEPS := $$($1_XML_FILE) $$($1_XSL_FILE) $$($1_DEPS) $$(BUILD_JVMTI_TOOLS), \
OUTPUT_FILE := $$($1_OUTPUT_FILE), \
COMMAND := $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) \
-XSL $$($1_XSL_FILE) -OUT $$($1_OUTPUT_FILE) $$($1_ARGS), \
))
TARGETS += $$(jvmti_gen_$1_TARGET)
endef
################################################################################

View File

@ -144,14 +144,16 @@ ifeq ($(call isTargetOs, windows), true)
VCPROJ_VARDEPS_FILE := $(call DependOnVariable, VCPROJ_VARDEPS, \
$(VCPROJ_FILE).vardeps)
$(VCPROJ_FILE): $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, \
$(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
$(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $@)) \
$(LOG_INFO)
$(eval $(call SetupExecute, vcproj_file, \
INFO := Generating Visual Studio project file, \
DEPS := $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE), \
OUTPUT_FILE := $(VCPROJ_FILE), \
COMMAND := $(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
$(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $(VCPROJ_FILE))) \
$(LOG_INFO), \
))
TARGETS += $(VCPROJ_FILE)
TARGETS += $(vcproj_file_TARGET)
all: $(TARGETS)