BinaryPlugs.gmk 8.3 KB
Newer Older
D
duke 已提交
1
#
X
xdono 已提交
2
# Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
# 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.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

########################################################################

# Definitions for openjdk plugs (used by both import and export)

# Names of native shared libraries

32
PLUG_LIBRARY_NAMES=
D
duke 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

# Sub-directory where native shared libraries are located (e.g. jre/bin or...)

PLUG_LOCATION_SUBDIR=$(ARCH_VM_SUBDIR)

# Explicit classfile lists

# WARNING: These classlists will not work with pattern rules, only used in 
#          shell commands.
#          The \$$ patterns will fail in pattern rules, which want $$, 
#          but the $$ fails in shell commands. 
#          The shell commands are more important.
#          Also, the $1 pattern in these names causes problems with the 
#          GNU make define feature, so you can't use these in define's.

PLUG_JMF_CLASS_NAMES = \
com/sun/jmx/snmp/SnmpDataTypeEnums.class \
com/sun/jmx/snmp/SnmpDefinitions.class \
com/sun/jmx/snmp/SnmpOid.class \
com/sun/jmx/snmp/SnmpOidDatabase.class \
com/sun/jmx/snmp/SnmpOidDatabaseSupport.class \
com/sun/jmx/snmp/SnmpOidRecord.class \
com/sun/jmx/snmp/SnmpOidTable.class \
com/sun/jmx/snmp/SnmpOidTableSupport.class \
com/sun/jmx/snmp/SnmpParameters.class \
com/sun/jmx/snmp/SnmpPduPacket.class \
com/sun/jmx/snmp/SnmpPeer.class \
com/sun/jmx/snmp/SnmpTimeticks.class \
com/sun/jmx/snmp/SnmpVarBind.class \
com/sun/jmx/snmp/SnmpVarBindList.class \
com/sun/jmx/snmp/Timestamp.class \
com/sun/jmx/snmp/daemon/SendQ.class \
com/sun/jmx/snmp/daemon/SnmpInformRequest.class \
com/sun/jmx/snmp/daemon/SnmpQManager.class \
com/sun/jmx/snmp/daemon/SnmpRequestCounter.class \
com/sun/jmx/snmp/daemon/SnmpResponseHandler.class \
com/sun/jmx/snmp/daemon/SnmpSendServer.class \
com/sun/jmx/snmp/daemon/SnmpSession.class \
com/sun/jmx/snmp/daemon/SnmpSocket.class \
com/sun/jmx/snmp/daemon/SnmpTimerServer.class \
com/sun/jmx/snmp/daemon/WaitQ.class

# Class list temp files (used by both import and export of plugs)

PLUG_TEMPDIR=$(ABS_TEMPDIR)/plugs
78
PLUG_CLASS_AREAS = jmf
D
duke 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
PLUG_CLISTS = $(PLUG_CLASS_AREAS:%=$(PLUG_TEMPDIR)/%.clist)

# Create jargs file command

define plug-create-jargs
@$(prep-target)
$(SED) -e "s@^@-C $(CLASSDESTDIR) @" $< > $@
endef # plug-create-clist-jargs

# Create clist (class name list) and jargs file (input to jar)
#   Need these files to avoid long command lines which fail on some systems.

$(PLUG_TEMPDIR)/jmf.clist:
	@$(prep-target)
	@for i in $(PLUG_JMF_CLASS_NAMES) ; do \
	  $(ECHO) "$$i" >> $@; \
	done
$(PLUG_TEMPDIR)/all.clist: $(PLUG_CLISTS)
	@$(prep-target)
	$(CAT) $(PLUG_CLISTS) > $@
$(PLUG_TEMPDIR)/jmf.jargs: $(PLUG_TEMPDIR)/jmf.clist
	$(plug-create-jargs)
$(PLUG_TEMPDIR)/all.jargs: $(PLUG_TEMPDIR)/all.clist
	$(plug-create-jargs)

#
# Specific to OPENJDK import of binary plugs
#

ifdef OPENJDK

# Import 

PLUG_IMPORT_DIR=$(BINARY_PLUGS_PATH)
PLUG_IMPORT_JARFILE=$(BINARY_PLUGS_JARFILE)

# Import file command

define import-binary-plug-file
@$(ECHO) "PLUG IMPORT: $(@F)"
119
$(install-non-module-file)
D
duke 已提交
120 121 122 123 124 125 126
endef # import-binary-plug-file

# Import classes command

define import-binary-plug-classes
@$(MKDIR) -p $(CLASSDESTDIR)
@$(CAT) $1 | $(SED) -e 's/^/PLUG IMPORT: /'
127 128
($(CD) $(CLASSDESTDIR) && $(BOOT_JAR_CMD) xf $(PLUG_IMPORT_JARFILE) @$1 $(BOOT_JAR_JFLAGS) )
($(CD) $(CLASSDESTDIR) && $(java-vm-cleanup) )
D
duke 已提交
129 130 131 132 133 134 135 136 137 138
endef # import-binary-plug-classes

# Import specific area classes (the classes are always created)

import-binary-plug-jmf-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/jmf.clist
	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/jmf.clist)

# Import all classes from the jar file

import-binary-plug-jar: \
139
	     import-binary-plug-jmf-classes
D
duke 已提交
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168

# Binary plug start/complete messages

