annotate make/hotspot/gensrc/GensrcDtrace.gmk @ 49697:58cffb6ec13c

8201236: Straighten out dtrace build logic Reviewed-by: erikj
author ihse
date Mon, 09 Apr 2018 19:23:01 +0200
parents 6abbc1f5c2a1
children
rev   line source
erikj@37437 1 #
ihse@49298 2 # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
erikj@37437 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@37437 4 #
erikj@37437 5 # This code is free software; you can redistribute it and/or modify it
erikj@37437 6 # under the terms of the GNU General Public License version 2 only, as
erikj@37437 7 # published by the Free Software Foundation. Oracle designates this
erikj@37437 8 # particular file as subject to the "Classpath" exception as provided
erikj@37437 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@37437 10 #
erikj@37437 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@37437 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@37437 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@37437 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@37437 15 # accompanied this code).
erikj@37437 16 #
erikj@37437 17 # You should have received a copy of the GNU General Public License version
erikj@37437 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@37437 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@37437 20 #
erikj@37437 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@37437 22 # or visit www.oracle.com if you need additional information or have any
erikj@37437 23 # questions.
erikj@37437 24 #
erikj@37437 25
erikj@37437 26 ################################################################################
erikj@37437 27 # Gensrc support for dtrace. The files generated here are included by dtrace.hpp
erikj@37437 28
erikj@37437 29 ifeq ($(call check-jvm-feature, dtrace), true)
erikj@37437 30
erikj@37437 31 ifeq ($(OPENJDK_TARGET_OS), solaris)
erikj@37437 32 DTRACE_FLAGS := -64
erikj@37437 33 DTRACE_CPP_FLAGS := -D_LP64
erikj@37437 34 else ifeq ($(OPENJDK_TARGET_OS), macosx)
erikj@37437 35 DTRACE_CPP_FLAGS := -D_LP64 -x c
erikj@37437 36 else ifeq ($(OPENJDK_TARGET_OS), linux)
erikj@37437 37 DTRACE_CPP_FLAGS := -x c
erikj@37437 38 endif
erikj@37437 39
erikj@47217 40 DTRACE_SOURCE_DIR := $(TOPDIR)/src/hotspot/os/posix/dtrace
erikj@37437 41 DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
erikj@37437 42
erikj@37437 43 # Make sure we run our selected compiler for preprocessing instead of letting
erikj@37437 44 # the dtrace tool pick it on it's own.
erikj@37437 45 $(DTRACE_GENSRC_DIR)/%.h: $(DTRACE_SOURCE_DIR)/%.d
erikj@37437 46 $(call LogInfo, Generating dtrace header file $(@F))
erikj@37437 47 $(call MakeDir, $(@D) $(DTRACE_SUPPORT_DIR))
erikj@39622 48 $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
ihse@49298 49 ($(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d))
erikj@37437 50 $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -h -o $@ -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
erikj@37437 51
erikj@37437 52 # Process all .d files in DTRACE_SOURCE_DIR. They are:
erikj@37437 53 # hotspot_jni.d hotspot.d hs_private.d
erikj@37437 54 TARGETS += $(patsubst $(DTRACE_SOURCE_DIR)/%.d, \
erikj@37437 55 $(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d))
erikj@37437 56
ihse@49697 57 ifeq ($(OPENJDK_TARGET_OS), solaris)
ihse@49697 58 ############################################################################
ihse@49697 59 # First we need to generate the dtraceGenOffsets tool. When run, this will
ihse@49697 60 # produce two header files and a C++ file. Note that generateJvmOffsets.cpp
ihse@49697 61 # is using the same JVM_CFLAGS as libjvm.so.
ihse@49697 62
ihse@49697 63 # Include support files that will setup JVM compiler flags.
ihse@49697 64 include lib/JvmFeatures.gmk
ihse@49697 65 include lib/JvmFlags.gmk
ihse@49697 66
ihse@49697 67 # We cannot compile until the JVMTI gensrc has finished
ihse@49697 68 JVMTI_H := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h
ihse@49697 69
ihse@49697 70 $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
ihse@49697 71 NAME := dtraceGenOffsets, \
ihse@49697 72 TYPE := EXECUTABLE, \
ihse@49697 73 SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
ihse@49697 74 TOOLCHAIN := $(TOOLCHAIN_BUILD), \
ihse@49697 75 LDFLAGS := -m64, \
ihse@49697 76 CFLAGS := -m64 $(JVM_CFLAGS), \
ihse@49697 77 EXTRA_DEPS := $(JVMTI_H), \
ihse@49697 78 OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
ihse@49697 79 OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
ihse@49697 80 ))
ihse@49697 81
ihse@49697 82 DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
ihse@49697 83
ihse@49697 84 # Argument 1: Output filename
ihse@49697 85 # Argument 2: dtrace-gen-offset tool command line option
ihse@49697 86 define SetupDtraceOffsetsGeneration
ihse@49697 87 $1: $$(BUILD_DTRACE_GEN_OFFSETS)
ihse@49697 88 $$(call LogInfo, Generating dtrace $2 file $$(@F))
ihse@49697 89 $$(call MakeDir, $$(@D))
ihse@49697 90 $$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
ihse@49697 91
ihse@49697 92 TARGETS += $1
ihse@49697 93 endef
ihse@49697 94
ihse@49697 95 JVM_OFFSETS_H := $(DTRACE_GENSRC_DIR)/JvmOffsets.h
ihse@49697 96 JVM_OFFSETS_CPP := $(DTRACE_GENSRC_DIR)/JvmOffsets.cpp
ihse@49697 97 JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
ihse@49697 98
ihse@49697 99 ############################################################################
ihse@49697 100 # Run the dtrace-gen-offset tool to generate these three files.
ihse@49697 101 # The generated JvmOffsets.cpp is compiled with the rest of libjvm.
ihse@49697 102 # The header files are used by libjvm_db and jhelper.d, respectively.
ihse@49697 103
ihse@49697 104 $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
ihse@49697 105 $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
ihse@49697 106 $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
ihse@49697 107 endif
ihse@49697 108
erikj@37437 109 endif