make/common/IdlCompilation.gmk
author vromero
Thu, 31 Mar 2016 17:25:58 -0400
changeset 36776 5e260fa5208a
parent 35008 ef0cd710989f
permissions -rw-r--r--
8150733: NPE when compiling module-info.java with a class declaration in a non-module mode Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
     2
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    26
PREFIXES=-pkgPrefix CORBA org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    27
    -pkgPrefix CosNaming org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    28
    -pkgPrefix CosTransactions org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    29
    -pkgPrefix CosTSInteroperation org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    30
    -pkgPrefix DynamicAny org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    31
    -pkgPrefix Dynamic org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    32
    -pkgPrefix IOP org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    33
    -pkgPrefix Messaging org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    34
    -pkgPrefix PortableInterceptor org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    35
    -pkgPrefix PortableServer org.omg \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    36
    -pkgPrefix activation com.sun.corba.se.spi \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    37
    -pkgPrefix GIOP com.sun.corba.se \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    38
    -pkgPrefix PortableActivationIDL com.sun.corba.se \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    39
    -pkgPrefix messages com.sun.corba.se
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    40
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    41
define add_idl_package
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    42
  # param 1 = MYPACKAGE
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    43
  # param 2 = src root
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    44
  # param 3 = gensrc root
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    45
  # param 4 = source idl to compile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    46
  # param 5 = target idl package
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    47
  # param 6 = delete these files that were output from the idlj
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    48
  # param 7 = idls that match these patterns should be compiled with -oldImplBase
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    49
  # param 8 = the idlj command
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    50
  # Save the generated java files to a temporary directory so
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    51
  # that we can find them and create proper dependencies.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    52
  # After that, we move them to the real gensrc target dir.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    53
  $4_TMPDIR:=tmp___$(subst /,_,$(patsubst $2/%,%,$4))___
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    54
  ifneq ($$(filter $7,$4),)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    55
    $4_OLDIMPLBASE:=-oldImplBase
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    56
    $4_OLDIMPLBASE_MSG:=with -oldImplBase
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    57
  endif
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    58
  $5 : $4
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 29312
diff changeset
    59
	$$(call LogInfo, Compiling IDL $(patsubst $2/%,%,$4))
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 29312
diff changeset
    60
	$$(call MakeDir, $$(@D))
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents: 13132
diff changeset
    61
	$(RM) -rf $3/$$($4_TMPDIR)
26127
5ca6c50438a8 8056064: Fix corba locale build problem on windows
erikj
parents: 25884
diff changeset
    62
	$8 -td $3/$$($4_TMPDIR) \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    63
	    -i $2/org/omg/CORBA \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    64
	    -i $2/org/omg/PortableInterceptor \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    65
	    -i $2/org/omg/PortableServer \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    66
	    -D CORBA3 -corba 3.0 \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    67
	    -fall \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    68
	    $$($4_OLDIMPLBASE) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    69
	    $(PREFIXES) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    70
	    $4
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents: 13132
diff changeset
    71
	$(RM) -f $$(addprefix $3/$$($4_TMPDIR)/,$6)
16579
7e2a683462f9 8011372: Remove -p from cp in IdleCompilation.gmk
erikj
parents: 15392
diff changeset
    72
	$(CP) -r $3/$$($4_TMPDIR)/* $3
15392
28d8aefeedd3 8006933: Need to use nawk on Solaris to avoid awk limitations
tbell
parents: 15051
diff changeset
    73
	($(CD) $3/$$($4_TMPDIR) && $(FIND) . -type f | $(SED) 's!\./!$3/!g' | $(NAWK) '{ print $$$$1 ": $4" }' > $5)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents: 13132
diff changeset
    74
	$(RM) -rf $3/$$($4_TMPDIR)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    75
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    76
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    77
# Setup make rules for creating an IDL compilation.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    78
#
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    79
# Parameter 1 is the name of the rule. This name is used as variable prefix,
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    80
# and the targets generated are listed in a variable by that name.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    81
#
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    82
# Remaining parameters are named arguments. These include:
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    83
#   IDLJ
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    84
#   SRC
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    85
#   BIN
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    86
#   INCLUDES
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    87
#   EXCLUDES
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    88
#   OLDIMPLBASES
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 26127
diff changeset
    89
#   DELETES
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28905
diff changeset
    90
SetupIdlCompilation = $(NamedParamsMacroTemplate)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28905
diff changeset
    91
define SetupIdlCompilationBody
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12258
diff changeset
    92
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    93
  # Find all existing java files and existing class files.
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27592
diff changeset
    94
  $$(call MakeDir,$$($1_BIN))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    95
  $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl")
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    96
  $1_BINS := $$(shell find $$($1_BIN) -name "*.java")
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    97
  # Prepend the source/bin path to the filter expressions.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    98
  $1_SRC_INCLUDES := $$(addprefix $$($1_SRC)/,$$($1_INCLUDES))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
    99
  $1_SRC_EXCLUDES := $$(addprefix $$($1_SRC)/,$$($1_EXCLUDES))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   100
  $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$($1_INCLUDES))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   101
  $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$($1_EXCLUDES))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   102
  $1_OLDIMPLBASES := $$(addprefix $$($1_SRC)/,$$($1_OLDIMPLBASES))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   103
  # Now remove unwanted java/class files.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   104
  $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   105
  $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   106
  $1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   107
  $1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   108
  $1 := $$(sort $$(patsubst $$($1_SRC)/%.idl,$$($1_BIN)/%.idl.d,$$($1_SRCS)))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   109
  # Now create the dependencies for each idl target.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19262
diff changeset
   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))))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   111
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   112
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   113
.SUFFIXES: .java .class .package