1 #
   2 # Copyright (c) 2007, 2008, 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
  23 # questions.
  24 #
  25 
  26 ########################################################################
  27 
  28 # Definitions for openjdk plugs (used by both import and export)
  29 
  30 # Names of native shared libraries
  31 
  32 PLUG_LIBRARY_NAMES=
  33 
  34 # Sub-directory where native shared libraries are located (e.g. jre/bin or...)
  35 
  36 PLUG_LOCATION_SUBDIR=$(ARCH_VM_SUBDIR)
  37 
  38 # Explicit classfile lists
  39 
  40 # WARNING: These classlists will not work with pattern rules, only used in 
  41 #          shell commands.
  42 #          The \$$ patterns will fail in pattern rules, which want $$, 
  43 #          but the $$ fails in shell commands. 
  44 #          The shell commands are more important.
  45 #          Also, the $1 pattern in these names causes problems with the 
  46 #          GNU make define feature, so you can't use these in define's.
  47 
  48 PLUG_JMF_CLASS_NAMES = \
  49 com/sun/jmx/snmp/SnmpDataTypeEnums.class \
  50 com/sun/jmx/snmp/SnmpDefinitions.class \
  51 com/sun/jmx/snmp/SnmpOid.class \
  52 com/sun/jmx/snmp/SnmpOidDatabase.class \
  53 com/sun/jmx/snmp/SnmpOidDatabaseSupport.class \
  54 com/sun/jmx/snmp/SnmpOidRecord.class \
  55 com/sun/jmx/snmp/SnmpOidTable.class \
  56 com/sun/jmx/snmp/SnmpOidTableSupport.class \
  57 com/sun/jmx/snmp/SnmpParameters.class \
  58 com/sun/jmx/snmp/SnmpPduPacket.class \
  59 com/sun/jmx/snmp/SnmpPeer.class \
  60 com/sun/jmx/snmp/SnmpTimeticks.class \
  61 com/sun/jmx/snmp/SnmpVarBind.class \
  62 com/sun/jmx/snmp/SnmpVarBindList.class \
  63 com/sun/jmx/snmp/Timestamp.class \
  64 com/sun/jmx/snmp/daemon/SendQ.class \
  65 com/sun/jmx/snmp/daemon/SnmpInformRequest.class \
  66 com/sun/jmx/snmp/daemon/SnmpQManager.class \
  67 com/sun/jmx/snmp/daemon/SnmpRequestCounter.class \
  68 com/sun/jmx/snmp/daemon/SnmpResponseHandler.class \
  69 com/sun/jmx/snmp/daemon/SnmpSendServer.class \
  70 com/sun/jmx/snmp/daemon/SnmpSession.class \
  71 com/sun/jmx/snmp/daemon/SnmpSocket.class \
  72 com/sun/jmx/snmp/daemon/SnmpTimerServer.class \
  73 com/sun/jmx/snmp/daemon/WaitQ.class
  74 
  75 # Class list temp files (used by both import and export of plugs)
  76 
  77 PLUG_TEMPDIR=$(ABS_TEMPDIR)/plugs
  78 PLUG_CLASS_AREAS = jmf
  79 PLUG_CLISTS = $(PLUG_CLASS_AREAS:%=$(PLUG_TEMPDIR)/%.clist)
  80 
  81 # Create jargs file command
  82 
  83 define plug-create-jargs
  84 @$(prep-target)
  85 $(SED) -e "s@^@-C $(CLASSDESTDIR) @" $< > $@
  86 endef # plug-create-clist-jargs
  87 
  88 # Create clist (class name list) and jargs file (input to jar)
  89 #   Need these files to avoid long command lines which fail on some systems.
  90 
  91 $(PLUG_TEMPDIR)/jmf.clist:
  92         @$(prep-target)
  93         @for i in $(PLUG_JMF_CLASS_NAMES) ; do \
  94           $(ECHO) "$$i" >> $@; \
  95         done
  96 $(PLUG_TEMPDIR)/all.clist: $(PLUG_CLISTS)
  97         @$(prep-target)
  98         $(CAT) $(PLUG_CLISTS) > $@
  99 $(PLUG_TEMPDIR)/jmf.jargs: $(PLUG_TEMPDIR)/jmf.clist
 100         $(plug-create-jargs)
 101 $(PLUG_TEMPDIR)/all.jargs: $(PLUG_TEMPDIR)/all.clist
 102         $(plug-create-jargs)
 103 
 104 #
 105 # Specific to OPENJDK import of binary plugs
 106 #
 107 
 108 ifdef OPENJDK
 109 
 110 # Import 
 111 
 112 PLUG_IMPORT_DIR=$(BINARY_PLUGS_PATH)
 113 PLUG_IMPORT_JARFILE=$(BINARY_PLUGS_JARFILE)
 114 
 115 # Import file command
 116 
 117 define import-binary-plug-file
 118 @$(ECHO) "PLUG IMPORT: $(@F)"
 119 $(install-non-module-file)
 120 endef # import-binary-plug-file
 121 
 122 # Import classes command
 123 
 124 define import-binary-plug-classes
 125 @$(MKDIR) -p $(CLASSDESTDIR)
 126 @$(CAT) $1 | $(SED) -e 's/^/PLUG IMPORT: /'
 127 ($(CD) $(CLASSDESTDIR) && $(BOOT_JAR_CMD) xf $(PLUG_IMPORT_JARFILE) @$1 $(BOOT_JAR_JFLAGS) )
 128 ($(CD) $(CLASSDESTDIR) && $(java-vm-cleanup) )
 129 endef # import-binary-plug-classes
 130 
 131 # Import specific area classes (the classes are always created)
 132 
 133 import-binary-plug-jmf-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/jmf.clist
 134         $(call import-binary-plug-classes,$(PLUG_TEMPDIR)/jmf.clist)
 135 
 136 # Import all classes from the jar file
 137 
 138 import-binary-plug-jar: \
 139              import-binary-plug-jmf-classes
 140 
 141 # Binary plug start/complete messages
 142 
 143 import-binary-plugs-started:
 144         @$(ECHO) "BinaryPlugs import started: `date`"
 145         @$(ECHO) "BINARY_PLUGS_PATH=$(BINARY_PLUGS_PATH)"
 146 import-binary-plugs-completed:
 147         @$(ECHO) "BinaryPlugs import completed: `date`"
 148 
 149 # Import lib files (only if they don't exist already)
 150 
 151 import-binary-plugs-libs: \
 152     $(PLUG_LIBRARY_NAMES:%=$(LIB_LOCATION)/%)
 153 
 154 # Import everything
 155 
 156 import-binary-plugs: \
 157     import-binary-plugs-started \
 158     import-binary-plugs-libs \
 159     import-binary-plug-jar \
 160     import-binary-plugs-completed
 161 
 162 # All these targets are phony (no filenames)
 163 
 164 .PHONY: import-binary-plugs-started  \
 165         import-binary-plugs-completed \
 166         import-binary-plugs-libs \
 167         import-binary-plugs \
 168         import-binary-plug-jar \
 169         import-binary-plug-jmf-classes
 170 
 171 else # !OPENJDK
 172 
 173 #
 174 # Specific to exporting binary plugs for OPENJDK (e.g. OPENJDK is NOT defined)
 175 #
 176 
 177 # Export names (See make/common/Defs.gmk for BINARY_PLUGS_JARNAME definition)
 178 
 179 PLUG_EXPORT_DIRNAME=openjdk-binary-plugs-image
 180 PLUG_EXPORT_DIR=$(OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)
 181 PLUG_EXPORT_JARFILE=$(PLUG_EXPORT_DIR)/jre/lib/$(BINARY_PLUGS_JARNAME)
 182 
 183 # Export file command
 184 
 185 define export-binary-plug-file
 186 @$(ECHO) "PLUG EXPORT: $(@F)"
 187 $(install-non-module-file)
 188 endef # export-binary-plug-file
 189 
 190 # OpenJDK Binary Plug License
 191 
 192 $(PLUG_EXPORT_DIR)/LICENSE: $(CLOSED_SHARE_SRC)/doc/openjdk/binary-plugs/LICENSE
 193         $(export-binary-plug-file)
 194 export-binary-plugs-license: $(PLUG_EXPORT_DIR)/LICENSE
 195 
 196 # Create jar file of plug classes (always created)
 197 
 198 $(PLUG_EXPORT_JARFILE): $(PLUG_TEMPDIR)/all.clist $(PLUG_TEMPDIR)/all.jargs
 199         @$(prep-target)
 200         @$(ECHO) "PLUG EXPORT: $(@F)"
 201         @$(CAT) $(PLUG_TEMPDIR)/all.clist | $(SED) -e 's/^/PLUG EXPORT: /'
 202         $(BOOT_JAR_CMD) cf $@ @$(PLUG_TEMPDIR)/all.jargs $(BOOT_JAR_JFLAGS)
 203         @$(java-vm-cleanup)
 204 export-binary-plugs-jar: $(PLUG_EXPORT_JARFILE)
 205 
 206 # Export binary plug start/complete messages
 207 
 208 export-binary-plugs-started:
 209         @$(ECHO) "BinaryPlugs export started: `date`"
 210         @$(ECHO) "PLUG_EXPORT_DIR=$(PLUG_EXPORT_DIR)"
 211         $(RM) -r $(PLUG_EXPORT_DIR)
 212         @$(MKDIR) -p $(PLUG_EXPORT_DIR)
 213         @$(MKDIR) -p $(PLUG_TEMPDIR)
 214 export-binary-plugs-completed:
 215         @$(RM) -r $(PLUG_TEMPDIR)
 216         @$(ECHO) "BinaryPlugs export completed: `date`"
 217 
 218 # Export lib files (only if they don't exist already)
 219 
 220 export-binary-plugs-libs: \
 221     $(PLUG_LIBRARY_NAMES:%=$(PLUG_EXPORT_DIR)/$(PLUG_LOCATION_SUBDIR)/%)
 222 
 223 # Export everything
 224 
 225 export-binary-plugs: \
 226     export-binary-plugs-started \
 227     export-binary-plugs-libs \
 228     export-binary-plugs-license \
 229     export-binary-plugs-jar \
 230     export-binary-plugs-completed
 231 
 232 # All these targets are phony (no filenames)
 233 
 234 .PHONY: export-binary-plugs-started \
 235         export-binary-plugs-license \
 236         export-binary-plugs-jar \
 237         export-binary-plugs-libs \
 238         export-binary-plugs-completed \
 239         export-binary-plugs
 240 
 241 # Rules that test the export and import of plugs (only when you can export)
 242 
 243 TEST_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-testing-plugs
 244 TEST_PLUG_COPY=$(TEST_OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)-testcopy
 245 
 246 # Run export-binary-plugs first, then use this rule to test an import
 247 
 248 test-binary-plugs: $(TEST_PLUG_COPY)
 249         $(RM) -r $(TEST_OUTPUTDIR)/$(PLUG_EXPORT_DIRNAME)
 250         $(MKDIR) -p $(TEST_OUTPUTDIR)
 251         @$(ECHO) "Testing import of plugs"
 252         ($(CD) $(JDK_TOPDIR)/make && \
 253             $(MAKE) OPENJDK=true \
 254                 ALT_OUTPUTDIR=$(TEST_OUTPUTDIR) \
 255                 ALT_JDK_IMPORT_PATH=$(JDK_IMPORT_PATH) \
 256                 ALT_BINARY_PLUGS_PATH=$(TEST_PLUG_COPY) \
 257                 import-binary-plugs )
 258         $(RM) -r $(TEST_OUTPUTDIR)
 259         @$(ECHO) "Testing of plugs was successful"
 260 
 261 $(TEST_PLUG_COPY):
 262         @$(ECHO) "Creating test plug copy"
 263         $(RM) -r $@
 264         $(MKDIR) -p $(@D)
 265         $(CP) -r -p $(PLUG_EXPORT_DIR) $@
 266 
 267 .PHONY: test-binary-plugs
 268 
 269 endif # !OPENJDK
 270