make/hotspot/gensrc/GensrcJfr.gmk
author apetcher
Tue, 22 May 2018 13:44:02 -0400
branchJDK-8171279-XDH-TLS-branch
changeset 56589 bafd8be2f970
parent 50113 caf115bb98ad
child 50266 8090a68b6af5
permissions -rw-r--r--
Initial working XDH support in TLS. I should try to refactor the code a bit.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     1
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     2
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     4
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    10
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    15
# accompanied this code).
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    16
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    20
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    23
# questions.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    24
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    25
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    26
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJfr.gmk))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    27
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    28
################################################################################
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    29
# Build tools needed for the Jfr source code generation
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    30
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    31
JFR_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    32
JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jfr
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    33
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    34
$(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    35
    JAVAC := $(JAVAC), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    36
    FLAGS := $(DISABLE_WARNINGS), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    37
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    38
    SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    39
    DISABLE_SJAVAC := true, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    40
))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    41
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    42
$(eval $(call SetupJavaCompilation, BUILD_JFR_TOOLS, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    43
    SETUP := GENERATE_JFRBYTECODE, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    44
    SRC := $(JFR_TOOLS_SRCDIR), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    45
    INCLUDE_FILES := GenerateJfrFiles.java, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    46
    BIN := $(JFR_TOOLS_OUTPUTDIR), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    47
))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    48
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    49
TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) GenerateJfrFiles
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    50
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    51
################################################################################
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    52
# Setup make rules for Jfr file file generation.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    53
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    54
# Parameter 1 is the name of the rule. This name is used as variable prefix,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    55
# and the targets generated are listed in a variable by that name. This name is
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    56
# also used as the name of the output file.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    57
#
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    58
# Remaining parameters are named arguments. These include:
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    59
#   XML_FILE -- The input source file to use
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    60
#   XSD_FILE -- The input schema for validation
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    61
#   OUTPUT_DIR -- The directory to put the generated file in
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    62
SetupJfrGeneration = $(NamedParamsMacroTemplate)
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    63
define SetupJfrGenerationBody
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    64
  $$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSD_FILE) $$(BUILD_JFR_TOOLS)
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    65
	$$(call LogInfo, Generating $$(@F))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    66
	$$(call MakeDir, $$(@D))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    67
	$$(call ExecuteWithLog, $$@, $$(TOOL_JFR_GEN) $$($1_XML_FILE) $$($1_XSD_FILE) $$($1_OUTPUT_DIR))
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    68
	test -f $$@
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    69
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    70
  TARGETS += $$($1_OUTPUT_DIR)/$1
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    71
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    72
endef
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    73
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    74
################################################################################
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    75
# Create files in gensrc/jfrfiles
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    76
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    77
JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    78
JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    79
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    80
METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    81
METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    82
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    83
# Changing these will trigger a rebuild of generated jfr files.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    84
JFR_DEPS += \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    85
    $(METADATA_XML) \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    86
    $(METADATA_XSD) \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    87
    #
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    88
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    89
# our generator will generate all files in one go, so only need to setup one target rule
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    90
$(eval $(call SetupJfrGeneration, jfrEventClasses.hpp, \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    91
    XML_FILE := $(METADATA_XML), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    92
    XSD_FILE := $(METADATA_XSD), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    93
    OUTPUT_DIR := $(JFR_OUTPUTDIR), \
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    94
))