make/common/JavaCompilation.gmk
author herrick
Thu, 28 Mar 2019 13:49:38 -0400
branchJDK-8200758-branch
changeset 57292 7a683c461b80
parent 52804 28094715ae71
child 54380 e297c7bb6469
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
52804
28094715ae71 8214718: Update missing copyright year in build system
ihse
parents: 52065
diff changeset
     2
# Copyright (c) 2011, 2018, 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
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    26
# When you read this source. Remember that $(sort ...) has the side effect
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    27
# of removing duplicates. It is actually this side effect that is
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    28
# desired whenever sort is used below!
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    29
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    30
ifndef _JAVA_COMPILATION_GMK
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    31
_JAVA_COMPILATION_GMK := 1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    32
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    33
ifeq (,$(_MAKEBASE_GMK))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    34
  $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    35
endif
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    36
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 33437
diff changeset
    37
# Java compilation needs SetupJarArchive and/or SetupZipArchive, if we're
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 33437
diff changeset
    38
# generating a jar file or a source zip.
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 33437
diff changeset
    39
include JarArchive.gmk
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    40
include ZipArchive.gmk
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    41
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    42
# Setup make rules for defining a Java compiler, which is needed to compile
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    43
# Java code. This rule generates no output.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    44
#
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    45
# Parameter 1 is the name of the compiler definition. This name needs to be
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    46
# passed to SetupJavaCompilation. This name is used as variable prefix.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    47
#
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    48
# Remaining parameters are named arguments. These include:
48406
26b47ea4c77d 8193512: Remove remnants of javah from jdk/jdk repo
jjg
parents: 47398
diff changeset
    49
#   JVM:=The jvm used to run the javac command
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    50
#   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    51
#   FLAGS:=Flags to be supplied to javac
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    52
#   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
    53
#   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
33055
3676b99f33cf 8140312: Enable new sjavac server only mode in jdk build
erikj
parents: 32807
diff changeset
    54
#   DISABLE_SJAVAC:=Set to true if this setup does not support sjavac
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29174
diff changeset
    55
SetupJavaCompiler = $(NamedParamsMacroTemplate)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29174
diff changeset
    56
define SetupJavaCompilerBody
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    57
  # The port file contains the tcp/ip on which the server listens
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    58
  # and the cookie necessary to talk to the server.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    59
  $1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    60
  # You can use a different JVM to run the background javac server.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    61
  ifeq ($$($1_SERVER_JVM),)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    62
    # It defaults to the same JVM that is used to start the javac command.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    63
    $1_SERVER_JVM:=$$($1_JVM)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    64
  endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    65
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    66
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    67
define add_file_to_copy
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    68
  # param 1 = BUILD_MYPACKAGE
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    69
  # parma 2 = The source file to copy.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    70
  $2_TARGET:=$2
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    71
  # Remove the source prefix.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    72
  $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    73
  # To allow for automatic overrides, do not create a rule for a target file that
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    74
  # already has one
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
    75
  ifneq ($$($1_COPY_$$($2_TARGET)), 1)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
    76
    $1_COPY_$$($2_TARGET) := 1
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33442
diff changeset
    77
    # Now we can setup the dependency that will trigger the copying.
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
    78
    $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
52018
592dff6ac440 8211677: Java resource copy and clean should use MakeTargetDir macro
erikj
parents: 50590
diff changeset
    79
	$$(call LogInfo, Copying $$(patsubst $(OUTPUTDIR)/%,%, $$@))
592dff6ac440 8211677: Java resource copy and clean should use MakeTargetDir macro
erikj
parents: 50590
diff changeset
    80
	$$(install-file)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    81
	$(CHMOD) -f ug+w $$@
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    82
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    83
    # And do not forget this target
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
    84
    $1_ALL_COPY_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
    85
  endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    86
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    87
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    88
# This macro is used only for properties files that are to be
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    89
# copied over to the classes directory in cleaned form:
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    90
# Previously this was inconsistently done in different repositories.
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13132
diff changeset
    91
# This is the new clean standard. Though it is to be superseded by
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13132
diff changeset
    92
