make/common/RMICompilation.gmk

changeset 912
a667caba1e84
parent 852
77473affb9c0
child 1133
50aaf272884f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/common/RMICompilation.gmk	Thu Nov 14 10:53:23 2013 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +define SetupRMICompilation
    1.30 +  # param 1 is a name for a variable to depend on.
    1.31 +  # param 2 and up are named args.
    1.32 +  #   CLASSES:=List of classes to generate stubs for
    1.33 +  #   CLASSES_DIR:=Directory where to look for classes
    1.34 +  #   STUB_CLASSES_DIR:=Directory in where to put stub classes
    1.35 +  #   RUN_V11:=Set to run rmic with -v1.1
    1.36 +  #   RUN_V12:=Set to run rmic with -v1.2
    1.37 +  #   RUN_IIOP:=Set to run rmic with -iiop
    1.38 +  #   RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
    1.39 +  #   KEEP_GENERATED:=Set to keep generated sources around
    1.40 +  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
    1.41 +  $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
    1.42 +  $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
    1.43 +
    1.44 +  $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
    1.45 +
    1.46 +  $1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
    1.47 +  $1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
    1.48 +  $1_STUB_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Stub.class,$$($1_CLASSES_SLASH)))
    1.49 +  $1_TARGETS := $$($1_STUB_FILES)
    1.50 +  $1_ARGS :=
    1.51 +  ifneq (,$$($1_RUN_V11))
    1.52 +    $1_SKEL_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Skel.class,$$($1_CLASSES_SLASH)))
    1.53 +    $1_TARGETS += $$($1_SKEL_FILES)
    1.54 +    $1_ARGS += -v1.1
    1.55 +  endif
    1.56 +  ifneq (,$$($1_RUN_V12))
    1.57 +    $1_ARGS += -v1.2
    1.58 +  endif
    1.59 +
    1.60 +  $1_TIE_BASE_FILES := $$(foreach f,$$($1_CLASSES_SLASH),$$(dir $$f)_$$(notdir $$f))
    1.61 +  $1_TIE_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/org/omg/stub/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
    1.62 +  $1_TIE_STDPKG_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
    1.63 +
    1.64 +  ifneq (,$$($1_RUN_IIOP))
    1.65 +    $1_TARGETS += $$($1_TIE_FILES)
    1.66 +    $1_ARGS += -iiop -emitPermissionCheck
    1.67 +  endif
    1.68 +  ifneq (,$$($1_RUN_IIOP_STDPKG))
    1.69 +    $1_TARGETS += $$($1_TIE_STDPKG_FILES)
    1.70 +    $1_ARGS2 := -iiop -emitPermissionCheck -standardPackage
    1.71 +  endif
    1.72 +
    1.73 +  ifneq (,$$($1_KEEP_GENERATED))
    1.74 +    $1_ARGS += -keepgenerated
    1.75 +    $1_TARGETS += $$(subst .class,.java,$$($1_TARGETS))
    1.76 +  endif
    1.77 +
    1.78 +  $1_DOLLAR_SAFE_CLASSES := $$(subst $$$$,\$$$$,$$($1_CLASSES))
    1.79 +
    1.80 +  $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
    1.81 +
    1.82 +  $$($1_DEP_FILE): $$($1_CLASS_FILES)
    1.83 +	$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
    1.84 +	if [ "x$$($1_ARGS)" != "x" ]; then \
    1.85 +	  $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \
    1.86 +	  $(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
    1.87 +	      -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
    1.88 +	fi;
    1.89 +	if [ "x$$($1_ARGS2)" != "x" ]; then \
    1.90 +	  $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \
    1.91 +	  $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
    1.92 +	      -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
    1.93 +	fi;
    1.94 +	$(TOUCH) $$@
    1.95 +
    1.96 +
    1.97 +  $1 := $$($1_TARGETS) $$($1_DEP_FILE)
    1.98 +
    1.99 +endef

mercurial