make/common/IdlCompilation.gmk

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 912
a667caba1e84
parent 0
75a576e87639
permissions
-rw-r--r--

merge

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation. Oracle designates this
aoqi@0 8 # particular file as subject to the "Classpath" exception as provided
aoqi@0 9 # by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 #
aoqi@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 # accompanied this code).
aoqi@0 16 #
aoqi@0 17 # You should have received a copy of the GNU General Public License version
aoqi@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 #
aoqi@0 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 # or visit www.oracle.com if you need additional information or have any
aoqi@0 23 # questions.
aoqi@0 24 #
aoqi@0 25
aoqi@0 26 PREFIXES=-pkgPrefix CORBA org.omg \
aoqi@0 27 -pkgPrefix CosNaming org.omg \
aoqi@0 28 -pkgPrefix CosTransactions org.omg \
aoqi@0 29 -pkgPrefix CosTSInteroperation org.omg \
aoqi@0 30 -pkgPrefix DynamicAny org.omg \
aoqi@0 31 -pkgPrefix Dynamic org.omg \
aoqi@0 32 -pkgPrefix IOP org.omg \
aoqi@0 33 -pkgPrefix Messaging org.omg \
aoqi@0 34 -pkgPrefix PortableInterceptor org.omg \
aoqi@0 35 -pkgPrefix PortableServer org.omg \
aoqi@0 36 -pkgPrefix activation com.sun.corba.se.spi \
aoqi@0 37 -pkgPrefix GIOP com.sun.corba.se \
aoqi@0 38 -pkgPrefix PortableActivationIDL com.sun.corba.se \
aoqi@0 39 -pkgPrefix messages com.sun.corba.se
aoqi@0 40
aoqi@0 41 define add_idl_package
aoqi@0 42 # param 1 = MYPACKAGE
aoqi@0 43 # param 2 = src root
aoqi@0 44 # param 3 = gensrc root
aoqi@0 45 # param 4 = source idl to compile
aoqi@0 46 # param 5 = target idl package
aoqi@0 47 # param 6 = delete these files that were output from the idlj
aoqi@0 48 # param 7 = idls that match these patterns should be compiled with -oldImplBase
aoqi@0 49 # param 8 = the idlj command
aoqi@0 50 # Save the generated java files to a temporary directory so
aoqi@0 51 # that we can find them and create proper dependencies.
aoqi@0 52 # After that, we move them to the real gensrc target dir.
aoqi@0 53 $4_TMPDIR:=tmp___$(subst /,_,$(patsubst $2/%,%,$4))___
aoqi@0 54 ifneq ($$(filter $7,$4),)
aoqi@0 55 $4_OLDIMPLBASE:=-oldImplBase
aoqi@0 56 $4_OLDIMPLBASE_MSG:=with -oldImplBase
aoqi@0 57 endif
aoqi@0 58 $5 : $4
aoqi@0 59 $(MKDIR) -p $3/$$($4_TMPDIR)
aoqi@0 60 $(RM) -rf $3/$$($4_TMPDIR)
aoqi@0 61 $(MKDIR) -p $(dir $5)
aoqi@0 62 $(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
aoqi@0 63 $8 -td $3/$$($4_TMPDIR) \
aoqi@0 64 -i $2/org/omg/CORBA \
aoqi@0 65 -i $2/org/omg/PortableInterceptor \
aoqi@0 66 -i $2/org/omg/PortableServer \
aoqi@0 67 -D CORBA3 -corba 3.0 \
aoqi@0 68 -fall \
aoqi@0 69 $$($4_OLDIMPLBASE) \
aoqi@0 70 $(PREFIXES) \
aoqi@0 71 $4
aoqi@0 72 $(RM) -f $$(addprefix $3/$$($4_TMPDIR)/,$6)
aoqi@0 73 $(CP) -r $3/$$($4_TMPDIR)/* $3
aoqi@0 74 ($(CD) $3/$$($4_TMPDIR) && $(FIND) . -type f | $(SED) 's!\./!$3/!g' | $(NAWK) '{ print $$$$1 ": $4" }' > $5)
aoqi@0 75 $(RM) -rf $3/$$($4_TMPDIR)
aoqi@0 76 endef
aoqi@0 77
aoqi@0 78 define SetupIdlCompilation
aoqi@0 79 # param 1 is for example BUILD_IDLS
aoqi@0 80 # param 2,3,4,5,6,7,8 are named args.
aoqi@0 81 # IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES
aoqi@0 82 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
aoqi@0 83 $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
aoqi@0 84 $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
aoqi@0 85
aoqi@0 86 # Find all existing java files and existing class files.
aoqi@0 87 $$(eval $$(call MakeDir,$$($1_BIN)))
aoqi@0 88 $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl")
aoqi@0 89 $1_BINS := $$(shell find $$($1_BIN) -name "*.java")
aoqi@0 90 # Prepend the source/bin path to the filter expressions.
aoqi@0 91 $1_SRC_INCLUDES := $$(addprefix $$($1_SRC)/,$$($1_INCLUDES))
aoqi@0 92 $1_SRC_EXCLUDES := $$(addprefix $$($1_SRC)/,$$($1_EXCLUDES))
aoqi@0 93 $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$($1_INCLUDES))
aoqi@0 94 $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$($1_EXCLUDES))
aoqi@0 95 $1_OLDIMPLBASES := $$(addprefix $$($1_SRC)/,$$($1_OLDIMPLBASES))
aoqi@0 96 # Now remove unwanted java/class files.
aoqi@0 97 $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
aoqi@0 98 $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
aoqi@0 99 $1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
aoqi@0 100 $1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
aoqi@0 101 $1 := $$(sort $$(patsubst $$($1_SRC)/%.idl,$$($1_BIN)/%.idl.d,$$($1_SRCS)))
aoqi@0 102 # Now create the dependencies for each idl target.
aoqi@0 103 $$(foreach p,$$($1),$$(eval $$(call add_idl_package,$1,$$($1_SRC),$$($1_BIN),$$(patsubst $$($1_BIN)/%.idl.d,$$($1_SRC)/%.idl,$$p),$$p,$$($1_DELETES),$$($1_OLDIMPLBASES),$$($1_IDLJ))))
aoqi@0 104 endef
aoqi@0 105
aoqi@0 106 .SUFFIXES: .java .class .package

mercurial