# a standard annotation processor from with sjavac.
23162
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
    93
#
28900
dd0303e8c9ce 8072950: api/xinclude/Harold/harold-97.html\#harold-97, api/xinclude/Harold/harold-67.html\#harold-67 fails on solaris with build port-stage-aarch64
erikj
parents: 28606
diff changeset
    94
# An empty echo ensures that the input to sed always ends with a newline.
dd0303e8c9ce 8072950: api/xinclude/Harold/harold-97.html\#harold-97, api/xinclude/Harold/harold-67.html\#harold-67 fails on solaris with build port-stage-aarch64
erikj
parents: 28606
diff changeset
    95
# Certain implementations (e.g. Solaris) will skip the last line without
dd0303e8c9ce 8072950: api/xinclude/Harold/harold-97.html\#harold-97, api/xinclude/Harold/harold-67.html\#harold-67 fails on solaris with build port-stage-aarch64
erikj
parents: 28606
diff changeset
    96
# it.
dd0303e8c9ce 8072950: api/xinclude/Harold/harold-97.html\#harold-97, api/xinclude/Harold/harold-67.html\#harold-67 fails on solaris with build port-stage-aarch64
erikj
parents: 28606
diff changeset
    97
#
23162
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
    98
# The sed expression does this:
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
    99
# 1. Add a backslash before any :, = or ! that do not have a backslash already.
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 27592
diff changeset
   100
# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX
23162
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   101
#    conversions.
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   102
# 3. Delete all lines starting with #.
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   103
# 4. Delete empty lines.
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   104
# 5. Append lines ending with \ with the next line.
24080
8bfff14321a9 8041265: jdk/bin/rmic -iiop failed on macosx-x86_64 with "Class sun.rmi.rmic.iiop.BatchEnvironmen not found"
erikj
parents: 23983
diff changeset
   105
# 6. Remove leading and trailing white space. Note that tabs must be explicit
8bfff14321a9 8041265: jdk/bin/rmic -iiop failed on macosx-x86_64 with "Class sun.rmi.rmic.iiop.BatchEnvironmen not found"
erikj
parents: 23983
diff changeset
   106
#    as sed on macosx does not understand '\t'.
23162
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   107
# 7. Replace the first \= with just =.
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   108
# 8. Finally it's all sorted to create a stable output.
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 27592
diff changeset
   109
#
23162
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   110
# It is assumed that = is the character used for separating names and values.
cb2710310e93 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 22481
diff changeset
   111
define add_file_to_clean
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   112
  # param 1 = BUILD_MYPACKAGE
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   113
  # parma 2 = The source file to copy and clean.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   114
  $2_TARGET:=$2
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   115
  # Remove the source prefix.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   116
  $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   117
  # Now we can setup the depency that will trigger the copying.
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   118
  # To allow for automatic overrides, do not create a rule for a target file that
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   119
  # already has one
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   120
  ifneq ($$($1_CLEAN_$$($2_TARGET)), 1)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   121
    $1_CLEAN_$$($2_TARGET) := 1
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   122
    $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
52018
592dff6ac440 8211677: Java resource copy and clean should use MakeTargetDir macro
erikj
parents: 50590
diff changeset
   123
	$$(call LogInfo, Cleaning $$(patsubst $(OUTPUTDIR)/%,%, $$@))
592dff6ac440 8211677: Java resource copy and clean should use MakeTargetDir macro
erikj
parents: 50590
diff changeset
   124
	$$(call MakeTargetDir)
28900
dd0303e8c9ce 8072950: api/xinclude/Harold/harold-97.html\#harold-97, api/xinclude/Harold/harold-67.html\#harold-67 fails on solaris with build port-stage-aarch64
erikj
parents: 28606
diff changeset
   125
	export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
27591
f8f4973d2329 8065138: Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8'
erikj
parents: 26671
diff changeset
   126
	    | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
29438
6166fd4a617f 8058470: [jconsole] VM Summary Tab is blank for JDK9's jconsole.
sla
parents: 28909
diff changeset
   127
	        -e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ 	]*#.*/#/g' \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 42140
