Mercurial > hg > graal-jvmci-8
comparison make/bsd/makefiles/dtrace.make @ 4006:436b4a3231bf
7098194: integrate macosx-port changes
Summary: Integrate bsd-port/hotspot and macosx-port/hotspot changes as of 2011.09.29.
Reviewed-by: kvn, dholmes, never, phh
Contributed-by: Christos Zoulas <christos@zoulas.com>, Greg Lewis <glewis@eyesbeyond.com>, Kurt Miller <kurt@intricatesoftware.com>, Alexander Strange <astrange@apple.com>, Mike Swingler <swingler@apple.com>, Roger Hoover <rhoover@apple.com>, Victor Hernandez <vhernandez@apple.com>, Pratik Solanki <psolanki@apple.com>
author | dcubed |
---|---|
date | Thu, 13 Oct 2011 09:35:42 -0700 |
parents | f08d439fab8c |
children | 719f7007c8e8 |
comparison
equal
deleted
inserted
replaced
4005:2ef3386478e6 | 4006:436b4a3231bf |
---|---|
1 # | 1 # |
2 # Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. | 2 # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 # | 4 # |
5 # This code is free software; you can redistribute it and/or modify it | 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 | 6 # under the terms of the GNU General Public License version 2 only, as |
7 # published by the Free Software Foundation. | 7 # published by the Free Software Foundation. |
20 # or visit www.oracle.com if you need additional information or have any | 20 # or visit www.oracle.com if you need additional information or have any |
21 # questions. | 21 # questions. |
22 # | 22 # |
23 # | 23 # |
24 | 24 |
25 # Bsd does not build jvm_db | 25 # Rules to build jvm_db/dtrace, used by vm.make |
26 LIBJVM_DB = | 26 |
27 | 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 ifeq ($(OS_VENDOR), Darwin) | |
34 # we build dtrace for macosx using USDT2 probes | |
35 | |
36 DtraceOutDir = $(GENERATED)/dtracefiles | |
37 | |
38 # Bsd does not build libjvm_db, does not compile on macosx | |
39 # disabled in build: rule in vm.make | |
40 JVM_DB = libjvm_db | |
41 #LIBJVM_DB = libjvm_db.dylib | |
42 LIBJVM_DB = libjvm$(G_SUFFIX)_db.dylib | |
43 | |
44 JVM_DTRACE = jvm_dtrace | |
45 #LIBJVM_DTRACE = libjvm_dtrace.dylib | |
46 LIBJVM_DTRACE = libjvm$(G_SUFFIX)_dtrace.dylib | |
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 = -D_LP64 | |
62 endif | |
63 | |
64 # making libjvm_db | |
65 | |
66 # Use mapfile with libjvm_db.so | |
67 LIBJVM_DB_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_db | |
68 #LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) | |
69 | |
70 # Use mapfile with libjvm_dtrace.so | |
71 LIBJVM_DTRACE_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace | |
72 #LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) | |
73 | |
74 LFLAGS_JVM_DB += $(PICFLAG) # -D_REENTRANT | |
75 LFLAGS_JVM_DTRACE += $(PICFLAG) # -D_REENTRANT | |
76 | |
77 ISA = $(subst i386,i486,$(BUILDARCH)) | |
78 | |
79 # Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so | |
80 ifneq ("${ISA}","${BUILDARCH}") | |
81 | |
82 XLIBJVM_DB = 64/$(LIBJVM_DB) | |
83 XLIBJVM_DB_G = 64/$(LIBJVM_DB_G) | |
84 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) | |
85 XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G) | |
86 XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) | |
87 | |
88 $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) | |
89 @echo Making $@ | |
90 $(QUIETLY) mkdir -p 64/ ; \ | |
91 $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \ | |
92 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc | |
93 # [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } | |
94 | |
95 $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) | |
96 @echo Making $@ | |
97 $(QUIETLY) mkdir -p 64/ ; \ | |
98 $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \ | |
99 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor | |
100 # [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } | |
101 | |
102 endif # ifneq ("${ISA}","${BUILDARCH}") | |
103 | |
104 LFLAGS_GENOFFS += -L. | |
105 | |
106 lib$(GENOFFS).dylib: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ | |
107 $(LIBJVM.o) | |
108 $(QUIETLY) $(CCC) $(CPPFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ | |
109 $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -ljvm | |
110 | |
111 $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).dylib | |
112 $(QUIETLY) $(LINK.CC) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ | |
113 ./lib$(GENOFFS).dylib | |
114 | |
115 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. | |
116 $(JVMOFFS).h: $(GENOFFS) | |
117 $(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp; touch $@; \ | |
118 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ | |
119 then rm -f $@; mv $@.tmp $@; \ | |
120 else rm -f $@.tmp; \ | |
121 fi | |
122 | |
123 $(JVMOFFS)Index.h: $(GENOFFS) | |
124 $(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp; touch $@; \ | |
125 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ | |
126 then rm -f $@; mv $@.tmp $@; \ | |
127 else rm -f $@.tmp; \ | |
128 fi | |
129 | |
130 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h | |
131 $(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp; touch $@; \ | |
132 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ | |
133 then rm -f $@; mv $@.tmp $@; \ | |
134 else rm -f $@.tmp; \ | |
135 fi | |
136 | |
137 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp | |
138 $(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp | |
139 | |
140 $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) | |
141 @echo Making $@ | |
142 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ | |
143 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc | |
144 # [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } | |
145 | |
146 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) | |
147 @echo Making $@ | |
148 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ | |
149 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor | |
150 # [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } | |
151 | |
152 #$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ | |
153 # $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d | |
154 # $(QUIETLY) cat $^ > $@ | |
155 | |
156 $(DtraceOutDir): | |
157 mkdir $(DtraceOutDir) | |
158 | |
159 $(DtraceOutDir)/hotspot.h: $(DTRACE_SRCDIR)/hotspot.d | $(DtraceOutDir) | |
160 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot.d | |
161 | |
162 $(DtraceOutDir)/hotspot_jni.h: $(DTRACE_SRCDIR)/hotspot_jni.d | $(DtraceOutDir) | |
163 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot_jni.d | |
164 | |
165 $(DtraceOutDir)/hs_private.h: $(DTRACE_SRCDIR)/hs_private.d | $(DtraceOutDir) | |
166 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hs_private.d | |
167 | |
168 $(DtraceOutDir)/jhelper.h: $(DTRACE_SRCDIR)/jhelper.d $(JVMOFFS).o | $(DtraceOutDir) | |
169 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/jhelper.d | |
170 | |
171 # jhelper currently disabled | |
172 dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h | |
173 | |
174 DTraced_Files = ciEnv.o \ | |
175 classLoadingService.o \ | |
176 compileBroker.o \ | |
177 hashtable.o \ | |
178 instanceKlass.o \ | |
179 java.o \ | |
180 jni.o \ | |
181 jvm.o \ | |
182 memoryManager.o \ | |
183 nmethod.o \ | |
184 objectMonitor.o \ | |
185 runtimeService.o \ | |
186 sharedRuntime.o \ | |
187 synchronizer.o \ | |
188 thread.o \ | |
189 unsafe.o \ | |
190 vmThread.o \ | |
191 vmCMSOperations.o \ | |
192 vmPSOperations.o \ | |
193 vmGCOperations.o \ | |
194 | |
195 # Dtrace is available, so we build $(DTRACE.o) | |
196 #$(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) | |
197 # @echo Compiling $(DTRACE).d | |
198 | |
199 # $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ | |
200 # $(DTraced_Files) ||\ | |
201 # STATUS=$$?;\ | |
202 # if [ x"$$STATUS" = x"1" -a \ | |
203 # x`uname -r` = x"5.10" -a \ | |
204 # x`uname -p` = x"sparc" ]; then\ | |
205 # echo "*****************************************************************";\ | |
206 # echo "* If you are building server compiler, and the error message is ";\ | |
207 # echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ | |
208 # echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ | |
209 # echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ | |
210 # echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ | |
211 # echo "* dtrace probes for this build.";\ | |
212 # echo "*****************************************************************";\ | |
213 # fi;\ | |
214 # exit $$STATUS | |
215 # Since some DTraced_Files are in LIBJVM.o and they are touched by this | |
216 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will | |
217 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* | |
218 # files, but it doesn't, so we touch the necessary files to prevent later | |
219 # recompilation. Note: we only touch the necessary files if they already | |
220 # exist in order to close a race where an empty file can be created | |
221 # before the real build rule is executed. | |
222 # But, we can't touch the *.h files: This rule depends | |
223 # on them, and that would cause an infinite cycle of rebuilding. | |
224 # Neither the *.h or *.ccp files need to be touched, since they have | |
225 # rules which do not update them when the generator file has not | |
226 # changed their contents. | |
227 # $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi | |
228 # $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi | |
229 # $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi | |
230 | |
231 .PHONY: dtraceCheck | |
232 | |
233 #SYSTEM_DTRACE_H = /usr/include/dtrace.h | |
234 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace | |
235 #PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace | |
236 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) | |
237 #patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) | |
238 #systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) | |
239 | |
240 #ifneq ("$(systemDtraceHdrFound)", "") | |
241 #CFLAGS += -DHAVE_DTRACE_H | |
242 #endif | |
243 | |
244 #ifneq ("$(patchDtraceFound)", "") | |
245 #DTRACE_PROG=$(PATCH_DTRACE_PROG) | |
246 #DTRACE_INCL=-I/opt/SUNWdtrd/include | |
247 #else | |
248 ifneq ("$(systemDtraceFound)", "") | |
249 DTRACE_PROG=$(SYSTEM_DTRACE_PROG) | |
250 else | |
251 | |
252 endif # ifneq ("$(systemDtraceFound)", "") | |
253 #endif # ifneq ("$(patchDtraceFound)", "") | |
254 | |
255 ifneq ("${DTRACE_PROG}", "") | |
256 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
257 | |
258 DTRACE_OBJS = $(DTRACE.o) #$(JVMOFFS.o) | |
259 CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL) | |
260 #clangCFLAGS += -DDTRACE_ENABLED -fno-optimize-sibling-calls | |
261 #MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) | |
262 | |
263 | |
264 dtraceCheck: | |
265 | |
266 dtrace_stuff: dtrace_gen_headers | |
267 $(QUIETLY) echo "dtrace headers generated" | |
268 | |
269 | |
270 else # manually disabled | |
271 | |
272 dtraceCheck: | |
273 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" | |
274 | |
275 dtrace_stuff: | |
276 | |
277 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
278 | |
279 else # No dtrace program found | |
280 | |
281 dtraceCheck: | |
282 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" | |
283 | |
284 dtrace_stuff: | |
285 | |
286 endif # ifneq ("${dtraceFound}", "") | |
287 | |
288 endif # ifeq ($(OS_VENDOR), Darwin) | |
289 | |
290 | |
291 else # KERNEL build | |
292 | |
293 dtraceCheck: | |
294 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds" | |
295 | |
296 endif # ifneq ("${TYPE}", "KERNEL") | |
297 | |
298 else # CORE build | |
299 | |
300 dtraceCheck: | |
301 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" | |
302 | |
303 endif # ifneq ("${TYPE}", "CORE") |