1 #
   2 # Copyright (c) 2005, 2012, 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.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  
  23 #
  24 
  25 # Rules to build jvm_db/dtrace, used by vm.make
  26 
  27 # We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2
  28 # but not for CORE or KERNEL configurations.
  29 
  30 ifneq ("${TYPE}", "CORE")
  31 ifneq ("${TYPE}", "KERNEL")
  32 
  33 ifdef USE_GCC
  34 
  35 dtraceCheck:
  36         $(QUIETLY) echo "**NOTICE** Dtrace support disabled for gcc builds"
  37 
  38 else
  39 
  40 JVM_DB = libjvm_db
  41 LIBJVM_DB = libjvm_db.so
  42 LIBJVM_DB_G = libjvm$(G_SUFFIX)_db.so
  43 
  44 LIBJVM_DB_DEBUGINFO   = libjvm_db.debuginfo
  45 LIBJVM_DB_DIZ         = libjvm_db.diz
  46 LIBJVM_DB_G_DEBUGINFO = libjvm$(G_SUFFIX)_db.debuginfo
  47 LIBJVM_DB_G_DIZ       = libjvm$(G_SUFFIX)_db.diz
  48 
  49 JVM_DTRACE = jvm_dtrace
  50 LIBJVM_DTRACE = libjvm_dtrace.so
  51 LIBJVM_DTRACE_G = libjvm$(G_SUFFIX)_dtrace.so
  52 
  53 LIBJVM_DTRACE_DEBUGINFO   = libjvm_dtrace.debuginfo
  54 LIBJVM_DTRACE_DIZ         = libjvm_dtrace.diz
  55 LIBJVM_DTRACE_G_DEBUGINFO = libjvm$(G_SUFFIX)_dtrace.debuginfo
  56 LIBJVM_DTRACE_G_DIZ       = libjvm$(G_SUFFIX)_dtrace.diz
  57 
  58 JVMOFFS = JvmOffsets
  59 JVMOFFS.o = $(JVMOFFS).o
  60 GENOFFS = generate$(JVMOFFS)
  61 
  62 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace
  63 DTRACE = dtrace
  64 DTRACE.o = $(DTRACE).o
  65 
  66 # to remove '-g' option which causes link problems
  67 # also '-z nodefs' is used as workaround
  68 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
  69 
  70 ifdef LP64
  71 DTRACE_OPTS = -64 -D_LP64
  72 endif
  73 
  74 # making libjvm_db
  75 
  76 # Use mapfile with libjvm_db.so
  77 LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db
  78 LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE))
  79 
  80 # Use mapfile with libjvm_dtrace.so
  81 LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace
  82 LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE))
  83 
  84 ifdef USE_GCC
  85 LFLAGS_JVM_DB += -D_REENTRANT $(PICFLAG)
  86 LFLAGS_JVM_DTRACE += -D_REENTRANT $(PICFLAG)
  87 else
  88 LFLAGS_JVM_DB += -mt $(PICFLAG) -xnolib
  89 LFLAGS_JVM_DTRACE += -mt $(PICFLAG) -xnolib -ldl
  90 endif
  91 
  92 ISA = $(subst i386,i486,$(shell isainfo -n))
  93 
  94 # Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so
  95 ifneq ("${ISA}","${BUILDARCH}")
  96 
  97 XLIBJVM_DB = 64/$(LIBJVM_DB)
  98 XLIBJVM_DB_G = 64/$(LIBJVM_DB_G)
  99 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE)
 100 XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G)
 101 
 102 XLIBJVM_DB_DEBUGINFO       = 64/$(LIBJVM_DB_DEBUGINFO)
 103 XLIBJVM_DB_DIZ             = 64/$(LIBJVM_DB_DIZ)
 104 XLIBJVM_DB_G_DEBUGINFO     = 64/$(LIBJVM_DB_G_DEBUGINFO)
 105 XLIBJVM_DB_G_DIZ           = 64/$(LIBJVM_DB_G_DIZ)
 106 XLIBJVM_DTRACE_DEBUGINFO   = 64/$(LIBJVM_DTRACE_DEBUGINFO)
 107 XLIBJVM_DTRACE_DIZ         = 64/$(LIBJVM_DTRACE_DIZ)
 108 XLIBJVM_DTRACE_G_DEBUGINFO = 64/$(LIBJVM_DTRACE_G_DEBUGINFO)
 109 XLIBJVM_DTRACE_G_DIZ       = 64/$(LIBJVM_DTRACE_G_DIZ)
 110 
 111 $(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
 112         @echo Making $@
 113         $(QUIETLY) mkdir -p 64/ ; \
 114         $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
 115                 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 116         [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
 117 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 118 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
 119 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 120 # An empty section header has sh_addr == 0 and sh_size == 0.
 121 # This problem has only been seen on Solaris X64, but we call this tool
 122 # on all Solaris builds just in case.
 123         $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 124         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
 125 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
 126 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
 127 #         $(QUIETLY) $(OBJCOPY) 
 128 #           --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ;
 129 # Do this part in the '64' subdir so '64/' is not in the link name:
 130         ( set -e ; \
 131           cd 64 ; \
 132           $(QUIETLY) $(ADD_GNU_DEBUGLINK) \
 133             $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ; \
 134         )
 135   ifeq ($(STRIP_POLICY),all_strip)
 136         $(QUIETLY) $(STRIP) $@
 137   else
 138     ifeq ($(STRIP_POLICY),min_strip)
 139         $(QUIETLY) $(STRIP) -x $@
 140     # implied else here is no stripping at all
 141     endif
 142   endif
 143         [ -f $(XLIBJVM_DB_G_DEBUGINFO) ] || { ln -s $(XLIBJVM_DB_DEBUGINFO) $(XLIBJVM_DB_G_DEBUGINFO); }
 144   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 145 # Do this part in the '64' subdir so '64/' is not in the archived name:
 146         ( set -e ; \
 147           cd 64 ; \
 148           $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) \
 149             $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO) ; \
 150         )
 151         $(RM) $(XLIBJVM_DB_DEBUGINFO) $(XLIBJVM_DB_G_DEBUGINFO)
 152         [ -f $(XLIBJVM_DB_G_DIZ) ] || { ln -s $(XLIBJVM_DB_DIZ) $(XLIBJVM_DB_G_DIZ); }
 153   endif
 154 endif
 155 
 156 $(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 157         @echo Making $@
 158         $(QUIETLY) mkdir -p 64/ ; \
 159         $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
 160                 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 161         [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
 162 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 163 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 164         $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 165         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
 166 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
 167 #         $(QUIETLY) $(OBJCOPY) 
 168 #           --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ;
 169 # Do this part in the '64' subdir so '64/' is not in the link name:
 170         ( set -e ; \
 171           cd 64 ; \
 172           $(QUIETLY) $(ADD_GNU_DEBUGLINK) \
 173             $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ; \
 174         )
 175   ifeq ($(STRIP_POLICY),all_strip)
 176         $(QUIETLY) $(STRIP) $@
 177   else
 178     ifeq ($(STRIP_POLICY),min_strip)
 179         $(QUIETLY) $(STRIP) -x $@
 180     # implied else here is no stripping at all
 181     endif
 182   endif
 183         [ -f $(XLIBJVM_DTRACE_G_DEBUGINFO) ] || { ln -s $(XLIBJVM_DTRACE_DEBUGINFO) $(XLIBJVM_DTRACE_G_DEBUGINFO); }
 184   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 185 # Do this part in the '64' subdir so '64/' is not in the archived name:
 186         ( set -e ; \
 187           cd 64 ; \
 188           $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) \
 189             $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO) ; \
 190         )
 191         $(RM) $(XLIBJVM_DTRACE_DEBUGINFO) $(XLIBJVM_DTRACE_G_DEBUGINFO)
 192         [ -f $(XLIBJVM_DTRACE_G_DIZ) ] || { ln -s $(XLIBJVM_DTRACE_DIZ) $(XLIBJVM_DTRACE_G_DIZ); }
 193   endif
 194 endif
 195 
 196 endif # ifneq ("${ISA}","${BUILDARCH}")
 197 
 198 ifdef USE_GCC
 199 LFLAGS_GENOFFS += -D_REENTRANT
 200 else
 201 LFLAGS_GENOFFS += -mt -xnolib -norunpath
 202 endif
 203 
 204 lib$(GENOFFS).so: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \
 205                   $(LIBJVM.o)
 206         $(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \
 207                  $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -lc
 208 
 209 $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so
 210         $(QUIETLY) $(LINK.CXX) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \
 211                 ./lib$(GENOFFS).so
 212 
 213 CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \
 214         cmp -s $@ $@.tmp; \
 215         case $$? in \
 216         0) rm -f $@.tmp;; \
 217         *) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \
 218         esac
 219 
 220 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
 221 $(JVMOFFS).h: $(GENOFFS)
 222         $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp
 223         $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 224 
 225 $(JVMOFFS)Index.h: $(GENOFFS)
 226         $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp
 227         $(QUIETLY)  $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 228 
 229 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
 230         $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp
 231         $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 232 
 233 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
 234         $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
 235 
 236 $(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
 237         @echo Making $@
 238         $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 239                 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 240         [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
 241 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 242 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 243         $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 244         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
 245 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
 246 #       $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
 247         $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
 248   ifeq ($(STRIP_POLICY),all_strip)
 249         $(QUIETLY) $(STRIP) $@
 250   else
 251     ifeq ($(STRIP_POLICY),min_strip)
 252         $(QUIETLY) $(STRIP) -x $@
 253     # implied else here is no stripping at all
 254     endif
 255   endif
 256         [ -f $(LIBJVM_DB_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO); }
 257   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 258         $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO)
 259         $(RM) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO)
 260         [ -f $(LIBJVM_DB_G_DIZ) ] || { ln -s $(LIBJVM_DB_DIZ) $(LIBJVM_DB_G_DIZ); }
 261   endif
 262 endif
 263 
 264 $(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 265         @echo Making $@
 266         $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 267                 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 268         [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
 269 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 270 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 271         $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 272         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
 273 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
 274 #       $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
 275         $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
 276   ifeq ($(STRIP_POLICY),all_strip)
 277         $(QUIETLY) $(STRIP) $@
 278   else
 279     ifeq ($(STRIP_POLICY),min_strip)
 280         $(QUIETLY) $(STRIP) -x $@
 281     # implied else here is no stripping at all
 282     endif
 283   endif
 284         [ -f $(LIBJVM_DTRACE_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO); }
 285   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 286         $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO)
 287         $(RM) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO)
 288         [ -f $(LIBJVM_DTRACE_G_DIZ) ] || { ln -s $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_G_DIZ); }
 289   endif
 290 endif
 291 
 292 $(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \
 293              $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
 294         $(QUIETLY) cat $^ > $@
 295 
 296 DTraced_Files = ciEnv.o \
 297                 classLoadingService.o \
 298                 compileBroker.o \
 299                 hashtable.o \
 300                 instanceKlass.o \
 301                 java.o \
 302                 jni.o \
 303                 jvm.o \
 304                 memoryManager.o \
 305                 nmethod.o \
 306                 objectMonitor.o \
 307                 runtimeService.o \
 308                 sharedRuntime.o \
 309                 synchronizer.o \
 310                 thread.o \
 311                 unsafe.o \
 312                 vmThread.o \
 313                 vmCMSOperations.o \
 314                 vmPSOperations.o \
 315                 vmGCOperations.o \
 316 
 317 # Dtrace is available, so we build $(DTRACE.o)  
 318 $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
 319         @echo Compiling $(DTRACE).d
 320 
 321         $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
 322      $(DTraced_Files) ||\
 323   STATUS=$$?;\
 324         if [ x"$$STATUS" = x"1" -a \
 325        x`uname -r` = x"5.10" -a \
 326        x`uname -p` = x"sparc" ]; then\
 327     echo "*****************************************************************";\
 328     echo "* If you are building server compiler, and the error message is ";\
 329     echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\
 330     echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\
 331     echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\
 332     echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
 333     echo "* dtrace probes for this build.";\
 334     echo "*****************************************************************";\
 335   fi;\
 336   exit $$STATUS
 337   # Since some DTraced_Files are in LIBJVM.o and they are touched by this
 338   # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will
 339   # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets*
 340   # files, but it doesn't, so we touch the necessary files to prevent later
 341   # recompilation. Note: we only touch the necessary files if they already
 342   # exist in order to close a race where an empty file can be created
 343   # before the real build rule is executed.
 344   # But, we can't touch the *.h files:  This rule depends
 345   # on them, and that would cause an infinite cycle of rebuilding.
 346   # Neither the *.h or *.ccp files need to be touched, since they have
 347   # rules which do not update them when the generator file has not
 348   # changed their contents.
 349         $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi
 350         $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi
 351         $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi
 352 
 353 .PHONY: dtraceCheck
 354 
 355 SYSTEM_DTRACE_H = /usr/include/dtrace.h
 356 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
 357 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
 358 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
 359 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
 360 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
 361 
 362 ifneq ("$(systemDtraceHdrFound)", "") 
 363 CFLAGS += -DHAVE_DTRACE_H
 364 endif
 365 
 366 ifneq ("$(patchDtraceFound)", "")
 367 DTRACE_PROG=$(PATCH_DTRACE_PROG)
 368 DTRACE_INCL=-I/opt/SUNWdtrd/include
 369 else
 370 ifneq ("$(systemDtraceFound)", "")
 371 DTRACE_PROG=$(SYSTEM_DTRACE_PROG)
 372 else
 373 
 374 endif # ifneq ("$(systemDtraceFound)", "")
 375 endif # ifneq ("$(patchDtraceFound)", "")
 376 
 377 ifneq ("${DTRACE_PROG}", "")
 378 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
 379 
 380 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o)
 381 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED
 382 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE)
 383 
 384 dtraceCheck:
 385 
 386 else # manually disabled
 387 
 388 dtraceCheck:
 389         $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
 390 
 391 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
 392 
 393 else # No dtrace program found
 394 
 395 dtraceCheck:
 396         $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
 397 
 398 endif # ifneq ("${dtraceFound}", "")
 399 
 400 endif # ifdef USE_GCC
 401 
 402 else # KERNEL build
 403 
 404 dtraceCheck:
 405         $(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds"
 406 
 407 endif # ifneq ("${TYPE}", "KERNEL")
 408 
 409 else # CORE build
 410 
 411 dtraceCheck:
 412         $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds"
 413 
 414 endif # ifneq ("${TYPE}", "CORE")