diff changeset
   128
	    | $(SED) -f "$(TOPDIR)/make/common/support/unicode2x.sed" \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   129
	    | $(SED) -e '/^#/d' -e '/^$$$$/d' \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   130
	        -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
24080
8bfff14321a9 8041265: jdk/bin/rmic -iiop failed on macosx-x86_64 with "Class sun.rmi.rmic.iiop.BatchEnvironmen not found"
erikj
parents: 23983
diff changeset
   131
	        -e 's/^[ 	]*//;s/[ 	]*$$$$//' \
27591
f8f4973d2329 8065138: Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8'
erikj
parents: 26671
diff changeset
   132
	        -e 's/\\=/=/' \
f8f4973d2329 8065138: Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8'
erikj
parents: 26671
diff changeset
   133
	    | $(SORT) > $$@
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   134
	$(CHMOD) -f ug+w $$@
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   135
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   136
    # And do not forget this target
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   137
    $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   138
  endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   139
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   140
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   141
define remove_string
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   142
  $2 := $$(subst $1,,$$($2))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   143
endef
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   144
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   145
# Setup make rules for compiling Java source code to class files and/or a
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   146
# resulting jar file.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   147
#
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   148
# 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: 27591
diff changeset
   149
# and the targets generated are listed in a variable by that name.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   150
#
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   151
# The target for public API digest is returned in $1_API_TARGET.
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   152
#
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   153
# Remaining parameters are named arguments. These include:
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   154
#   SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   155
#   JVM:=path to ..bin/java
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   156
#   ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   157
#   SRC:=one or more directories to search for sources. The order of the source roots
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   158
#        is significant. The first found file of a certain name has priority.
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   159
#   BIN:=store classes here
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   160
#   MODULE:=Name of module being compiled. If set, classes are put in BIN/MODULE.
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   161
#   CLASSPATH:=a list of additional entries to set as classpath to javac
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   162
#   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   163
#   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   164
#   COPY:=.prp means copy all prp files to the corresponding package in BIN.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   165
#   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   166
#   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   167
#   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   168
#   SRCZIP:=Create a src.zip based on the found sources and copied files.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   169
#   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   170
#   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   171
#       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
47364
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   172
#   EXTRA_FILES:=List of extra source files to include in compilation. Can be used to
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   173
#       specify files that need to be generated by other rules first.
27592
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   174
#   HEADERS:=path to directory where all generated c-headers are written.
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   175
#   DEPENDS:=Extra dependecy
af7df0dd5ff7 8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents: 27591
diff changeset
   176
#   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
32720
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   177
#   KEEP_DUPS:=Do not remove duplicate file names from different source roots.
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   178
#   FAIL_NO_SRC:=Set to false to not fail the build if no source files are found,
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   179
#        default is true.
42140
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   180
#   DEBUG_SYMBOLS:=Set to false to disable generation of debug symbols.
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   181
#   CREATE_API_DIGEST:=Set to true to use a javac plugin to generate a public API
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   182
#        hash which can be used for down stream dependencies to only rebuild
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   183
#        when the API changes. Implicitly used in sjavac.
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   184
#   KEEP_ALL_TRANSLATIONS:=Set to true to skip translation filtering
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29174
diff changeset
   185
SetupJavaCompilation = $(NamedParamsMacroTemplate)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29174
diff changeset
   186
define SetupJavaCompilationBody
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   187
28902
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 27866
diff changeset
   188
  # Verify arguments
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 27866
diff changeset
   189
  ifeq ($$($1_BIN),)
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 27866
diff changeset
   190
    $$(error Must specify BIN (in $1))
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 27866
diff changeset
   191
  endif
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 27866
diff changeset
   192
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   193
  # Extract the info from the java compiler setup.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   194
  $1_JVM := $$($$($1_SETUP)_JVM)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   195
  $1_JAVAC := $$($$($1_SETUP)_JAVAC)
42140
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   196
  $1_FLAGS :=
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   197
  ifneq ($$($1_DEBUG_SYMBOLS), false)
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   198
    $1_FLAGS := -g
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   199
  endif
