common/makefiles/RMICompilation.gmk

changeset 459
3156dff953b1
child 494
e64f2cb57d05
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/makefiles/RMICompilation.gmk	Thu Jul 05 18:27:07 2012 -0700
     1.3 @@ -0,0 +1,104 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012 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 +    $(if $2,$1_$(strip $2))
    1.41 +    $(if $3,$1_$(strip $3))
    1.42 +    $(if $4,$1_$(strip $4))
    1.43 +    $(if $5,$1_$(strip $5))
    1.44 +    $(if $6,$1_$(strip $6))
    1.45 +    $(if $7,$1_$(strip $7))
    1.46 +    $(if $8,$1_$(strip $8))
    1.47 +    $(if $9,$1_$(strip $9))
    1.48 +    $(if $(10),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
    1.49 +
    1.50 +
    1.51 +    $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/$1_rmic
    1.52 +
    1.53 +    $1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
    1.54 +    $1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
    1.55 +    $1_STUB_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Stub.class,$$($1_CLASSES_SLASH)))
    1.56 +    $1_TARGETS := $$($1_STUB_FILES)
    1.57 +    $1_ARGS :=
    1.58 +    ifneq (,$$($1_RUN_V11))
    1.59 +        $1_SKEL_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Skel.class,$$($1_CLASSES_SLASH)))
    1.60 +        $1_TARGETS += $$($1_SKEL_FILES)
    1.61 +        $1_ARGS += -v1.1
    1.62 +    endif
    1.63 +    ifneq (,$$($1_RUN_V12))
    1.64 +        $1_ARGS += -v1.2
    1.65 +    endif
    1.66 +
    1.67 +    $1_TIE_BASE_FILES := $$(foreach f,$$($1_CLASSES_SLASH),$$(dir $$f)_$$(notdir $$f))
    1.68 +    $1_TIE_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/org/omg/stub/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
    1.69 +    $1_TIE_STDPKG_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
    1.70 +
    1.71 +    ifneq (,$$($1_RUN_IIOP))
    1.72 +        $1_TARGETS += $$($1_TIE_FILES)
    1.73 +        $1_ARGS += -iiop
    1.74 +    endif
    1.75 +    ifneq (,$$($1_RUN_IIOP_STDPKG))
    1.76 +        $1_TARGETS += $$($1_TIE_STDPKG_FILES)
    1.77 +        $1_ARGS2 := -iiop -standardPackage
    1.78 +    endif
    1.79 +
    1.80 +    ifneq (,$$($1_KEEP_GENERATED))
    1.81 +        $1_ARGS += -keepgenerated
    1.82 +        $1_TARGETS += $$(subst .class,.java,$$($1_TARGETS))
    1.83 +    endif
    1.84 +
    1.85 +    $1_DOLLAR_SAFE_CLASSES := $$(subst $$$$,\$$$$,$$($1_CLASSES))
    1.86 +
    1.87 +    $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
    1.88 +
    1.89 +    $$($1_DEP_FILE): $$($1_CLASS_FILES)
    1.90 +	$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
    1.91 +	if [ "x$$($1_ARGS)" != "x" ]; then \
    1.92 +	    $(ECHO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) &&\
    1.93 +	    $(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
    1.94 +			-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
    1.95 +	fi;
    1.96 +	if [ "x$$($1_ARGS2)" != "x" ]; then \
    1.97 +	    $(ECHO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) &&\
    1.98 +	    $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
    1.99 +			-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
   1.100 +	fi;
   1.101 +
   1.102 +
   1.103 +    $1 := $$($1_TARGETS)
   1.104 +
   1.105 +    # By marking as secondary, this "touch" file doesn't need to be touched and will never exist.
   1.106 +    .SECONDARY: $$($1_DEP_FILE)
   1.107 +endef

mercurial