1 #
   2 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
   3 # Copyright (c) 2012 Red Hat, Inc.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #  
  24 #
  25 
  26 # Linux does not build jvm_db
  27 LIBJVM_DB =
  28 
  29 # Only OPENJDK builds test and support SDT probes currently.
  30 ifndef OPENJDK
  31 REASON = "This JDK does not support SDT probes"
  32 else
  33 
  34 # We need a recent GCC for the default (4.4 or later)
  35 ifeq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) \) \| \( $(CC_VER_MAJOR) \>= 5 \) )" "0"
  36 REASON = "gcc version is too old"
  37 else
  38 
  39 # But it does have a SystemTap dtrace compatible sys/sdt.h
  40 ifneq ($(ALT_SDT_H),)
  41   SDT_H_FILE = $(ALT_SDT_H)
  42 else
  43   ifeq ($(USE_CLANG), true)
  44     # Clang doesn't support the -print-sysroot option and there is no known equivalent
  45     # option, so fall back to using / as sysroot
  46     SDT_SYSROOT=
  47   else
  48     SDT_SYSROOT=$(shell $(CXX) -print-sysroot)
  49   endif
  50   SDT_H_FILE = $(SDT_SYSROOT)/usr/include/sys/sdt.h
  51 endif
  52 
  53 DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE))
  54 REASON = "$(SDT_H_FILE) not found"
  55 
  56 endif # GCC version
  57 endif # OPENJDK
  58 
  59 
  60 DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace
  61 DTRACE_PROG = dtrace
  62 DtraceOutDir = $(GENERATED)/dtracefiles
  63 
  64 $(DtraceOutDir):
  65         mkdir $(DtraceOutDir)
  66 
  67 $(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d | $(DtraceOutDir)
  68         $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot.d
  69 
  70 $(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d | $(DtraceOutDir)
  71         $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d
  72 
  73 $(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d | $(DtraceOutDir)
  74         $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hs_private.d
  75 
  76 ifneq ($(DTRACE_ENABLED),)
  77 CFLAGS += -DDTRACE_ENABLED
  78 dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
  79 else
  80 dtrace_gen_headers:
  81         $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)"
  82 endif
  83 
  84 # Phony target used in vm.make build target to check whether enabled.
  85 ifeq ($(DTRACE_ENABLED),)
  86 dtraceCheck:
  87         $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)"
  88 else
  89 dtraceCheck:
  90 endif
  91 
  92 .PHONY: dtrace_gen_headers dtraceCheck
  93 
  94 # It doesn't support HAVE_DTRACE_H though.
  95