1 #
   2 # Copyright (c) 2003, 2010, 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 # Makefile for building RMI stubs of JMX Remote
  28 #
  29 
  30 BUILDDIR = ../../..
  31 PACKAGE = javax.management
  32 PRODUCT = sun
  33 include $(BUILDDIR)/common/Defs.gmk
  34 
  35 #
  36 # Files to compile
  37 #
  38 
  39 # NO java files to compile: already compiled in javax/management/Makefile
  40 
  41 # Note : some targets are double colon rules and some single colon rules
  42 # within common included gmk files : that is why the following for loop
  43 # has been duplicated.
  44 
  45 # When building the openjdk, no snmp
  46 ifndef OPENJDK
  47   SUBDIRS = snmp
  48 endif
  49 
  50 include $(BUILDDIR)/common/Subdirs.gmk
  51 
  52 all build:
  53         $(SUBDIRS-loop)
  54 
  55 clean clobber::
  56         $(SUBDIRS-loop)
  57 
  58 #
  59 # Rules
  60 #
  61 include $(BUILDDIR)/common/Classes.gmk
  62 
  63 build: stubs
  64 
  65 #
  66 # Clean up internal-use-only package.
  67 #
  68 clean ::
  69         $(RM) -r $(CLASSDESTDIR)/com/sun/jmx \
  70                  $(CLASSDESTDIR)/com/sun/management/jmx \
  71                  $(CLASSDESTDIR)/org/omg/stub/javax/management/remote/rmi \
  72 
  73 
  74 #
  75 # The remainder of this makefile contains defs and rules
  76 # for generating RMI stubs.
  77 # With inspiration from com/sun/jndi/rmi/registry
  78 #
  79 
  80 #
  81 # Full class names of implementations requiring stubs
  82 #
  83 REMOTE_impls = \
  84     javax.management.remote.rmi.RMIConnectionImpl \
  85     javax.management.remote.rmi.RMIServerImpl \
  86 
  87 
  88 REMOTE_files = $(subst .,/,$(REMOTE_impls))
  89 FILES_stubs  = $(REMOTE_files:%=$(CLASSDESTDIR)/%_Stub.class)
  90 FILES_ties   = $(subst javax/management/remote/rmi/,javax/management/remote/rmi/_,$(REMOTE_files:%=$(CLASSDESTDIR)/%_Tie.class))
  91 
  92 
  93 #
  94 # Compile stubs and skeletons for remote implementations
  95 #
  96 # Keep generated RMI/JRMP Stub source files and copy them to GENSRCDIR
  97 # so that javadoc can include them in the API (4997471)
  98 #
  99 # For RMI/IIOP call rmic a second time with -standardPackage option
 100 # so that *_tie classes are generated in package without the prefix
 101 # org.omg.stub (6375696)
 102 # 
 103 $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class
 104         $(prep-target)
 105         $(RMIC) -classpath "$(CLASSDESTDIR)"    \
 106                 -d $(CLASSDESTDIR)              \
 107                 -v1.2                           \
 108                 -keepgenerated                  \
 109                 $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%))
 110         $(MKDIR) -p $(@D:$(CLASSDESTDIR)/%=$(GENSRCDIR)/%)
 111         $(CP)       $(@:%.class=%.java)                                     \
 112                     $(@D:$(CLASSDESTDIR)/%=$(GENSRCDIR)/%)
 113         $(RMIC) -classpath "$(CLASSDESTDIR)"    \
 114                 -d $(CLASSDESTDIR)              \
 115                 -iiop -v1.2                     \
 116                 $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%))
 117         $(RMIC) $(HOTSPOT_INTERPRETER_FLAG) -classpath "$(CLASSDESTDIR)"    \
 118                 -d $(CLASSDESTDIR)              \
 119                 -iiop -v1.2                     \
 120                 -standardPackage                \
 121                 $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%))
 122         @$(java-vm-cleanup)
 123 
 124 stubs: $(FILES_stubs)