RMICompilation.gmk revision 1327:6ebc4cb8a14d
1205218Srdivacky# 2202878Srdivacky# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 3202878Srdivacky# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4202878Srdivacky# 5202878Srdivacky# This code is free software; you can redistribute it and/or modify it 6202878Srdivacky# under the terms of the GNU General Public License version 2 only, as 7202878Srdivacky# published by the Free Software Foundation. Oracle designates this 8202878Srdivacky# particular file as subject to the "Classpath" exception as provided 9202878Srdivacky# by Oracle in the LICENSE file that accompanied this code. 10202878Srdivacky# 11202878Srdivacky# This code is distributed in the hope that it will be useful, but WITHOUT 12202878Srdivacky# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13202878Srdivacky# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14249423Sdim# version 2 for more details (a copy is included in the LICENSE file that 15249423Sdim# accompanied this code). 16202878Srdivacky# 17202878Srdivacky# You should have received a copy of the GNU General Public License version 18202878Srdivacky# 2 along with this work; if not, write to the Free Software Foundation, 19202878Srdivacky# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20263508Sdim# 21202878Srdivacky# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22263508Sdim# or visit www.oracle.com if you need additional information or have any 23234353Sdim# questions. 24263508Sdim# 25263508Sdim 26202878Srdivacky# Setup make rules for creating an RMI compilation. 27202878Srdivacky# 28202878Srdivacky# Parameter 1 is the name of the rule. This name is used as variable prefix, 29202878Srdivacky# and the targets generated are listed in a variable by that name. 30202878Srdivacky# 31202878Srdivacky# Remaining parameters are named arguments. These include: 32202878Srdivacky# CLASSES:=List of classes to generate stubs for 33202878Srdivacky# CLASSES_DIR:=Directory where to look for classes 34202878Srdivacky# STUB_CLASSES_DIR:=Directory in where to put stub classes 35202878Srdivacky# RUN_V11:=Set to run rmic with -v1.1 36263508Sdim# RUN_V12:=Set to run rmic with -v1.2 37202878Srdivacky# RUN_IIOP:=Set to run rmic with -iiop 38202878Srdivacky# RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage 39202878Srdivacky# KEEP_GENERATED:=Set to keep generated sources around 40202878Srdivackydefine SetupRMICompilation 41202878Srdivacky $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) 42202878Srdivacky $(call EvalDebugWrapper,$(strip $1),$(call SetupRMICompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) 43202878Srdivackyendef 44202878Srdivacky 45202878Srdivackydefine SetupRMICompilationInner 46202878Srdivacky $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE)) 47202878Srdivacky $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) 48202878Srdivacky $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) 49263508Sdim 50202878Srdivacky $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated 51202878Srdivacky 52202878Srdivacky $1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES)) 53202878Srdivacky $1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH))) 54202878Srdivacky $1_STUB_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Stub.class,$$($1_CLASSES_SLASH))) 55263508Sdim $1_TARGETS := $$($1_STUB_FILES) 56243830Sdim $1_ARGS := 57202878Srdivacky ifneq (,$$($1_RUN_V11)) 58202878Srdivacky $1_SKEL_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Skel.class,$$($1_CLASSES_SLASH))) 59202878Srdivacky $1_TARGETS += $$($1_SKEL_FILES) 60202878Srdivacky $1_ARGS += -v1.1 61263508Sdim endif 62263508Sdim ifneq (,$$($1_RUN_V12)) 63202878Srdivacky $1_ARGS += -v1.2 64202878Srdivacky endif 65202878Srdivacky 66202878Srdivacky $1_TIE_BASE_FILES := $$(foreach f,$$($1_CLASSES_SLASH),$$(dir $$f)_$$(notdir $$f)) 67249423Sdim $1_TIE_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/org/omg/stub/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES))) 68 $1_TIE_STDPKG_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES))) 69 70 ifneq (,$$($1_RUN_IIOP)) 71 $1_TARGETS += $$($1_TIE_FILES) 72 $1_ARGS += -iiop -emitPermissionCheck 73 endif 74 ifneq (,$$($1_RUN_IIOP_STDPKG)) 75 $1_TARGETS += $$($1_TIE_STDPKG_FILES) 76 $1_ARGS2 := -iiop -emitPermissionCheck -standardPackage 77 endif 78 79 ifneq (,$$($1_KEEP_GENERATED)) 80 $1_ARGS += -keepgenerated 81 $1_TARGETS += $$(subst .class,.java,$$($1_TARGETS)) 82 endif 83 84 $1_DOLLAR_SAFE_CLASSES := $$(subst $$$$,\$$$$,$$($1_CLASSES)) 85 86 $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES) 87 88 $$($1_DEP_FILE): $$($1_CLASS_FILES) 89 $(MKDIR) -p $$($1_STUB_CLASSES_DIR) 90 $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \ 91 $(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \ 92 -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \ 93 if [ "x$$($1_ARGS2)" != "x" ]; then \ 94 $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \ 95 $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \ 96 -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \ 97 fi; 98 $(TOUCH) $$@ 99 100 101 $1 := $$($1_TARGETS) $$($1_DEP_FILE) 102 103endef 104