1 #
2 # Copyright (c) 2011, 2014, 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. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
202
203 ##################################################################################################
204
205 # In the old makefiles, j2dbench was not compiled.
206 #$(eval $(call SetupDemo,J2DBench, java2d, /src, , j2dbench/J2DBench))
207
208 # JVMTI demos are a bit strange and share some files, but be careful the
209 # shared files are just the *.c and *.h files, not the README or sample
210 # makefiles. So we always exclude the README.txt and sample.makefile.txt
211 # from the extra sources.
212 define SetupJVMTIDemo
213 # Param 1 = Name of the demo
214 # Param 2 = add these directories to the includes, default is agent_util
215 # Param 3 = extra CFLAGS
216 # Param 4 = C or C++ (defaults to C)
217 # Param 5 = libs for unix
218 # Param 6 = libs for windows
219 # Param 7 = libs for solaris
220 # Param 8 = libs for linux
221 # Param 9 = extra directories with required sources
222 BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
223 $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
224 $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
225 $9
226 BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \
227 $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \
228 $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2))
229 BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
230 BUILD_DEMO_JVMTI_$1_LANG := C
231 ifneq (, $4)
232 BUILD_DEMO_JVMTI_$1_LANG := $4
233 endif
234 ifeq (C++, $4)
235 $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX)
236 endif
237
238 $1_CXXFLAGS := $(CXXFLAGS_JDKLIB) -I$(DEMO_SHARE_SRC)/jvmti/$1 \
239 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
240 $(CXXFLAGS_DEBUG_SYMBOLS)
241 ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH), waiters-sparc)
242 $1_FILTER := -xregs=no%appl
243 $1_CXXFLAGS := $$(filter-out $$($1_FILTER), $$($1_CXXFLAGS))
244 endif
245
246 # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
247 # eval call below, the comma gets expanded too early.
248 BUILD_DEMO_JVMTI_$1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
249 -I$(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
250
251 # Remove the -incremental:no setting to get .ilk-files like in the old build.
252 $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \
253 SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
254 LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
255 OPTIMIZATION := LOW, \
256 CXXFLAGS := $$($1_CXXFLAGS), \
257 LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
258 LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
259 LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
260 LDFLAGS_SUFFIX_unix := $5, \
261 LDFLAGS_SUFFIX_windows := $6, \
262 LDFLAGS_SUFFIX_solaris := $7 -lc, \
263 LDFLAGS_SUFFIX_linux := $8, \
264 VERSIONINFO_RESOURCE := $(VERSION_INFO_RESOURCE), \
265 RC_FLAGS := $$(RC_FLAGS) \
266 -D "JDK_FNAME=$1.dll" \
267 -D "JDK_INTERNAL_NAME=$1" \
268 -D "JDK_FTYPE=0x2L", \
269 OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1, \
270 OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib, \
271 LIBRARY := $1))
272
273 $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
274 SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
275 EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
276 ZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip))
293 endif
294
295 BUILD_DEMOS += $$(BUILD_DEMO_JVMTI_$1) \
296 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip \
297 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt
298
299 ifeq ($(OPENJDK_TARGET_OS), windows)
300 # These files normally end up in OBJECT_DIR but for demos they
301 # are supposed to be included in the distro.
302 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
303 $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.lib $$@
304
305 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
306 $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.exp $$@
307
308 BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib \
309 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp
310 endif
311 endef
312
313 $(eval $(call SetupJVMTIDemo,compiledMethodLoad, agent_util))
314 $(eval $(call SetupJVMTIDemo,gctest, agent_util))
315 $(eval $(call SetupJVMTIDemo,heapTracker, agent_util java_crw_demo))
316 $(eval $(call SetupJVMTIDemo,heapViewer, agent_util))
317 $(eval $(call SetupJVMTIDemo,minst, agent_util java_crw_demo))
318 $(eval $(call SetupJVMTIDemo,mtrace, agent_util java_crw_demo))
319 $(eval $(call SetupJVMTIDemo,waiters, agent_util, , C++))
320 $(eval $(call SetupJVMTIDemo,versionCheck, agent_util))
321
322 ##################################################################################################
323
324 $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
325 $(call install-file)
326 $(CHMOD) -f ug+w $@
327
328 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
329 $(call install-file)
330 $(CHMOD) -f ug+w $@
331
332 BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html \
333 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html
334
335 ##################################################################################################
336
337 # The netbeans project files are copied into the demo directory.
338 ifeq ($(OPENJDK_TARGET_OS), solaris)
339 BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
|
1 #
2 # Copyright (c) 2011, 2015, 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. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
202
203 ##################################################################################################
204
205 # In the old makefiles, j2dbench was not compiled.
206 #$(eval $(call SetupDemo,J2DBench, java2d, /src, , j2dbench/J2DBench))
207
208 # JVMTI demos are a bit strange and share some files, but be careful the
209 # shared files are just the *.c and *.h files, not the README or sample
210 # makefiles. So we always exclude the README.txt and sample.makefile.txt
211 # from the extra sources.
212 define SetupJVMTIDemo
213 # Param 1 = Name of the demo
214 # Param 2 = add these directories to the includes, default is agent_util
215 # Param 3 = extra CFLAGS
216 # Param 4 = C or C++ (defaults to C)
217 # Param 5 = libs for unix
218 # Param 6 = libs for windows
219 # Param 7 = libs for solaris
220 # Param 8 = libs for linux
221 # Param 9 = extra directories with required sources
222 # Param 10 = DISABLED_WARNINGS_gcc
223 # Param 11 = DISABLED_WARNINGS_microsoft
224 # Param 12 = DISABLED_WARNINGS_clang
225 BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
226 $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
227 $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
228 $9
229 BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \
230 $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \
231 $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2))
232 BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
233 BUILD_DEMO_JVMTI_$1_LANG := C
234 ifneq (, $4)
235 BUILD_DEMO_JVMTI_$1_LANG := $4
236 endif
237 ifeq (C++, $4)
238 $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX)
239 endif
240
241 $1_CXXFLAGS := $(CXXFLAGS_JDKLIB) -I$(DEMO_SHARE_SRC)/jvmti/$1 \
242 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
243 $(CXXFLAGS_DEBUG_SYMBOLS)
244 ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH), waiters-sparc)
245 $1_FILTER := -xregs=no%appl
246 $1_CXXFLAGS := $$(filter-out $$($1_FILTER), $$($1_CXXFLAGS))
247 endif
248
249 # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
250 # eval call below, the comma gets expanded too early.
251 BUILD_DEMO_JVMTI_$1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
252 -I$(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
253
254 # Remove the -incremental:no setting to get .ilk-files like in the old build.
255 $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \
256 SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
257 LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
258 OPTIMIZATION := LOW, \
259 CXXFLAGS := $$($1_CXXFLAGS), \
260 DISABLED_WARNINGS_gcc := $(10), \
261 DISABLED_WARNINGS_clang := $(12), \
262 DISABLED_WARNINGS_microsoft := $(11), \
263 LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
264 LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
265 LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
266 LDFLAGS_SUFFIX_unix := $5, \
267 LDFLAGS_SUFFIX_windows := $6, \
268 LDFLAGS_SUFFIX_solaris := $7 -lc, \
269 LDFLAGS_SUFFIX_linux := $8, \
270 VERSIONINFO_RESOURCE := $(VERSION_INFO_RESOURCE), \
271 RC_FLAGS := $$(RC_FLAGS) \
272 -D "JDK_FNAME=$1.dll" \
273 -D "JDK_INTERNAL_NAME=$1" \
274 -D "JDK_FTYPE=0x2L", \
275 OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1, \
276 OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib, \
277 LIBRARY := $1))
278
279 $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
280 SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
281 EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
282 ZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip))
299 endif
300
301 BUILD_DEMOS += $$(BUILD_DEMO_JVMTI_$1) \
302 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip \
303 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt
304
305 ifeq ($(OPENJDK_TARGET_OS), windows)
306 # These files normally end up in OBJECT_DIR but for demos they
307 # are supposed to be included in the distro.
308 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
309 $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.lib $$@
310
311 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
312 $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.exp $$@
313
314 BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib \
315 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp
316 endif
317 endef
318
319 $(eval $(call SetupJVMTIDemo,compiledMethodLoad, agent_util, , , , , , , , pointer-to-int-cast format, , format))
320 $(eval $(call SetupJVMTIDemo,gctest, agent_util))
321 $(eval $(call SetupJVMTIDemo,heapTracker, agent_util java_crw_demo))
322 $(eval $(call SetupJVMTIDemo,heapViewer, agent_util))
323 $(eval $(call SetupJVMTIDemo,minst, agent_util java_crw_demo))
324 $(eval $(call SetupJVMTIDemo,mtrace, agent_util java_crw_demo))
325 $(eval $(call SetupJVMTIDemo,waiters, agent_util, , C++, , , , , , , 4101))
326 $(eval $(call SetupJVMTIDemo,versionCheck, agent_util))
327
328 ##################################################################################################
329
330 $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
331 $(call install-file)
332 $(CHMOD) -f ug+w $@
333
334 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
335 $(call install-file)
336 $(CHMOD) -f ug+w $@
337
338 BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html \
339 $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html
340
341 ##################################################################################################
342
343 # The netbeans project files are copied into the demo directory.
344 ifeq ($(OPENJDK_TARGET_OS), solaris)
345 BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
|