1
+ #
2
+ # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
3
+ # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
+ #
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.
10
+ #
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).
16
+ #
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.
20
+ #
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
23
+ # questions.
24
+ #
25
+
26
+ $(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJfr.gmk))
27
+
28
+ ################################################################################
29
+ # Build tools needed for the Jfr source code generation
30
+
31
+ JFR_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
32
+ JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jfr
33
+
34
+ $(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
35
+ JAVAC := $(JAVAC), \
36
+ FLAGS := $(DISABLE_WARNINGS), \
37
+ SERVER_DIR := $(SJAVAC_SERVER_DIR), \
38
+ SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
39
+ DISABLE_SJAVAC := true, \
40
+ ))
41
+
42
+ $(eval $(call SetupJavaCompilation, BUILD_JFR_TOOLS, \
43
+ SETUP := GENERATE_JFRBYTECODE, \
44
+ SRC := $(JFR_TOOLS_SRCDIR), \
45
+ INCLUDE_FILES := GenerateJfrFiles.java, \
46
+ BIN := $(JFR_TOOLS_OUTPUTDIR), \
47
+ ))
48
+
49
+ TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) GenerateJfrFiles
50
+
51
+ ################################################################################
52
+ # Setup make rules for Jfr file file generation.
53
+ #
54
+ # Parameter 1 is the name of the rule. This name is used as variable prefix,
55
+ # and the targets generated are listed in a variable by that name. This name is
56
+ # also used as the name of the output file.
57
+ #
58
+ # Remaining parameters are named arguments. These include:
59
+ # XML_FILE -- The input source file to use
60
+ # XSD_FILE -- The input schema for validation
61
+ # OUTPUT_DIR -- The directory to put the generated file in
62
+ SetupJfrGeneration = $(NamedParamsMacroTemplate)
63
+ define SetupJfrGenerationBody
64
+ $$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSD_FILE) $$(BUILD_JFR_TOOLS)
65
+ $$(call LogInfo, Generating $$(@F))
66
+ $$(call MakeDir, $$(@D))
67
+ $$(call ExecuteWithLog, $$@, $$(TOOL_JFR_GEN) $$($1_XML_FILE) $$($1_XSD_FILE) $$($1_OUTPUT_DIR))
68
+ test -f $$@
69
+
70
+ TARGETS += $$($1_OUTPUT_DIR)/$1
71
+
72
+ endef
73
+
74
+ ################################################################################
75
+ # Create files in gensrc/jfrfiles
76
+
77
+ JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
78
+ JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
79
+
80
+ METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml
81
+ METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd
82
+
83
+ # Changing these will trigger a rebuild of generated jfr files.
84
+ JFR_DEPS += \
85
+ $(METADATA_XML) \
86
+ $(METADATA_XSD) \
87
+ #
88
+
89
+ # our generator will generate all files in one go, so only need to setup one target rule
90
+ $(eval $(call SetupJfrGeneration, jfrEventClasses.hpp, \
91
+ XML_FILE := $(METADATA_XML), \
92
+ XSD_FILE := $(METADATA_XSD), \
93
+ OUTPUT_DIR := $(JFR_OUTPUTDIR), \
94
+ ))
0 commit comments