a2ea75dd99dc 8170280: Enable -g for all java compilation in the build
erikj
parents: 41458
diff changeset
   200
  $1_FLAGS += $$($$($1_SETUP)_FLAGS) $$($1_ADD_JAVAC_FLAGS) $(JAVAC_FLAGS)
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   201
  ifneq ($$($1_CLASSPATH), )
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   202
    $1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH))
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   203
  endif
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   204
  ifeq ($$($1_JAVAC),)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   205
    $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   206
  endif
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   207
  $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   208
  $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
33055
3676b99f33cf 8140312: Enable new sjavac server only mode in jdk build
erikj
parents: 32807
diff changeset
   209
  $1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC)
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   210
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   211
  ifneq ($$($1_MODULE), )
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   212
    $1_MODULE_SUBDIR := /$$($1_MODULE)
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   213
  endif
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   214
47364
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   215
  # Make sure the dirs exist, or that one of the EXTRA_FILES, that may not
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   216
  # exist yet, is in it.
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   217
  $$(foreach d, $$($1_SRC), \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   218
    $$(if $$(wildcard $$d), , \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   219
      $$(if $$(filter $$d%, $$($1_EXTRA_FILES)), , \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   220
        $$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<) \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   221
      ) \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   222
    ) \
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   223
  )
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 28360
diff changeset
   224
  $$(call MakeDir,$$($1_BIN))
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 27592
diff changeset
   225
  # Add all source roots to the find cache since we are likely going to run find
23170
51e606ecede5 8037281: Improve CacheFind and enable on all platforms
erikj
parents: 23169
diff changeset
   226
  # on these more than once. The cache will only be updated if necessary.
47364
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   227
  $$(eval $$(call FillCacheFind, $$($1_SRC)))
33442
f75b19e407af 8141414: Deprecate configure source overriding
ihse
parents: 33438
diff changeset
   228
  # Find all files in the source trees. Preserve order of source roots so that
f75b19e407af 8141414: Deprecate configure source overriding
ihse
parents: 33438
diff changeset
   229
  # the first version in case of multiple instances of the same file is selected.
f75b19e407af 8141414: Deprecate configure source overriding
ihse
parents: 33438
diff changeset
   230
  # CacheFind does not preserve order so need to call it for each root.
47364
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   231
  $1_ALL_SRCS += $$($1_EXTRA_FILES) $$(foreach s, $$($1_SRC), $$(call CacheFind, $$s))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   232
  # Extract the java files.
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   233
  $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   234
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   235
  # Translate include/exclude into patterns
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   236
  ifneq ($$($1_EXCLUDE_FILES), )
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   237
    $1_EXCLUDE_PATTERN := $$(addprefix %, $$($1_EXCLUDE_FILES))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   238
  endif
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   239
  ifneq ($$($1_INCLUDE_FILES), )
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   240
    $1_INCLUDE_PATTERN := $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$($1_INCLUDE_FILES)))
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   241
  endif
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   242
  ifneq ($$($1_EXCLUDES), )
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   243
    $1_EXCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_EXCLUDES))))
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   244
  endif
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   245
  ifneq ($$($1_INCLUDES), )
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   246
    $1_INCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_INCLUDES))))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   247
  endif
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   248
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   249
  # Apply include/exclude patterns to java sources
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   250
  ifneq ($$($1_EXCLUDE_PATTERN), )
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   251
    $1_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_SRCS))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   252
  endif
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   253
  ifneq ($$($1_INCLUDE_PATTERN), )
