2
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
28
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJvmti.gmk))
30
################################################################################
31
# Build tools needed for the JVMTI source code generation
33
# FIXME: jvmtiGen.java should move to make/src, jvmtiEnvFill.java should be removed.
34
JVMTI_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/prims
35
JVMTI_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jvmti
37
$(eval $(call SetupJavaCompilation, BUILD_JVMTI_TOOLS, \
38
COMPILER := bootjdk, \
39
SMALL_JAVA := false, \
40
SRC := $(JVMTI_TOOLS_SRCDIR), \
41
DISABLED_WARNINGS := rawtypes cast, \
42
INCLUDE_FILES := jvmtiGen.java jvmtiEnvFill.java, \
43
BIN := $(JVMTI_TOOLS_OUTPUTDIR), \
46
TOOL_JVMTI_GEN := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiGen
47
TOOL_JVMTI_ENV_FILL := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiEnvFill
49
################################################################################
50
# Setup make rules for an xml transform for jvmti file generation.
52
# Parameter 1 is the name of the rule. This name is used as variable prefix,
53
# and the targets generated are listed in a variable by that name. This name is
54
# also used as the name of the output file.
56
# Remaining parameters are named arguments. These include:
57
# XML_FILE -- The input source file to use
58
# XSL_FILE -- The xsl file to use
59
# OUTPUT_DIR -- The directory to put the generated file in
60
# ARGS -- Additional arguments to the jvmtiGen tool
61
# DEPS -- Additional dependencies
62
SetupXslTransform = $(NamedParamsMacroTemplate)
63
define SetupXslTransformBody
64
$1_OUTPUT_FILE := $$($1_OUTPUT_DIR)/$1
66
$$(eval $$(call SetupExecute, jvmti_gen_$1, \
67
INFO := Generating jvmti file $1, \
68
DEPS := $$($1_XML_FILE) $$($1_XSL_FILE) $$($1_DEPS) $$(BUILD_JVMTI_TOOLS), \
69
OUTPUT_FILE := $$($1_OUTPUT_FILE), \
70
COMMAND := $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) \
71
-XSL $$($1_XSL_FILE) -OUT $$($1_OUTPUT_FILE) $$($1_ARGS), \
74
TARGETS += $$(jvmti_gen_$1_TARGET)
77
################################################################################
78
# Create JVMTI files in gensrc/jvmtifiles
80
JVMTI_SRCDIR := $(TOPDIR)/src/hotspot/share/prims
81
JVMTI_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles
83
# Setup rule for generating a jvmti file
85
# $1 is generated source file name in $(JVMTI_OUTPUTDIR)
86
# $2 is XSL file to use in $(JVMTI_SRCDIR)
87
# $3 is optional extra arguments to jvmtiGen
88
define SetupJvmtiGeneration
89
$$(eval $$(call SetupXslTransform, $1, \
90
XML_FILE := $$(JVMTI_SRCDIR)/jvmti.xml, \
91
XSL_FILE := $$(JVMTI_SRCDIR)/$(strip $2), \
92
OUTPUT_DIR := $$(JVMTI_OUTPUTDIR), \
94
DEPS := $$(JVMTI_SRCDIR)/jvmtiLib.xsl, \
98
$(eval $(call SetupJvmtiGeneration, jvmtiEnter.cpp, jvmtiEnter.xsl, \
99
-PARAM majorversion $(VERSION_FEATURE) \
100
-PARAM interface jvmti))
101
$(eval $(call SetupJvmtiGeneration, jvmtiEnterTrace.cpp, jvmtiEnter.xsl, \
102
-PARAM majorversion $(VERSION_FEATURE) \
103
-PARAM interface jvmti -PARAM trace Trace))
104
$(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl, \
105
-PARAM majorversion $(VERSION_FEATURE)))
106
$(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl, \
107
-PARAM majorversion $(VERSION_FEATURE)))
108
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl, \
109
-PARAM majorversion $(VERSION_FEATURE)))
111
################################################################################
112
# Copy jvmti.h to include dir
114
# The file is the same regardless of jvm variant. Only let one do the copy.
115
ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
116
$(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
117
DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
118
FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
121
TARGETS += $(COPY_JVMTI_H)