import-binary-plugs-started:
	@$(ECHO) "BinaryPlugs import started: `date`"
	@$(ECHO) "BINARY_PLUGS_PATH=$(BINARY_PLUGS_PATH)"
import-binary-plugs-completed:
	@$(ECHO) "BinaryPlugs import completed: `date`"

# Import lib files (only if they don't exist already)

import-binary-plugs-libs: \
    $(PLUG_LIBRARY_NAMES:%=$(LIB_LOCATION)/%)

# Import everything

import-binary-plugs: \
    import-binary-plugs-started \
    import-binary-plugs-libs \
    import-binary-plug-jar \
    import-binary-plugs-completed

# All these targets are phony (no filenames)

.PHONY: import-binary-plugs-started  \
	import-binary-plugs-completed \
	import-binary-plugs-libs \
	import-binary-plugs \
	import-binary-plug-jar \
169
	import-binary-plug-jmf-classes
D
duke 已提交
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186

else # !OPENJDK

#
# Specific to exporting binary plugs for OPENJDK (e.g. OPENJDK is NOT defined)
#

# Export names (See make/common/Defs.gmk for BINARY_PLUGS_JARNAME definition)

PLUG_EXPORT_DIRNAME=openjdk-binary-plugs-image
PLUG_EXPORT_DIR=$(OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)
PLUG_EXPORT_JARFILE=$(PLUG_EXPORT_DIR)/jre/lib/$(BINARY_PLUGS_JARNAME)

# Export file command

define export-binary-plug-file
@$(ECHO) "PLUG EXPORT: $(@F)"
187
$(install-non-module-file)
D
duke 已提交
188 189 190 191 192 193 194 195 196 197 198 199 200 201
endef # export-binary-plug-file

# OpenJDK Binary Plug License

$(PLUG_EXPORT_DIR)/LICENSE: $(CLOSED_SHARE_SRC)/doc/openjdk/binary-plugs/LICENSE
	$(export-binary-plug-file)
export-binary-plugs-license: $(PLUG_EXPORT_DIR)/LICENSE

# Create jar file of plug classes (always created)

$(PLUG_EXPORT_JARFILE): $(PLUG_TEMPDIR)/all.clist $(PLUG_TEMPDIR)/all.jargs
	@$(prep-target)
	@$(ECHO) "PLUG EXPORT: $(@F)"
	@$(CAT) $(PLUG_TEMPDIR)/all.clist | $(SED) -e 's/^/PLUG EXPORT: /'
202 203
	$(BOOT_JAR_CMD) cf $@ @$(PLUG_TEMPDIR)/all.jargs $(BOOT_JAR_JFLAGS)
	@$(java-vm-cleanup)
D
duke 已提交
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
export-binary-plugs-jar: $(PLUG_EXPORT_JARFILE)

# Export binary plug start/complete messages

export-binary-plugs-started:
	@$(ECHO) "BinaryPlugs export started: `date`"
	@$(ECHO) "PLUG_EXPORT_DIR=$(PLUG_EXPORT_DIR)"
	$(RM) -r $(PLUG_EXPORT_DIR)
	@$(MKDIR) -p $(PLUG_EXPORT_DIR)
	@$(MKDIR) -p $(PLUG_TEMPDIR)
export-binary-plugs-completed:
	@$(RM) -r $(PLUG_TEMPDIR)
	@$(ECHO) "BinaryPlugs export completed: `date`"

# Export lib files (only if they don't exist already)

export-binary-plugs-libs: \
    $(PLUG_LIBRARY_NAMES:%=$(PLUG_EXPORT_DIR)/$(PLUG_LOCATION_SUBDIR)/%)

# Export everything

export-binary-plugs: \
    export-binary-plugs-started \
    export-binary-plugs-libs \
    export-binary-plugs-license \
    export-binary-plugs-jar \
    export-binary-plugs-completed

# All these targets are phony (no filenames)

.PHONY: export-binary-plugs-started \
        export-binary-plugs-license \
        export-binary-plugs-jar \
        export-binary-plugs-libs \
        export-binary-plugs-completed \
        export-binary-plugs

# Rules that test the export and import of plugs (only when you can export)

TEST_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-testing-plugs
TEST_PLUG_COPY=$(TEST_OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)-testcopy

# Run export-binary-plugs first, then use this rule to test an import

test-binary-plugs: $(TEST_PLUG_COPY)
	$(RM) -r $(TEST_OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)
	$(MKDIR) -p $(TEST_OUTPUTDIR)
	@$(ECHO) "Testing import of plugs"
	($(CD) $(JDK_TOPDIR)/make && \
	    $(MAKE) OPENJDK=true \
		ALT_OUTPUTDIR=$(TEST_OUTPUTDIR) \
		ALT_JDK_IMPORT_PATH=$(JDK_IMPORT_PATH) \
		ALT_BINARY_PLUGS_PATH=$(TEST_PLUG_COPY) \
		import-binary-plugs )
	$(RM) -r $(TEST_OUTPUTDIR)
	@$(ECHO) "Testing of plugs was successful"

$(TEST_PLUG_COPY):
	@$(ECHO) "Creating test plug copy"
	$(RM) -r $@
	$(MKDIR) -p $(@D)
	$(CP) -r -p $(PLUG_EXPORT_DIR) $@

.PHONY: test-binary-plugs

endif # !OPENJDK