7132386: makefile support for tracing/Java Flight Recorder framework phase I
authorrbackman
Tue, 17 Jan 2012 16:20:52 +0100
changeset 11678 9d22454e9dad
parent 11677 ebcf8112c872
child 11679 84da476c4537
7132386: makefile support for tracing/Java Flight Recorder framework phase I Reviewed-by: ohair, dholmes, rottenha Contributed-by: Markus Gronlund <markus.gronlund@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>
jdk/make/com/oracle/Makefile
jdk/make/com/oracle/jfr/Makefile
jdk/make/common/Defs.gmk
jdk/make/common/Release.gmk
--- a/jdk/make/com/oracle/Makefile	Tue Jan 24 09:09:08 2012 +0000
+++ b/jdk/make/com/oracle/Makefile	Tue Jan 17 16:20:52 2012 +0100
@@ -38,8 +38,14 @@
   endif
 endif
 
+JFR =
+ifndef OPENJDK
+ifndef JAVASE_EMBEDDED
+	JFR = jfr
+endif
+endif
 
-SUBDIRS = net nio util $(UCRYPTO)
+SUBDIRS = $(JFR) net nio util $(UCRYPTO)
 
 include $(BUILDDIR)/common/Subdirs.gmk
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/jfr/Makefile	Tue Jan 17 16:20:52 2012 +0100
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+BUILDDIR = ../../..
+PACKAGE = oracle.jrockit.jfr
+LIBRARY = jfr
+PRODUCT = oracle
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Use mapfile
+#
+FILES_m = $(CLOSED_SHARE_SRC)/native/oracle/jfr/mapfile-vers
+include $(BUILDDIR)/common/Mapfile-vers.gmk
+
+#
+# Files to compile
+#
+FILES_c = VMJFR.c
+
+AUTO_FILES_JAVA_DIRS = com/oracle/jrockit/jfr oracle/jrockit/jfr
+
+# Find C source files
+#
+vpath %.c $(CLOSED_SHARE_SRC)/native/oracle/jfr
+
+#
+# Library to compile.
+#
+include $(BUILDDIR)/common/Library.gmk
+
+JVMLIB =
+JAVALIB =
+OTHER_LDLIBS =
+
+clean clobber::
+	$(RM) -r $(CLASSDESTDIR)/com/oracle/jrockit/jfr
+	$(RM) -r $(CLASSDESTDIR)/oracle/jrockit/jfr
+
+
+# Copy pre-shipped .jfs files
+JFR_LIBDIR = $(LIBDIR)/jfr
+JFR_SRCDIR = $(CLOSED_SHARE_SRC)/lib/jfr
+
+$(JFR_LIBDIR)/%.jfs: $(JFR_SRCDIR)/%.jfs
+	$(install-file)
+
+JFS_FILES := $(subst $(JFR_SRCDIR),$(JFR_LIBDIR),$(wildcard $(JFR_SRCDIR)/*.jfs))
+
+all build : $(JFS_FILES)
+
--- a/jdk/make/common/Defs.gmk	Tue Jan 24 09:09:08 2012 +0000
+++ b/jdk/make/common/Defs.gmk	Tue Jan 17 16:20:52 2012 +0100
@@ -425,7 +425,12 @@
 # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
 # relatives.
 #
-VPATH.h =   $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
+VPATH0.h =   $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
+ifdef OPENJDK
+  VPATH.h = $(VPATH0.h)
+else
+  VPATH.h = $(CLOSED_SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(VPATH0.h)
+endif
 vpath %.h   $(VPATH.h)
 
 #
--- a/jdk/make/common/Release.gmk	Tue Jan 24 09:09:08 2012 +0000
+++ b/jdk/make/common/Release.gmk	Tue Jan 17 16:20:52 2012 +0100
@@ -381,6 +381,22 @@
 	sun/tools/jinfo         \
 	sun/tools/jmap
 
+# classes that go into jfr.jar
+JFR_CLASSES_DIRS= \
+	com/oracle/jrockit/jfr \
+	com/oracle/jrockit/jfr/client \
+	com/oracle/jrockit/jfr/management \
+	oracle/jrockit/jfr \
+	oracle/jrockit/jfr/events \
+	oracle/jrockit/jfr/openmbean \
+	oracle/jrockit/jfr/parser \
+	oracle/jrockit/jfr/settings \
+	oracle/jrockit/jfr/tools \
+	oracle/jrockit/jfr/util \
+	oracle/jrockit/jfr/util/log \
+	oracle/jrockit/jfr/util/os \
+	oracle/jrockit/jfr/util/text
+
 # classes that go into jsse.jar
 JSSE_CLASSES_DIRS = \
 	sun/security/provider/Sun.class \
@@ -583,6 +599,23 @@
 	$(ECHO) "sun/tools/jstack/" >> $@
 	$(ECHO) "sun/tools/jinfo/" >> $@
 	$(ECHO) "sun/tools/jmap/" >> $@
+ifndef OPENJDK
+ifndef JAVASE_EMBEDDED
+	$(ECHO) "com/oracle/jrockit/jfr/" >> $@
+	$(ECHO) "com/oracle/jrockit/jfr/client/" >> $@
+	$(ECHO) "com/oracle/jrockit/jfr/management/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/events/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/openmbean/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/parser/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/settings/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/tools/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/util/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/util/log/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/util/os/" >> $@
+	$(ECHO) "oracle/jrockit/jfr/util/text/" >> $@
+endif
+endif
 
 
 # File order list for rt.jar
@@ -607,6 +640,20 @@
 	$(MV) $@.temp $@
 	@($(CD) $(CLASSBINDIR) && $(java-vm-cleanup))
 
+# Create the jfr.jar containing Java Flight Recorder implementation
+JFR_JAR=
+ifndef OPENJDK
+ifndef JAVASE_EMBEDDED
+JFR_JAR=$(ABS_TEMPDIR)/jfr-orig.jar
+$(JFR_JAR): $(OTHER_JAR_MANIFEST_FILE)
+	$(prep-target)
+	$(CD) $(CLASSBINDIR) && \
+	    $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(OTHER_JAR_MANIFEST_FILE) $@ \
+		$(JFR_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
+	@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
+endif
+endif
+
 # Create the rt.jar file list & non-class files list
 
 JARSPLIT_JARFILE = $(BUILDTOOLJARDIR)/jarsplit.jar
@@ -741,7 +788,7 @@
 # drive names like C:
 initial-image-jre:: initial-image-jre-setup \
 		    $(JRE_DOCFILES) \
-		    $(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) \
+		    $(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) $(JFR_JAR) \
 		    $(BUILDMETAINDEX_JARFILE)
 	@# Copy in bin directory
 	$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_IMAGE_DIR)
@@ -769,6 +816,9 @@
 	$(CP) $(RT_JAR) $(JRE_IMAGE_DIR)/lib/rt.jar
 	$(CP) $(RESOURCES_JAR) $(JRE_IMAGE_DIR)/lib/resources.jar
 	$(CP) $(JSSE_JAR) $(JRE_IMAGE_DIR)/lib/jsse.jar
+ifneq ($(JFR_JAR),)
+	$(CP) $(JFR_JAR) $(JRE_IMAGE_DIR)/lib/jfr.jar
+endif
 	@# Generate meta-index to make boot and extension class loaders lazier
 	$(CD) $(JRE_IMAGE_DIR)/lib && \
 	    $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \