common/makefiles/IdlCompilation.gmk

Tue, 10 Apr 2012 08:18:28 -0700

author
ohair
date
Tue, 10 Apr 2012 08:18:28 -0700
changeset 425
e1830598f0b7
child 458
c8d320b48626
permissions
-rw-r--r--

7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>

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

mercurial