47364
6b3389375f31 8189094: Change required boot jdk to JDK 9
erikj
parents: 47217
diff changeset
   254
    $1_SRCS := $$(filter $$($1_INCLUDE_PATTERN) $$($1_EXTRA_FILES), $$($1_SRCS))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   255
  endif
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   256
32720
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   257
  ifneq ($$($1_KEEP_DUPS), true)
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   258
    # Remove duplicate source files by keeping the first found of each duplicate.
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   259
    # This allows for automatic overrides with custom or platform specific versions
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   260
    # source files.
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   261
    #
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   262
    # For the smart javac wrapper case, add each removed file to an extra exclude
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   263
    # file list to prevent sjavac from finding duplicate sources.
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   264
    $1_SRCS := $$(strip $$(foreach s, $$($1_SRCS), \
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   265
        $$(eval relative_src := $$(call remove-prefixes, $$($1_SRC), $$(s))) \
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   266
        $$(if $$($1_$$(relative_src)), \
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   267
          $$(eval $1_SJAVAC_EXCLUDE_FILES += $$(s)), \
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   268
          $$(eval $1_$$(relative_src) := 1) $$(s))))
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   269
  endif
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29442
diff changeset
   270
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   271
  # Filter out any excluded translations
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   272
  ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   273
    $1_SRCS := $$(call FilterExcludedTranslations, $$($1_SRCS), .java)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   274
  endif
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   275
32720
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   276
  ifeq ($$(strip $$($1_SRCS)), )
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   277
    ifneq ($$($1_FAIL_NO_SRC), false)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   278
      $$(error No source files found for $1)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   279
    endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   280
  else
32720
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   281
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   282
    $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
32720
7e0e586a6817 8137014: Various improvements in build infrastructure
ihse
parents: 32717
diff changeset
   283
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   284
    # All files below META-INF are always copied.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   285
    $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   286
    # Find all files to be copied from source to bin.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   287
    ifneq (,$$($1_COPY)$$($1_COPY_FILES))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   288
      # Search for all files to be copied.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   289
      $1_ALL_COPIES += $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   290
      # Copy these explicitly
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   291
      $1_ALL_COPIES += $$($1_COPY_FILES)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   292
    endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   293
    # Copy must also respect filters.
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   294
    ifneq (,$$($1_INCLUDE_PATTERN))
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   295
      $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   296
    endif
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 34102
diff changeset
   297
    ifneq (,$$($1_EXCLUDE_PATTERN))
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   298
      $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   299
    endif
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   300
    # Filter out any excluded translations
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   301
    ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   302
      $1_ALL_COPIES := $$(call FilterExcludedTranslations, $$($1_ALL_COPIES), .properties)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   303
    endif
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   304
    ifneq (,$$($1_ALL_COPIES))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   305
      # Yep, there are files to be copied!
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   306
      $1_ALL_COPY_TARGETS:=
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   307
          $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   308
      # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   309
    endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   310
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   311
    # Find all property files to be copied and cleaned from source to bin.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   312
    ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   313
      # Search for all files to be copied.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   314
      $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   315
      # Clean these explicitly
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   316
      $1_ALL_CLEANS += $$($1_CLEAN_FILES)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   317
      # Copy and clean must also respect filters.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   318
      ifneq (,$$($1_INCLUDE_PATTERN))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   319
        $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   320
      endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   321
      ifneq (,$$($1_EXCLUDE_PATTERN))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   322
        $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   323
      endif
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   324
      # Filter out any excluded translations
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   325
      ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   326
        $1_ALL_CLEANS := $$(call FilterExcludedTranslations, $$($1_ALL_CLEANS), .properties)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 48406
diff changeset
   327
      endif
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   328
      ifneq (,$$($1_ALL_CLEANS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   329
        # Yep, there are files to be copied and cleaned!
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   330
        $1_ALL_COPY_CLEAN_TARGETS:=
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   331
            $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_clean,$1,$$i)))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   332
        # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   333
      endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   334
    endif
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   335
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   336
    # Create a sed expression to remove the source roots and to replace / with .
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   337
    # and remove .java at the end.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   338
    $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
33055
3676b99f33cf 8140312: Enable new sjavac server only mode in jdk build
erikj
parents: 32807
diff changeset
   339
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   340
    # Create SJAVAC variable from JAVAC variable. Expects $1_JAVAC to be
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   341
    # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   342
    # and javac is simply replaced with sjavac.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   343
    $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33442
diff changeset
   344
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   345
    # Set the $1_REMOTE to spawn a background javac server.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   346
    $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   347
        $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   348
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   349
    $1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   350
    $1_API_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   351
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   352
    ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   353
      # Using sjavac to compile.
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33442
diff changeset
   354
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   355
      # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   356
      # match the absolute path, only the part inside each src dir. Instead -i and
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   357
      # -x flags apply only to the next -src arg on the command line.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   358
      $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   359
      $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   360
      $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   361
          $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   362
          $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   363
          $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   364
          $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   365
          $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   366
          -src $$(s))
