aoqi@0: # aoqi@0: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. Oracle designates this aoqi@0: # particular file as subject to the "Classpath" exception as provided aoqi@0: # by Oracle in the LICENSE file that accompanied this code. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: aoqi@0: PREFIXES=-pkgPrefix CORBA org.omg \ aoqi@0: -pkgPrefix CosNaming org.omg \ aoqi@0: -pkgPrefix CosTransactions org.omg \ aoqi@0: -pkgPrefix CosTSInteroperation org.omg \ aoqi@0: -pkgPrefix DynamicAny org.omg \ aoqi@0: -pkgPrefix Dynamic org.omg \ aoqi@0: -pkgPrefix IOP org.omg \ aoqi@0: -pkgPrefix Messaging org.omg \ aoqi@0: -pkgPrefix PortableInterceptor org.omg \ aoqi@0: -pkgPrefix PortableServer org.omg \ aoqi@0: -pkgPrefix activation com.sun.corba.se.spi \ aoqi@0: -pkgPrefix GIOP com.sun.corba.se \ aoqi@0: -pkgPrefix PortableActivationIDL com.sun.corba.se \ aoqi@0: -pkgPrefix messages com.sun.corba.se aoqi@0: aoqi@0: define add_idl_package aoqi@0: # param 1 = MYPACKAGE aoqi@0: # param 2 = src root aoqi@0: # param 3 = gensrc root aoqi@0: # param 4 = source idl to compile aoqi@0: # param 5 = target idl package aoqi@0: # param 6 = delete these files that were output from the idlj aoqi@0: # param 7 = idls that match these patterns should be compiled with -oldImplBase aoqi@0: # param 8 = the idlj command aoqi@0: # Save the generated java files to a temporary directory so aoqi@0: # that we can find them and create proper dependencies. aoqi@0: # After that, we move them to the real gensrc target dir. aoqi@0: $4_TMPDIR:=tmp___$(subst /,_,$(patsubst $2/%,%,$4))___ aoqi@0: ifneq ($$(filter $7,$4),) aoqi@0: $4_OLDIMPLBASE:=-oldImplBase aoqi@0: $4_OLDIMPLBASE_MSG:=with -oldImplBase aoqi@0: endif aoqi@0: $5 : $4 aoqi@0: $(MKDIR) -p $3/$$($4_TMPDIR) aoqi@0: $(RM) -rf $3/$$($4_TMPDIR) aoqi@0: $(MKDIR) -p $(dir $5) aoqi@0: $(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4) aoqi@0: $8 -td $3/$$($4_TMPDIR) \ aoqi@0: -i $2/org/omg/CORBA \ aoqi@0: -i $2/org/omg/PortableInterceptor \ aoqi@0: -i $2/org/omg/PortableServer \ aoqi@0: -D CORBA3 -corba 3.0 \ aoqi@0: -fall \ aoqi@0: $$($4_OLDIMPLBASE) \ aoqi@0: $(PREFIXES) \ aoqi@0: $4 aoqi@0: $(RM) -f $$(addprefix $3/$$($4_TMPDIR)/,$6) aoqi@0: $(CP) -r $3/$$($4_TMPDIR)/* $3 aoqi@0: ($(CD) $3/$$($4_TMPDIR) && $(FIND) . -type f | $(SED) 's!\./!$3/!g' | $(NAWK) '{ print $$$$1 ": $4" }' > $5) aoqi@0: $(RM) -rf $3/$$($4_TMPDIR) aoqi@0: endef aoqi@0: aoqi@0: define SetupIdlCompilation aoqi@0: # param 1 is for example BUILD_IDLS aoqi@0: # param 2,3,4,5,6,7,8 are named args. aoqi@0: # IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES aoqi@0: $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) aoqi@0: $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) aoqi@0: $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) aoqi@0: aoqi@0: # Find all existing java files and existing class files. aoqi@0: $$(eval $$(call MakeDir,$$($1_BIN))) aoqi@0: $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl") aoqi@0: $1_BINS := $$(shell find $$($1_BIN) -name "*.java") aoqi@0: # Prepend the source/bin path to the filter expressions. aoqi@0: $1_SRC_INCLUDES := $$(addprefix $$($1_SRC)/,$$($1_INCLUDES)) aoqi@0: $1_SRC_EXCLUDES := $$(addprefix $$($1_SRC)/,$$($1_EXCLUDES)) aoqi@0: $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$($1_INCLUDES)) aoqi@0: $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$($1_EXCLUDES)) aoqi@0: $1_OLDIMPLBASES := $$(addprefix $$($1_SRC)/,$$($1_OLDIMPLBASES)) aoqi@0: # Now remove unwanted java/class files. aoqi@0: $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS)) aoqi@0: $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) aoqi@0: $1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS)) aoqi@0: $1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS)) aoqi@0: $1 := $$(sort $$(patsubst $$($1_SRC)/%.idl,$$($1_BIN)/%.idl.d,$$($1_SRCS))) aoqi@0: # Now create the dependencies for each idl target. aoqi@0: $$(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: endef aoqi@0: aoqi@0: .SUFFIXES: .java .class .package