Mercurial > hg > truffle
annotate make/solaris/makefiles/dtrace.make @ 1332:4b60f23c4223 hs18-b02 jdk7-b88
Merge
author | acorn |
---|---|
date | Thu, 01 Apr 2010 20:48:50 -0400 |
parents | 167c2986d91b |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 # |
196 | 2 # Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 # CA 95054 USA or visit www.sun.com if you need additional information or | |
21 # have any questions. | |
22 # | |
23 # | |
24 | |
25 # Rules to build jvm_db/dtrace, used by vm.make | |
26 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
27 # We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
28 # but not for CORE or KERNEL configurations. |
0 | 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 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
41 LIBJVM_DB = libjvm_db.so |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
42 LIBJVM_DB_G = libjvm$(G_SUFFIX)_db.so |
0 | 43 |
44 JVM_DTRACE = jvm_dtrace | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
45 LIBJVM_DTRACE = libjvm_dtrace.so |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
46 LIBJVM_DTRACE_G = libjvm$(G_SUFFIX)_dtrace.so |
0 | 47 |
48 JVMOFFS = JvmOffsets | |
49 JVMOFFS.o = $(JVMOFFS).o | |
50 GENOFFS = generate$(JVMOFFS) | |
51 | |
52 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace | |
53 DTRACE = dtrace | |
54 DTRACE.o = $(DTRACE).o | |
55 | |
56 # to remove '-g' option which causes link problems | |
57 # also '-z nodefs' is used as workaround | |
58 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) | |
59 | |
60 ifdef LP64 | |
61 DTRACE_OPTS = -64 -D_LP64 | |
62 endif | |
63 | |
64 # making libjvm_db | |
65 | |
66 INCLS = $(GENERATED)/incls | |
67 | |
68 # Use mapfile with libjvm_db.so | |
69 LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db | |
70 LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) | |
71 | |
72 # Use mapfile with libjvm_dtrace.so | |
73 LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace | |
74 LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) | |
75 | |
76 ifdef USE_GCC | |
77 LFLAGS_JVM_DB += -D_REENTRANT $(PICFLAG) | |
78 LFLAGS_JVM_DTRACE += -D_REENTRANT $(PICFLAG) | |
79 else | |
80 LFLAGS_JVM_DB += -mt $(PICFLAG) -xnolib | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
81 LFLAGS_JVM_DTRACE += -mt $(PICFLAG) -xnolib -ldl |
0 | 82 endif |
83 | |
84 ISA = $(subst i386,i486,$(shell isainfo -n)) | |
85 | |
86 # Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so | |
87 ifneq ("${ISA}","${BUILDARCH}") | |
88 | |
89 XLIBJVM_DB = 64/$(LIBJVM_DB) | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
90 XLIBJVM_DB_G = 64/$(LIBJVM_DB_G) |
0 | 91 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
92 XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G) |
0 | 93 |
94 $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) | |
95 @echo Making $@ | |
96 $(QUIETLY) mkdir -p 64/ ; \ | |
433
c1345e85f901
6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents:
196
diff
changeset
|
97 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ |
0 | 98 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
99 [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
100 |
0 | 101 $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
102 @echo Making $@ | |
103 $(QUIETLY) mkdir -p 64/ ; \ | |
433
c1345e85f901
6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents:
196
diff
changeset
|
104 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ |
0 | 105 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
106 [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
107 |
0 | 108 endif # ifneq ("${ISA}","${BUILDARCH}") |
109 | |
110 ifdef USE_GCC | |
111 LFLAGS_GENOFFS += -D_REENTRANT | |
112 else | |
113 LFLAGS_GENOFFS += -mt -xnolib -norunpath | |
114 endif | |
115 | |
116 lib$(GENOFFS).so: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ | |
117 $(INCLS)/_vmStructs.cpp.incl $(LIBJVM.o) | |
118 $(QUIETLY) $(CCC) $(CPPFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ | |
119 $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -lc | |
120 | |
121 $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so | |
122 $(QUIETLY) $(LINK.CC) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ | |
123 ./lib$(GENOFFS).so | |
124 | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
125 CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
126 cmp -s $@ $@.tmp; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
127 case $$? in \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
128 0) rm -f $@.tmp;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
129 *) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
130 esac |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
131 |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
132 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. |
0 | 133 $(JVMOFFS).h: $(GENOFFS) |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
134 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
135 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 136 |
137 $(JVMOFFS)Index.h: $(GENOFFS) | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
138 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
139 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 140 |
141 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
142 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
143 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 144 |
145 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp | |
146 $(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp | |
147 | |
148 $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) | |
149 @echo Making $@ | |
150 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ | |
151 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
152 [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } |
0 | 153 |
154 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) | |
155 @echo Making $@ | |
156 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ | |
157 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
158 [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } |
0 | 159 |
160 $(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ | |
161 $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d | |
162 $(QUIETLY) cat $^ > $@ | |
163 | |
164 # Dtrace is available, so we build $(DTRACE.o) | |
165 $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) | |
166 @echo Compiling $(DTRACE).d | |
167 | |
168 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE).d \ | |
169 $(DTraced_Files) ||\ | |
170 STATUS=$$?;\ | |
171 if [ x"$$STATUS" = x"1" -a \ | |
172 x`uname -r` = x"5.10" -a \ | |
173 x`uname -p` = x"sparc" ]; then\ | |
174 echo "*****************************************************************";\ | |
175 echo "* If you are building server compiler, and the error message is ";\ | |
176 echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ | |
177 echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ | |
178 echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ | |
179 echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ | |
180 echo "* dtrace probes for this build.";\ | |
181 echo "*****************************************************************";\ | |
182 fi;\ | |
183 exit $$STATUS | |
184 # Since some DTraced_Files are in LIBJVM.o and they are touched by this | |
185 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will | |
186 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* | |
187 # files, but it doesn't, so we touch the necessary files to prevent later | |
188 # recompilation. Note: we only touch the necessary files if they already | |
189 # exist in order to close a race where an empty file can be created | |
190 # before the real build rule is executed. | |
191 # But, we can't touch the *.h files: This rule depends | |
192 # on them, and that would cause an infinite cycle of rebuilding. | |
193 # Neither the *.h or *.ccp files need to be touched, since they have | |
194 # rules which do not update them when the generator file has not | |
195 # changed their contents. | |
196 $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi | |
197 $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi | |
198 $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi | |
199 | |
200 .PHONY: dtraceCheck | |
201 | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
202 SYSTEM_DTRACE_H = /usr/include/dtrace.h |
0 | 203 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace |
204 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace | |
205 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) | |
206 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
207 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
208 |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
209 ifneq ("$(systemDtraceHdrFound)", "") |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
210 CFLAGS += -DHAVE_DTRACE_H |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
211 endif |
0 | 212 |
213 ifneq ("$(patchDtraceFound)", "") | |
214 DTRACE_PROG=$(PATCH_DTRACE_PROG) | |
215 DTRACE_INCL=-I/opt/SUNWdtrd/include | |
216 else | |
217 ifneq ("$(systemDtraceFound)", "") | |
218 DTRACE_PROG=$(SYSTEM_DTRACE_PROG) | |
219 else | |
220 | |
221 endif # ifneq ("$(systemDtraceFound)", "") | |
222 endif # ifneq ("$(patchDtraceFound)", "") | |
223 | |
224 ifneq ("${DTRACE_PROG}", "") | |
225 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
226 | |
227 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) | |
228 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED | |
229 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) | |
230 | |
231 dtraceCheck: | |
232 | |
233 else # manually disabled | |
234 | |
235 dtraceCheck: | |
236 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" | |
237 | |
238 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
239 | |
240 else # No dtrace program found | |
241 | |
242 dtraceCheck: | |
243 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" | |
244 | |
245 endif # ifneq ("${dtraceFound}", "") | |
246 | |
247 endif # ifdef USE_GCC | |
248 | |
249 else # KERNEL build | |
250 | |
251 dtraceCheck: | |
252 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds" | |
253 | |
254 endif # ifneq ("${TYPE}", "KERNEL") | |
255 | |
256 else # CORE build | |
257 | |
258 dtraceCheck: | |
259 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" | |
260 | |
261 endif # ifneq ("${TYPE}", "CORE") |