35009
8b6dd0d6ffe0 8147449: sjavac builds of jdk9/dev with closed sources broken
erikj
parents: 34924
diff changeset
   367
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   368
      ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   369
        $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   370
        $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   371
      else
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   372
        $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   373
      endif
35009
8b6dd0d6ffe0 8147449: sjavac builds of jdk9/dev with closed sources broken
erikj
parents: 34924
diff changeset
   374
8b6dd0d6ffe0 8147449: sjavac builds of jdk9/dev with closed sources broken
erikj
parents: 34924
diff changeset
   375
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   376
      ifneq (,$$($1_HEADERS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   377
        $1_HEADERS_ARG := -h $$($1_HEADERS)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   378
      endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   379
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   380
      $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   381
          $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   382
          $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   383
      $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   384
          $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 28360
diff changeset
   385
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   386
      $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   387
		$$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   388
		$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   389
                ifneq ($$($1_SJAVAC_ARGS_FILE), )
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   390
		  $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   391
                endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   392
		$$(call LogWarn, Compiling $1)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   393
		$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   394
		    $$($1_JVM) $$($1_SJAVAC) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   395
		        $$($1_REMOTE) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   396
		        -j 1 \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   397
		        --permit-unidentified-artifacts \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   398
		        --permit-sources-without-package \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   399
		        --compare-found-sources $$@.tmp \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   400
		        --log=$(LOG_LEVEL) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   401
		        --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   402
		        $$($1_SJAVAC_ARGS) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   403
		        $$($1_FLAGS) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   404
		        $$($1_HEADERS_ARG) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   405
		        -d $$($1_BIN)) && \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   406
		$(MV) $$@.tmp $$@
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   407
                # Create a pubapi file that only changes when the pubapi changes. Dependent
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   408
                # compilations can use this file to only get recompiled when pubapi has changed.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   409
                # Grep returns 1 if no matching lines are found. Do not fail for this.
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   410
		$(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   411
		    > $$($1_API_TARGET).tmp || test "$$$$?" = "1"
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   412
		if [ ! -f $$($1_API_TARGET) ] \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   413
		    || [ "`$(DIFF) $$($1_API_TARGET) $$($1_API_TARGET).tmp`" != "" ]; then \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   414
		  $(MV) $$($1_API_TARGET).tmp $$($1_API_TARGET); \
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   415
		fi
26129
5ca768410aba 8055922: Work around sjavac limitation with public api tracking cross modules
erikj
parents: 25854
diff changeset
   416
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   417
    else
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   418
      # Using plain javac to batch compile everything.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   419
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   420
      # When building in batch, put headers in a temp dir to filter out those that actually
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   421
      # changed before copying them to the real header dir.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   422
      ifneq (,$$($1_HEADERS))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   423
        $1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   424
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   425
        $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
52065
dea8a62cdfc3 8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents: 52018
diff changeset
   426
		$$(call MakeTargetDir)
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   427
		if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   428
		  for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   429
		    if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   430
		        || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   431
		      $(MKDIR) -p `$(DIRNAME) $$($1_HEADERS)/$$$$f`; \
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   432
		      $(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
17612cee3530 8142968: Module System implementation
alanb
parents: 35444
diff changeset
   433
		    fi; \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   434
		  done; \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   435
		fi
22481
e0f8e9039971 8033210: Intermittent build failure: jdk8 fails on win_i586 in jdk/make (p11_convert.c(67) : Cannot open 'sun_security_pkcs11_wrapper_PKCS11.h)
erikj
parents: 22480
diff changeset
   436
		$(RM) -r $$($1_HEADERS).$1.tmp
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   437
		$(TOUCH) $$@
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   438
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   439
        $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   440
      endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   441
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   442
      $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   443
          $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   444
          $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   445
      $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   446
          $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   447
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   448
      ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   449
        $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   450
      else
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   451
        $1_JAVAC_CMD := $$($1_JAVAC)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   452
      endif
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 28360
diff changeset
   453
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   454
      ifeq ($$($1_CREATE_API_DIGEST), true)
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   455
        $1_API_DIGEST_FLAGS := \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   456
            -classpath $(BUILDTOOLS_OUTPUTDIR)/depend \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   457
            -Xplugin:"depend $$($1_API_TARGET)" \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   458
            #
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   459
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   460
        $1_EXTRA_DEPS := $(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   461
      endif
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   462
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   463
      # When not using sjavac, pass along all sources to javac using an @file.
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   464
      $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE) \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   465
          $$($1_EXTRA_DEPS)
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   466
		$$(call MakeDir, $$(@D))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   467
		$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   468
		$$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   469
		$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   470
		    $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   471
		        -implicit:none \
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   472
		        $$($1_API_DIGEST_FLAGS) \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   473
		        -d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   474
		$(MV) $$@.tmp $$@
33055
3676b99f33cf 8140312: Enable new sjavac server only mode in jdk build
erikj
parents: 32807
diff changeset
   475
    endif
3676b99f33cf 8140312: Enable new sjavac server only mode in jdk build
erikj
parents: 32807
diff changeset
   476
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   477
    # Add all targets to main variable
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   478
    $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   479
        $$($1_HEADER_TARGETS)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   480
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   481
    # Check if a jar file was specified, then setup the rules for the jar.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   482
    ifneq (,$$($1_JAR))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   483
      # If no suffixes was explicitly set for this jar file.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   484
      # Use class and the cleaned/copied properties file suffixes as the default
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   485
      # for the types of files to be put into the jar.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   486
      ifeq (,$$($1_SUFFIXES))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   487
        $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   488
      endif
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
   489
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   490
      $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   491
          DEPENDENCIES:=$$($1), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   492
          SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   493
          SUFFIXES:=$$($1_SUFFIXES), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   494
          EXCLUDE:=$$($1_EXCLUDES), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   495
          INCLUDES:=$$($1_INCLUDES), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   496
          EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   497
          JAR:=$$($1_JAR), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   498
          JARMAIN:=$$($1_JARMAIN), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   499
          MANIFEST:=$$($1_MANIFEST), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   500
          EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   501
          JARINDEX:=$$($1_JARINDEX), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   502
          HEADERS:=$$($1_HEADERS), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   503
          SETUP:=$$($1_SETUP), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   504
      ))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   505
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   506
      # Add jar to target list
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   507
      $1 += $$($1_JAR)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   508
    endif
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   509
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   510
    # Check if a srczip was specified, then setup the rules for the srczip.
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   511
    ifneq (,$$($1_SRCZIP))
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   512
      $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   513
          SRC:=$$($1_SRC), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   514
          ZIP:=$$($1_SRCZIP), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   515
          INCLUDES:=$$($1_INCLUDES), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   516
          EXCLUDES:=$$($1_EXCLUDES), \
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   517
          EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
22480
d1be923b168a 8026773: Failing compilation in Corba does not fail the build
erikj
parents: 22469
diff changeset
   518
38847
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   519
      # Add zip to target list
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   520
      $1 += $$($1_SRCZIP)
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   521
    endif
57689ec78480 8055735: JDK_FILTER is broken
erikj
parents: 37771
diff changeset
   522
  endif # Source files found
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   523
endef
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   524
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   525
# Use this macro to find the correct target to depend on when the original
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   526
# SetupJavaCompilation is declared in a different makefile, to avoid having
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   527
# to declare and evaluate it again.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   528
# param 1 is for example BUILD_MYPACKAGE
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 24080
diff changeset
   529
# param 2 is the output directory (BIN)
47398
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   530
SetupJavaCompilationCompileTarget = \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   531
    $(strip $2)/_the.$(strip $1)_batch
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   532
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   533
SetupJavaCompilationApiTarget = \
1fd27535bc57 8182285: Speeding up incremental build by hashing module APIs
erikj
parents: 47364
diff changeset
   534
    $(strip $2)/_the.$(strip $1)_pubapi
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 28360
diff changeset
   535
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 28360
diff changeset
   536
endif # _JAVA_COMPILATION_GMK