aboutsummaryrefslogtreecommitdiff
path: root/make/common
diff options
context:
space:
mode:
authorkvn <none@none>2013-12-05 15:12:22 -0800
committerkvn <none@none>2013-12-05 15:12:22 -0800
commitfb8ed7dc2a5957e512925da204b77598c15666ba (patch)
tree0b644f6815725dbb5c4a227e07ea28063ee6b48c /make/common
parent2ab67a8e49c1db8ccfc3b70abb9f18240a6ae018 (diff)
parente26ea81268ef8c1180ffafb488dc0679de7691ee (diff)
downloadjdk8u-fb8ed7dc2a5957e512925da204b77598c15666ba.tar.gz
Merge
Diffstat (limited to 'make/common')
-rw-r--r--make/common/CORE_PKGS.gmk300
-rw-r--r--make/common/IdlCompilation.gmk106
-rw-r--r--make/common/JavaCompilation.gmk594
-rw-r--r--make/common/MakeBase.gmk449
-rw-r--r--make/common/NON_CORE_PKGS.gmk110
-rw-r--r--make/common/NativeCompilation.gmk594
-rw-r--r--make/common/RMICompilation.gmk96
-rw-r--r--make/common/support/ListPathsSafely-post-compress.incl1
-rw-r--r--make/common/support/ListPathsSafely-pre-compress.incl1
-rw-r--r--make/common/support/ListPathsSafely-uncompress.sed72
-rw-r--r--make/common/support/unicode2x.sed100
11 files changed, 2423 insertions, 0 deletions
diff --git a/make/common/CORE_PKGS.gmk b/make/common/CORE_PKGS.gmk
new file mode 100644
index 0000000..9c85da6
--- /dev/null
+++ b/make/common/CORE_PKGS.gmk
@@ -0,0 +1,300 @@
+#
+# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# EXCLUDE_PKGS is the list of packages to exclude from the
+# Java API Specification. Do not add these to CORE_PKGS.
+# The concatenation of EXCLUDE_PKGS and CORE_PKGS
+# should make up the list of all packages under the
+# src/shared/classes directory of the JDK source tree.
+#
+EXCLUDE_PKGS = \
+ java.awt.peer \
+ java.awt.dnd.peer \
+ sun.* \
+ com.sun.* \
+ org.apache.* \
+ org.jcp.* \
+ org.w3c.dom.css \
+ org.w3c.dom.html \
+ org.w3c.dom.stylesheets \
+ org.w3c.dom.traversal \
+ org.w3c.dom.ranges \
+ org.omg.stub.javax.management.remote.rmi
+
+#
+# ACTIVE_JSR_PKGS are packages that are part of an active JSR process--
+# one that is doing its own review. These packages are not included when
+# creating diff pages for the platform's JCP process.
+#
+# (see /java/pubs/apisrc/jdk/6.0/beta/make/docs/active_jsr_pkgs)
+# Note:
+# This is a list of regular expressions. So foo.* matches "foo" and "foo.bar".
+#
+ACTIVE_JSR_PKGS= \
+ java.lang.invoke \
+ java.sql \
+ javax.activation \
+ javax.annotation.* \
+ javax.jws.* \
+ javax.lang.* \
+ javax.management.* \
+ javax.script \
+ javax.sql.* \
+ javax.tools.* \
+ javax.xml.* \
+ org.w3c.* \
+ org.xml.sax
+
+#
+# CORE_PKGS is the list of packages that form the
+# Java API Specification.
+#
+### ***IMPORTANT NOTE***
+### There is also a "REGEXP" variable in the docs/makefile that
+### determines which table the packages go in on the main page.
+### Currently, there is only table ("Platform Packages") and
+### everything goes in it, so REGEXP is "*". But if that policy
+### changes, packages added will need to be reflected in that
+### list of wildcard expressions, as well.
+###
+CORE_PKGS = \
+ java.applet \
+ java.awt \
+ java.awt.color \
+ java.awt.datatransfer \
+ java.awt.dnd \
+ java.awt.event \
+ java.awt.font \
+ java.awt.geom \
+ java.awt.im \
+ java.awt.im.spi \
+ java.awt.image \
+ java.awt.image.renderable \
+ java.awt.print \
+ java.beans \
+ java.beans.beancontext \
+ java.io \
+ java.lang \
+ java.lang.annotation \
+ java.lang.instrument \
+ java.lang.invoke \
+ java.lang.management \
+ java.lang.ref \
+ java.lang.reflect \
+ java.math \
+ java.net \
+ java.nio \
+ java.nio.channels \
+ java.nio.channels.spi \
+ java.nio.charset \
+ java.nio.charset.spi \
+ java.nio.file \
+ java.nio.file.attribute \
+ java.nio.file.spi \
+ java.rmi \
+ java.rmi.activation \
+ java.rmi.dgc \
+ java.rmi.registry \
+ java.rmi.server \
+ java.security \
+ java.security.acl \
+ java.security.cert \
+ java.security.interfaces \
+ java.security.spec \
+ java.sql \
+ java.text \
+ java.text.spi \
+ java.time \
+ java.time.chrono \
+ java.time.format \
+ java.time.temporal \
+ java.time.zone \
+ java.util \
+ java.util.concurrent \
+ java.util.concurrent.atomic \
+ java.util.concurrent.locks \
+ java.util.function \
+ java.util.jar \
+ java.util.logging \
+ java.util.prefs \
+ java.util.regex \
+ java.util.spi \
+ java.util.stream \
+ java.util.zip \
+ javax.accessibility \
+ javax.activation \
+ javax.activity \
+ javax.annotation \
+ javax.annotation.processing \
+ javax.crypto \
+ javax.crypto.interfaces \
+ javax.crypto.spec \
+ javax.imageio \
+ javax.imageio.event \
+ javax.imageio.metadata \
+ javax.imageio.plugins.jpeg \
+ javax.imageio.plugins.bmp \
+ javax.imageio.spi \
+ javax.imageio.stream \
+ javax.jws \
+ javax.jws.soap \
+ javax.lang.model \
+ javax.lang.model.element \
+ javax.lang.model.type \
+ javax.lang.model.util \
+ javax.management \
+ javax.management.loading \
+ javax.management.monitor \
+ javax.management.relation \
+ javax.management.openmbean \
+ javax.management.timer \
+ javax.management.modelmbean \
+ javax.management.remote \
+ javax.management.remote.rmi \
+ javax.naming \
+ javax.naming.directory \
+ javax.naming.event \
+ javax.naming.ldap \
+ javax.naming.spi \
+ javax.net \
+ javax.net.ssl \
+ javax.print \
+ javax.print.attribute \
+ javax.print.attribute.standard \
+ javax.print.event \
+ javax.rmi \
+ javax.rmi.CORBA \
+ javax.rmi.ssl \
+ javax.script \
+ javax.security.auth \
+ javax.security.auth.callback \
+ javax.security.auth.kerberos \
+ javax.security.auth.login \
+ javax.security.auth.spi \
+ javax.security.auth.x500 \
+ javax.security.cert \
+ javax.security.sasl \
+ javax.sound.sampled \
+ javax.sound.sampled.spi \
+ javax.sound.midi \
+ javax.sound.midi.spi \
+ javax.sql \
+ javax.sql.rowset \
+ javax.sql.rowset.serial \
+ javax.sql.rowset.spi \
+ javax.swing \
+ javax.swing.border \
+ javax.swing.colorchooser \
+ javax.swing.filechooser \
+ javax.swing.event \
+ javax.swing.table \
+ javax.swing.text \
+ javax.swing.text.html \
+ javax.swing.text.html.parser \
+ javax.swing.text.rtf \
+ javax.swing.tree \
+ javax.swing.undo \
+ javax.swing.plaf \
+ javax.swing.plaf.basic \
+ javax.swing.plaf.metal \
+ javax.swing.plaf.multi \
+ javax.swing.plaf.nimbus \
+ javax.swing.plaf.synth \
+ javax.tools \
+ javax.tools.annotation \
+ javax.transaction \
+ javax.transaction.xa \
+ javax.xml.parsers \
+ javax.xml.bind \
+ javax.xml.bind.annotation \
+ javax.xml.bind.annotation.adapters \
+ javax.xml.bind.attachment \
+ javax.xml.bind.helpers \
+ javax.xml.bind.util \
+ javax.xml.soap \
+ javax.xml.ws \
+ javax.xml.ws.handler \
+ javax.xml.ws.handler.soap \
+ javax.xml.ws.http \
+ javax.xml.ws.soap \
+ javax.xml.ws.spi \
+ javax.xml.ws.spi.http \
+ javax.xml.ws.wsaddressing \
+ javax.xml.transform \
+ javax.xml.transform.sax \
+ javax.xml.transform.dom \
+ javax.xml.transform.stax \
+ javax.xml.transform.stream \
+ javax.xml \
+ javax.xml.crypto \
+ javax.xml.crypto.dom \
+ javax.xml.crypto.dsig \
+ javax.xml.crypto.dsig.dom \
+ javax.xml.crypto.dsig.keyinfo \
+ javax.xml.crypto.dsig.spec \
+ javax.xml.datatype \
+ javax.xml.validation \
+ javax.xml.namespace \
+ javax.xml.xpath \
+ javax.xml.stream \
+ javax.xml.stream.events \
+ javax.xml.stream.util \
+ org.ietf.jgss \
+ org.omg.CORBA \
+ org.omg.CORBA.DynAnyPackage \
+ org.omg.CORBA.ORBPackage \
+ org.omg.CORBA.TypeCodePackage \
+ org.omg.stub.java.rmi \
+ org.omg.CORBA.portable \
+ org.omg.CORBA_2_3 \
+ org.omg.CORBA_2_3.portable \
+ org.omg.CosNaming \
+ org.omg.CosNaming.NamingContextExtPackage \
+ org.omg.CosNaming.NamingContextPackage \
+ org.omg.SendingContext \
+ org.omg.PortableServer \
+ org.omg.PortableServer.CurrentPackage \
+ org.omg.PortableServer.POAPackage \
+ org.omg.PortableServer.POAManagerPackage \
+ org.omg.PortableServer.ServantLocatorPackage \
+ org.omg.PortableServer.portable \
+ org.omg.PortableInterceptor \
+ org.omg.PortableInterceptor.ORBInitInfoPackage \
+ org.omg.Messaging \
+ org.omg.IOP \
+ org.omg.IOP.CodecFactoryPackage \
+ org.omg.IOP.CodecPackage \
+ org.omg.Dynamic \
+ org.omg.DynamicAny \
+ org.omg.DynamicAny.DynAnyPackage \
+ org.omg.DynamicAny.DynAnyFactoryPackage \
+ org.w3c.dom \
+ org.w3c.dom.events \
+ org.w3c.dom.bootstrap \
+ org.w3c.dom.ls \
+ org.w3c.dom.views \
+ org.xml.sax \
+ org.xml.sax.ext \
+ org.xml.sax.helpers
diff --git a/make/common/IdlCompilation.gmk b/make/common/IdlCompilation.gmk
new file mode 100644
index 0000000..d816f23
--- /dev/null
+++ b/make/common/IdlCompilation.gmk
@@ -0,0 +1,106 @@
+#
+# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+PREFIXES=-pkgPrefix CORBA org.omg \
+ -pkgPrefix CosNaming org.omg \
+ -pkgPrefix CosTransactions org.omg \
+ -pkgPrefix CosTSInteroperation org.omg \
+ -pkgPrefix DynamicAny org.omg \
+ -pkgPrefix Dynamic org.omg \
+ -pkgPrefix IOP org.omg \
+ -pkgPrefix Messaging org.omg \
+ -pkgPrefix PortableInterceptor org.omg \
+ -pkgPrefix PortableServer org.omg \
+ -pkgPrefix activation com.sun.corba.se.spi \
+ -pkgPrefix GIOP com.sun.corba.se \
+ -pkgPrefix PortableActivationIDL com.sun.corba.se \
+ -pkgPrefix messages com.sun.corba.se
+
+define add_idl_package
+ # param 1 = MYPACKAGE
+ # param 2 = src root
+ # param 3 = gensrc root
+ # param 4 = source idl to compile
+ # param 5 = target idl package
+ # param 6 = delete these files that were output from the idlj
+ # param 7 = idls that match these patterns should be compiled with -oldImplBase
+ # param 8 = the idlj command
+ # Save the generated java files to a temporary directory so
+ # that we can find them and create proper dependencies.
+ # After that, we move them to the real gensrc target dir.
+ $4_TMPDIR:=tmp___$(subst /,_,$(patsubst $2/%,%,$4))___
+ ifneq ($$(filter $7,$4),)
+ $4_OLDIMPLBASE:=-oldImplBase
+ $4_OLDIMPLBASE_MSG:=with -oldImplBase
+ endif
+ $5 : $4
+ $(MKDIR) -p $3/$$($4_TMPDIR)
+ $(RM) -rf $3/$$($4_TMPDIR)
+ $(MKDIR) -p $(dir $5)
+ $(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
+ $8 -td $3/$$($4_TMPDIR) \
+ -i $2/org/omg/CORBA \
+ -i $2/org/omg/PortableInterceptor \
+ -i $2/org/omg/PortableServer \
+ -D CORBA3 -corba 3.0 \
+ -fall \
+ $$($4_OLDIMPLBASE) \
+ $(PREFIXES) \
+ $4
+ $(RM) -f $$(addprefix $3/$$($4_TMPDIR)/,$6)
+ $(CP) -r $3/$$($4_TMPDIR)/* $3
+ ($(CD) $3/$$($4_TMPDIR) && $(FIND) . -type f | $(SED) 's!\./!$3/!g' | $(NAWK) '{ print $$$$1 ": $4" }' > $5)
+ $(RM) -rf $3/$$($4_TMPDIR)
+endef
+
+define SetupIdlCompilation
+ # param 1 is for example BUILD_IDLS
+ # param 2,3,4,5,6,7,8 are named args.
+ # IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
+
+ # Find all existing java files and existing class files.
+ $$(eval $$(call MakeDir,$$($1_BIN)))
+ $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl")
+ $1_BINS := $$(shell find $$($1_BIN) -name "*.java")
+ # Prepend the source/bin path to the filter expressions.
+ $1_SRC_INCLUDES := $$(addprefix $$($1_SRC)/,$$($1_INCLUDES))
+ $1_SRC_EXCLUDES := $$(addprefix $$($1_SRC)/,$$($1_EXCLUDES))
+ $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$($1_INCLUDES))
+ $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$($1_EXCLUDES))
+ $1_OLDIMPLBASES := $$(addprefix $$($1_SRC)/,$$($1_OLDIMPLBASES))
+ # Now remove unwanted java/class files.
+ $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
+ $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+ $1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
+ $1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
+ $1 := $$(sort $$(patsubst $$($1_SRC)/%.idl,$$($1_BIN)/%.idl.d,$$($1_SRCS)))
+ # Now create the dependencies for each idl target.
+ $$(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))))
+endef
+
+.SUFFIXES: .java .class .package
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
new file mode 100644
index 0000000..d192c66
--- /dev/null
+++ b/make/common/JavaCompilation.gmk
@@ -0,0 +1,594 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This makefile is much simpler now that it can use the smart javac wrapper
+# for dependency tracking between java packages and incremental compiles.
+# It could be even more simple if we added support for incremental jar updates
+# directly from the smart javac wrapper.
+
+# Cleaning/copying properties here is not a good solution. The properties
+# should be cleaned/copied by a annotation processor in sjavac.
+
+# When you read this source. Remember that $(sort ...) has the side effect
+# of removing duplicates. It is actually this side effect that is
+# desired whenever sort is used below!
+
+ifeq (,$(_MAKEBASE_GMK))
+ $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
+endif
+
+FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
+
+define SetupJavaCompiler
+ # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE
+ # This is the name of the compiler setup.
+ # param 2-9 are named args.
+ # JVM:=The jvm used to run the javac/javah command
+ # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
+ # FLAGS:=Flags to be supplied to javac
+ # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
+ # SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
+
+ # The port file contains the tcp/ip on which the server listens
+ # and the cookie necessary to talk to the server.
+ $1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
+ # You can use a different JVM to run the background javac server.
+ ifeq ($$($1_SERVER_JVM),)
+ # It defaults to the same JVM that is used to start the javac command.
+ $1_SERVER_JVM:=$$($1_JVM)
+ endif
+endef
+
+define SetupArchive
+ # param 1 is for example ARCHIVE_MYPACKAGE
+ # param 2 are the dependecies
+ # param 3,4,5,6,7,8,9 are named args.
+ # SRCS:=List of directories in where to find files to add to archive
+ # SUFFIXES:=File suffixes to include in jar
+ # INCLUDES:=List of directories/packages in SRCS that should be included
+ # EXCLUDES:=List of directories/packages in SRCS that should be excluded
+ # EXCLUDE_FILES:=List of files in SRCS that should be excluded
+ # EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
+ # JAR:=Jar file to create
+ # MANIFEST:=Optional manifest file template.
+ # JARMAIN:=Optional main class to add to manifest
+ # JARINDEX:=true means generate the index in the jar file.
+ # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
+ # added to the archive.
+ # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
+ # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
+
+ # NOTE: $2 is dependencies, not a named argument!
+ $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(findstring $(LOG_LEVEL),trace), $(info *[2] <dependencies> = $(strip $2)))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
+
+ $1_JARMAIN:=$(strip $$($1_JARMAIN))
+ $1_JARNAME:=$$(notdir $$($1_JAR))
+ $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
+ $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
+ $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
+ $1_BIN:=$$(dir $$($1_JAR))
+
+ ifeq (,$$($1_SUFFIXES))
+ # No suffix was set, default to classes.
+ $1_SUFFIXES:=.class
+ endif
+ # Convert suffixes to a find expression
+ $1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
+ # On windows, a lot of includes/excludes risk making the command line too long, so
+ # writing the grep patterns to files.
+ ifneq (,$$($1_INCLUDES))
+ $1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS), \
+ $$(addprefix $$(src)/,$$($1_INCLUDES)))
+ # If there are a lot of include patterns, output to file to shorten command lines
+ ifeq ($$(word 20,$$($1_GREP_INCLUDE_PATTERNS)),)
+ $1_GREP_INCLUDES:=| $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS))
+ else
+ $1_GREP_INCLUDE_OUTPUT:=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_include $$(NEWLINE) \
+ $$(call ListPathsSafely,$1_GREP_INCLUDE_PATTERNS,\n, \
+ >> $$($1_BIN)/_the.$$($1_JARNAME)_include)
+ $1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include
+ endif
+ endif
+ ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
+ $1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/, \
+ $$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
+ # If there are a lot of include patterns, output to file to shorten command lines
+ ifeq ($$(word 20,$$($1_GREP_EXCLUDE_PATTERNS)),)
+ $1_GREP_EXCLUDES:=| $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS))
+ else
+ $1_GREP_EXCLUDE_OUTPUT=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_exclude $$(NEWLINE) \
+ $$(call ListPathsSafely,$1_GREP_EXCLUDE_PATTERNS,\n, \
+ >> $$($1_BIN)/_the.$$($1_JARNAME)_exclude)
+ $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
+ endif
+ endif
+
+ # Check if this jar needs to have its index generated.
+ ifneq (,$$($1_JARINDEX))
+ $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@))
+ else
+ $1_JARINDEX = true
+ endif
+ # When this macro is run in the same makefile as the java compilation, dependencies are
+ # transfered in make variables. When the macro is run in a different makefile than the
+ # java compilation, the dependencies need to be found in the filesystem.
+ ifneq (,$2)
+ $1_DEPS:=$2
+ else
+ $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
+ $$(call CacheFind,$$($1_SRCS)))
+ ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
+ $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
+ endif
+ ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
+ $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
+ endif
+ # The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command
+ # lines, but not here for use in make dependencies.
+ $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
+ ifeq (,$$($1_SKIP_METAINF))
+ $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
+ endif
+ endif
+
+ # Utility macros, to make the shell script receipt somewhat easier to decipher.
+
+ # The capture contents macro finds all files (matching the patterns, typically
+ # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
+ # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
+ $1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
+ ( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
+ $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
+ $(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES) ) ) > \
+ $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
+ # The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
+ ifeq (,$$($1_SKIP_METAINF))
+ $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
+ endif
+ # The capture deletes macro finds all deleted files and concatenates them. The resulting file
+ # tells us what to remove from the jar-file.
+ $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
+ # The update contents macro updates the jar file with the previously capture contents.
+ # Use 'wc -w' to see if the contents file is empty.
+ $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS), \
+ (cd $$(src) && \
+ if [ "`$(WC) -w _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
+ $(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
+ $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
+ fi) $$(NEWLINE))
+ # The s-variants of the above macros are used when the jar is created from scratch.
+ # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
+ $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
+ ( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
+ $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
+ $$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES) ) ) > \
+ $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
+
+ ifeq (,$$($1_SKIP_METAINF))
+ $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \
+ ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
+ $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
+ endif
+ $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS), \
+ (cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
+
+ # Use a slightly shorter name for logging, but with enough path to identify this jar.
+ $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
+
+ ifneq (,$$($1_CHECK_COMPRESS_JAR))
+ $1_JAR_CREATE_OPTIONS := c0fm
+ $1_JAR_UPDATE_OPTIONS := u0f
+ ifeq ($(COMPRESS_JARS), true)
+ $1_JAR_CREATE_OPTIONS := cfm
+ $1_JAR_UPDATE_OPTIONS := uf
+ endif
+ else
+ $1_JAR_CREATE_OPTIONS := cfm
+ $1_JAR_UPDATE_OPTIONS := uf
+ endif
+
+ # Here is the rule that creates/updates the jar file.
+ $$($1_JAR) : $$($1_DEPS)
+ $(MKDIR) -p $$($1_BIN)
+ $$($1_GREP_INCLUDE_OUTPUT)
+ $$($1_GREP_EXCLUDE_OUTPUT)
+ $$(if $$($1_MANIFEST), \
+ $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
+ -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE) \
+ , \
+ $(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE))
+ $$(if $$($1_JARMAIN),$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE))
+ $$(if $$($1_EXTRA_MANIFEST_ATTR),$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE))
+ $$(if $$(wildcard $$@), \
+ $(ECHO) Modifying $$($1_NAME) $$(NEWLINE) \
+ $$($1_CAPTURE_CONTENTS) \
+ $$($1_CAPTURE_METAINF) \
+ $(RM) $$($1_DELETES_FILE) $$(NEWLINE) \
+ $$($1_CAPTURE_DELETES) \
+ $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE) \
+ if [ -s $$($1_DELETESS_FILE) ]; then \
+ $(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
+ $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
+ fi $$(NEWLINE) \
+ $$($1_UPDATE_CONTENTS) true $$(NEWLINE) \
+ $$($1_JARINDEX) && true \
+ , \
+ $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
+ $$($1_SCAPTURE_CONTENTS) \
+ $$($1_SCAPTURE_METAINF) \
+ $$($1_SUPDATE_CONTENTS) \
+ $$($1_JARINDEX) && true )
+
+endef
+
+define SetupZipArchive
+ # param 1 is for example ZIP_MYSOURCE
+ # param 2,3,4,5,6,7,8,9 are named args.
+ # SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
+
+ # To avoid running find over too large sets of files, which causes make to crash
+ # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
+ # of directories to run find in, if available.
+ ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),)
+ $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \
+ $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES))))
+ else
+ $1_FIND_LIST := $$($1_SRC)
+ endif
+
+ # Find all files in the source tree.
+ $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
+
+ # Filter on suffixes if set
+ ifneq ($$($1_SUFFIXES),)
+ $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
+ endif
+
+ ifneq ($$($1_INCLUDES),)
+ ifneq ($$($1_SUFFIXES),)
+ $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
+ $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
+ else
+ $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
+ endif
+ endif
+ ifneq ($$($1_INCLUDE_FILES),)
+ $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
+ endif
+ ifneq ($$($1_EXCLUDES),)
+ $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
+ $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
+ $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
+ endif
+
+ # Use a slightly shorter name for logging, but with enough path to identify this zip.
+ $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
+
+ # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
+ # I.e. the zip -i and -x options should match the filtering done in the makefile.
+ # Explicitly excluded files can be given with absolute path. The patsubst solution
+ # isn't perfect but the likelyhood of an absolute path to match something in a src
+ # dir is very small.
+ # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
+ # and only fail if it's not.
+ $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
+ $(MKDIR) -p $$(@D)
+ $(ECHO) Updating $$($1_NAME)
+ $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
+ $(TOUCH) $$@
+endef
+
+define add_file_to_copy
+ # param 1 = BUILD_MYPACKAGE
+ # parma 2 = The source file to copy.
+ $2_TARGET:=$2
+ # Remove the source prefix.
+ $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
+ # Now we can setup the depency that will trigger the copying.
+ $$($1_BIN)$$($2_TARGET) : $2
+ $(MKDIR) -p $$(@D)
+ $(CP) $$< $$@
+ $(CHMOD) -f ug+w $$@
+
+ # And do not forget this target
+ $1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET)
+endef
+
+
+# This macro is used only for properties files that are to be
+# copied over to the classes directory in cleaned form:
+# Previously this was inconsistently done in different repositories.
+# This is the new clean standard. Though it is to be superseded by
+# a standard annotation processor from with sjavac.
+define add_file_to_copy_and_clean
+ # param 1 = BUILD_MYPACKAGE
+ # parma 2 = The source file to copy and clean.
+ $2_TARGET:=$2
+ # Remove the source prefix.
+ $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
+ # Now we can setup the depency that will trigger the copying.
+ $$($1_BIN)$$($2_TARGET) : $2
+ $(MKDIR) -p $$(@D)
+ $(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
+ | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
+ | $(SED) -e '/^#/d' -e '/^$$$$/d' \
+ -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
+ -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
+ -e 's/\\=/=/' | LANG=C $(SORT) > $$@
+ $(CHMOD) -f ug+w $$@
+
+ # And do not forget this target
+ $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
+endef
+
+define remove_string
+ $2 := $$(subst $1,,$$($2))
+endef
+
+define replace_space_with_pathsep
+ $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
+endef
+
+define SetupJavaCompilation
+ # param 1 is for example BUILD_MYPACKAGE
+ # param 2,3,4,5,6,7,8 are named args.
+ # SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
+ # JVM:=path to ..bin/java
+ # ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
+ # SRC:=one or more directories to search for sources
+ # BIN:=store classes here
+ # INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
+ # EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
+ # COPY:=.prp means copy all prp files to the corresponding package in BIN.
+ # CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
+ # COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
+ # SRCZIP:=Create a src.zip based on the found sources and copied files.
+ # INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
+ # EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
+ # "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
+ # JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
+ # source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
+ # HEADERS:=path to directory where all generated c-headers are written.
+ # DEPENDS:=Extra dependecy
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
+
+ # Extract the info from the java compiler setup.
+ $1_JVM := $$($$($1_SETUP)_JVM)
+ $1_JAVAC := $$($$($1_SETUP)_JAVAC)
+ $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
+ ifeq ($$($1_JAVAC),)
+ $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
+ endif
+ $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
+ $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
+
+ # Handle addons and overrides.
+ $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
+ # Make sure the dirs exist.
+ $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
+ $$(eval $$(call MakeDir,$$($1_BIN)))
+ # Find all files in the source trees.
+ $1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(call CacheFind,$$($1_SRC)))
+ # Extract the java files.
+ ifneq ($$($1_EXCLUDE_FILES),)
+ $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
+ endif
+ $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
+ ifneq ($$($1_INCLUDE_FILES),)
+ $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
+ $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
+ endif
+
+ # Now we have a list of all java files to compile: $$($1_SRCS)
+
+ # Create the corresponding smart javac wrapper command line.
+ $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \
+ $$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \
+ $$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \
+ $$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
+ -src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))"
+
+ # Prepend the source/bin path to the filter expressions.
+ ifneq ($$($1_INCLUDES),)
+ $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
+ $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
+ endif
+ ifneq ($$($1_EXCLUDES),)
+ $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
+ $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+ endif
+
+ # Find all files to be copied from source to bin.
+ ifneq (,$$($1_COPY))
+ # Search for all files to be copied.
+ $1_ALL_COPIES := $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
+ # Copy these explicitly
+ $1_ALL_COPIES += $$($1_COPY_FILES)
+ # Copy must also respect filters.
+ ifneq (,$$($1_INCLUDES))
+ $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
+ endif
+ ifneq (,$$($1_EXCLUDES))
+ $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
+ endif
+ ifneq (,$$($1_EXCLUDE_FILES))
+ $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
+ endif
+ # All files below META-INF are always copied.
+ $1_ALL_COPIES += $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
+ ifneq (,$$($1_ALL_COPIES))
+ # Yep, there are files to be copied!
+ $1_ALL_COPY_TARGETS:=
+ $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
+ # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
+ endif
+ endif
+
+ # Find all property files to be copied and cleaned from source to bin.
+ ifneq (,$$($1_CLEAN))
+ # Search for all files to be copied.
+ $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
+ # Copy and clean must also respect filters.
+ ifneq (,$$($1_INCLUDES))
+ $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
+ endif
+ ifneq (,$$($1_EXCLUDES))
+ $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
+ endif
+ ifneq (,$$($1_EXCLUDE_FILES))
+ $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
+ endif
+ ifneq (,$$($1_ALL_CLEANS))
+ # Yep, there are files to be copied and cleaned!
+ $1_ALL_COPY_CLEAN_TARGETS:=
+ $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
+ # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+ endif
+ endif
+
+ # Prep the source paths.
+ ifneq ($$($1_JAVAC_SOURCE_PATH_OVERRIDE),)
+ $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_OVERRIDE)))
+ else
+ $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
+ endif
+
+ # Create a sed expression to remove the source roots and to replace / with .
+ # and remove .java at the end.
+ $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
+
+ ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
+ ifneq (,$$($1_HEADERS))
+ $1_HEADERS_ARG := -h $$($1_HEADERS)
+ endif
+
+ # Using sjavac to compile.
+ $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
+
+ # Create SJAVAC variable form JAVAC variable. Expects $1_JAVAC to be
+ # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
+ # and javac is simply replaced with sjavac.
+ $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
+
+ # Set the $1_REMOTE to spawn a background javac server.
+ $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
+
+ $$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
+ $(MKDIR) -p $$(@D)
+ $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
+ $(ECHO) Compiling $1
+ ($$($1_JVM) $$($1_SJAVAC) \
+ $$($1_REMOTE) \
+ -j $(JOBS) \
+ --permit-unidentified-artifacts \
+ --permit-sources-without-package \
+ --compare-found-sources $$($1_BIN)/_the.$1_batch.tmp \
+ --log=$(LOG_LEVEL) \
+ $$($1_SJAVAC_ARGS) \
+ $$($1_FLAGS) \
+ $$($1_HEADERS_ARG) \
+ -d $$($1_BIN) && \
+ $(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
+ else
+ # Using plain javac to batch compile everything.
+ $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.$1_batch
+
+ # When building in batch, put headers in a temp dir to filter out those that actually
+ # changed before copying them to the real header dir.
+ ifneq (,$$($1_HEADERS))
+ $1_HEADERS_ARG := -h $$($1_HEADERS).tmp
+
+ $$($1_HEADERS)/_the.$1_headers: $$($1_BIN)/_the.$1_batch
+ $(MKDIR) -p $$(@D)
+ for f in `ls $$($1_HEADERS).tmp`; do \
+ if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).tmp/$$$$f`" != "" ]; then \
+ $(CP) -f $$($1_HEADERS).tmp/$$$$f $$($1_HEADERS)/$$$$f; \
+ fi; \
+ done
+ $(RM) -r $$($1_HEADERS).tmp
+ $(TOUCH) $$@
+
+ $1 += $$($1_HEADERS)/_the.$1_headers
+ endif
+
+ # When not using sjavac, pass along all sources to javac using an @file.
+ $$($1_BIN)/_the.$1_batch: $$($1_SRCS) $$($1_DEPENDS)
+ $(MKDIR) -p $$(@D)
+ $(RM) $$($1_BIN)/_the.$1_batch $$($1_BIN)/_the.$1_batch.tmp
+ $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
+ $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.$1_batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
+ ($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
+ -implicit:none -sourcepath "$$($1_SRCROOTSC)" \
+ -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.$1_batch.tmp && \
+ $(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
+
+ endif
+
+ # Check if a jar file was specified, then setup the rules for the jar.
+ ifneq (,$$($1_JAR))
+ # If no suffixes was explicitly set for this jar file.
+ # Use class and the cleaned/copied properties file suffixes as the default
+ # for the types of files to be put into the jar.
+ ifeq (,$$($1_SUFFIXES))
+ $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
+ endif
+
+ $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1), \
+ SRCS:=$$($1_BIN), \
+ SUFFIXES:=$$($1_SUFFIXES), \
+ EXCLUDE:=$$($1_EXCLUDES), \
+ INCLUDES:=$$($1_INCLUDES), \
+ EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS), \
+ JAR:=$$($1_JAR), \
+ JARMAIN:=$$($1_JARMAIN), \
+ MANIFEST:=$$($1_MANIFEST), \
+ EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR), \
+ JARINDEX:=$$($1_JARINDEX), \
+ HEADERS:=$$($1_HEADERS), \
+ SETUP:=$$($1_SETUP)))
+ endif
+
+ # Check if a srczip was specified, then setup the rules for the srczip.
+ ifneq (,$$($1_SRCZIP))
+ $$(eval $$(call SetupZipArchive,ARCHIVE_$1, \
+ SRC:=$$($1_SRC), \
+ ZIP:=$$($1_SRCZIP), \
+ INCLUDES:=$$($1_INCLUDES), \
+ EXCLUDES:=$$($1_EXCLUDES), \
+ EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
+ endif
+
+endef
diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
new file mode 100644
index 0000000..2b276c6
--- /dev/null
+++ b/make/common/MakeBase.gmk
@@ -0,0 +1,449 @@
+#
+# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################
+#
+# Check that GNU make and cygwin are recent enough.
+# Setup common utility functions.
+#
+################################################################
+
+ifndef _MAKEBASE_GMK
+_MAKEBASE_GMK := 1
+
+# If the variable that you want to send to stdout for piping into a file or otherwise,
+# is potentially long, for example the a list of file paths, eg a list of all package directories.
+# Then you need to use ListPathsSafely, which optimistically splits the output into several shell
+# calls as well as use compression on recurrent file paths segments, to get around the potential
+# command line length problem that exists in cygwin and other shells.
+compress_pre:=$(strip $(shell $(CAT) $(SRC_ROOT)/make/common/support/ListPathsSafely-pre-compress.incl))
+compress_post:=$(strip $(shell $(CAT) $(SRC_ROOT)/make/common/support/ListPathsSafely-post-compress.incl))
+compress_paths=$(compress_pre)\
+$(subst $(SRC_ROOT),X97,\
+$(subst $(OUTPUT_ROOT),X98,\
+$(subst X,X00,\
+$(subst $(SPACE),\n,$(strip $1)))))\
+$(compress_post)
+
+decompress_paths=$(SED) -f $(SRC_ROOT)/make/common/support/ListPathsSafely-uncompress.sed -e 's|X99|\\n|g' \
+ -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
+ -e 's|X00|X|g' | tr '\n' '$2'
+
+define ListPathsSafely_If
+ $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1)))))
+endef
+
+define ListPathsSafely_Printf
+ $(if $(strip $($1_LPS$4)),$(if $(findstring $(LOG_LEVEL),trace),,@)printf \
+ -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3)
+endef
+
+# Receipt example:
+# rm -f thepaths
+# $(call ListPathsSafely,THEPATHS,\n, >> thepaths)
+# The \n argument means translate spaces into \n
+# if instead , , (a space) is supplied, then spaces remain spaces.
+define ListPathsSafely
+ $(if $(word 16001,$($1)),$(error Cannot list safely more than 16000 paths. $1 has $(words $($1)) paths!))
+ $(ECHO) $(LOG_DEBUG) Writing $(words $($1)) paths to '$3'
+ $(call ListPathsSafely_If,$1,$2,1,250)
+ $(call ListPathsSafely_If,$1,$2,251,500)
+ $(call ListPathsSafely_If,$1,$2,501,750)
+ $(call ListPathsSafely_If,$1,$2,751,1000)
+
+ $(call ListPathsSafely_If,$1,$2,1001,1250)
+ $(call ListPathsSafely_If,$1,$2,1251,1500)
+ $(call ListPathsSafely_If,$1,$2,1501,1750)
+ $(call ListPathsSafely_If,$1,$2,1751,2000)
+
+ $(call ListPathsSafely_If,$1,$2,2001,2250)
+ $(call ListPathsSafely_If,$1,$2,2251,2500)
+ $(call ListPathsSafely_If,$1,$2,2501,2750)
+ $(call ListPathsSafely_If,$1,$2,2751,3000)
+
+ $(call ListPathsSafely_If,$1,$2,3001,3250)
+ $(call ListPathsSafely_If,$1,$2,3251,3500)
+ $(call ListPathsSafely_If,$1,$2,3501,3750)
+ $(call ListPathsSafely_If,$1,$2,3751,4000)
+
+ $(call ListPathsSafely_If,$1,$2,4001,4250)
+ $(call ListPathsSafely_If,$1,$2,4251,4500)
+ $(call ListPathsSafely_If,$1,$2,4501,4750)
+ $(call ListPathsSafely_If,$1,$2,4751,5000)
+
+ $(call ListPathsSafely_If,$1,$2,5001,5250)
+ $(call ListPathsSafely_If,$1,$2,5251,5500)
+ $(call ListPathsSafely_If,$1,$2,5501,5750)
+ $(call ListPathsSafely_If,$1,$2,5751,6000)
+
+ $(call ListPathsSafely_If,$1,$2,6001,6250)
+ $(call ListPathsSafely_If,$1,$2,6251,6500)
+ $(call ListPathsSafely_If,$1,$2,6501,6750)
+ $(call ListPathsSafely_If,$1,$2,6751,7000)
+
+ $(call ListPathsSafely_If,$1,$2,7001,7250)
+ $(call ListPathsSafely_If,$1,$2,7251,7500)
+ $(call ListPathsSafely_If,$1,$2,7501,7750)
+ $(call ListPathsSafely_If,$1,$2,7751,8000)
+
+ $(call ListPathsSafely_If,$1,$2,8001,8250)
+ $(call ListPathsSafely_If,$1,$2,8251,8500)
+ $(call ListPathsSafely_If,$1,$2,8501,8750)
+ $(call ListPathsSafely_If,$1,$2,8751,9000)
+
+ $(call ListPathsSafely_If,$1,$2,9001,9250)
+ $(call ListPathsSafely_If,$1,$2,9251,9500)
+ $(call ListPathsSafely_If,$1,$2,9501,9750)
+ $(call ListPathsSafely_If,$1,$2,9751,10000)
+
+ $(call ListPathsSafely_If,$1,$2,10001,10250)
+ $(call ListPathsSafely_If,$1,$2,10251,10500)
+ $(call ListPathsSafely_If,$1,$2,10501,10750)
+ $(call ListPathsSafely_If,$1,$2,10751,11000)
+
+ $(call ListPathsSafely_If,$1,$2,11001,11250)
+ $(call ListPathsSafely_If,$1,$2,11251,11500)
+ $(call ListPathsSafely_If,$1,$2,11501,11750)
+ $(call ListPathsSafely_If,$1,$2,11751,12000)
+
+ $(call ListPathsSafely_If,$1,$2,12001,12250)
+ $(call ListPathsSafely_If,$1,$2,12251,12500)
+ $(call ListPathsSafely_If,$1,$2,12501,12750)
+ $(call ListPathsSafely_If,$1,$2,12751,13000)
+
+ $(call ListPathsSafely_If,$1,$2,13001,13250)
+ $(call ListPathsSafely_If,$1,$2,13251,13500)
+ $(call ListPathsSafely_If,$1,$2,13501,13750)
+ $(call ListPathsSafely_If,$1,$2,13751,14000)
+
+ $(call ListPathsSafely_If,$1,$2,14001,14250)
+ $(call ListPathsSafely_If,$1,$2,14251,14500)
+ $(call ListPathsSafely_If,$1,$2,14501,14750)
+ $(call ListPathsSafely_If,$1,$2,14751,15000)
+
+ $(call ListPathsSafely_If,$1,$2,15001,15250)
+ $(call ListPathsSafely_If,$1,$2,15251,15500)
+ $(call ListPathsSafely_If,$1,$2,15501,15750)
+ $(call ListPathsSafely_If,$1,$2,15751,16000)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,1)
+ $(call ListPathsSafely_Printf,$1,$2,$3,251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,1001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,1251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,1501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,1751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,2001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,2251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,2501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,2751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,3001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,3251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,3501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,3751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,4001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,4251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,4501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,4751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,5001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,5251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,5501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,5751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,6001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,6251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,6501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,6751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,7001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,7251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,7501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,7751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,8001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,8251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,8501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,8751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,9001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,9251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,9501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,9751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,10001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,10251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,10501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,10751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,11001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,11251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,11501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,11751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,12001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,12251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,12501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,12751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,13001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,13251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,13501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,13751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,14001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,14251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,14501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,14751)
+
+ $(call ListPathsSafely_Printf,$1,$2,$3,15001)
+ $(call ListPathsSafely_Printf,$1,$2,$3,15251)
+ $(call ListPathsSafely_Printf,$1,$2,$3,15501)
+ $(call ListPathsSafely_Printf,$1,$2,$3,15751)
+endef
+
+define ListPathsSafelyNow_IfPrintf
+ ifneq (,$$(word $4,$$($1)))
+ $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1))))
+ $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3)
+ endif
+endef
+
+# And an non-receipt version:
+define ListPathsSafelyNow
+ ifneq (,$$(word 10001,$$($1)))
+ $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!)
+ endif
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000)
+
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750)
+ $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000)
+
+endef
+
+# The source tips can come from the Mercurial repository, or in the files
+# $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
+# directory as the original $(HGDIR) directory.
+# These should not be := assignments, only used from the root Makefile.
+HG_VERSION = $(shell $(HG) version 2> /dev/null)
+HG_DIRECTORY=.hg
+HGTIP_FILENAME=.hgtip
+HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
+REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
+ $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
+ $(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
+ 2> /dev/null)))))
+
+# Emit the repo:tip pairs to $@
+define GetSourceTips
+ $(CD) $(SRC_ROOT) ; \
+ for i in $(REPO_LIST) IGNORE ; do \
+ if [ "$${i}" = "IGNORE" ] ; then \
+ continue; \
+ elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
+ $(PRINTF) " %s:%s" \
+ "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \
+ elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
+ $(PRINTF) " %s:%s" \
+ "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
+ fi; \
+ done >> $@
+ $(PRINTF) "\n" >> $@
+endef
+
+# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+define CreateHgTip
+ $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
+ $(ECHO) $1/$(HGTIP_FILENAME)
+endef
+
+define SetupLogging
+ ifeq ($$(LOG_LEVEL),trace)
+ # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
+ # For each target executed, will print
+ # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
+ # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much
+ # (and causing a crash on Cygwin).
+ # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris.
+ # Only use time if it's GNU time which supports format and output file.
+ WRAPPER_SHELL:=/bin/bash $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log /bin/bash
+ SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
+ endif
+ # Never remove warning messages; this is just for completeness
+ LOG_WARN=
+ ifneq ($$(findstring $$(LOG_LEVEL),info debug trace),)
+ LOG_INFO=
+ else
+ LOG_INFO=> /dev/null
+ endif
+ ifneq ($$(findstring $$(LOG_LEVEL),debug trace),)
+ LOG_DEBUG=
+ else
+ LOG_DEBUG=> /dev/null
+ endif
+ ifneq ($$(findstring $$(LOG_LEVEL),trace),)
+ LOG_TRACE=
+ else
+ LOG_TRACE=> /dev/null
+ endif
+endef
+
+# Make sure logging is setup for everyone that includes MakeBase.gmk.
+$(eval $(call SetupLogging))
+
+# This is to be called by all SetupFoo macros
+define LogSetupMacroEntry
+ $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
+ $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
+endef
+
+# Make directory without forking mkdir if not needed
+define MakeDir
+ ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))
+ $$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)
+ endif
+endef
+
+ifeq ($(OPENJDK_TARGET_OS),solaris)
+ # On Solaris, if the target is a symlink and exists, cp won't overwrite.
+ # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
+ # name of the target file differs from the source file, rename after copy.
+ define install-file
+ $(MKDIR) -p $(@D)
+ $(RM) '$@'
+ $(CP) -f -r -P '$<' '$(@D)'
+ if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi
+ endef
+else ifeq ($(OPENJDK_TARGET_OS),macosx)
+ # On mac, extended attributes sometimes creep into the source files, which may later
+ # cause the creation of ._* files which confuses testing. Clear these with xattr if
+ # set. Some files get their write permissions removed after being copied to the
+ # output dir. When these are copied again to images, xattr would fail. By only clearing
+ # attributes when they are present, failing on this is avoided.
+ define install-file
+ $(MKDIR) -p $(@D)
+ $(CP) -fRP '$<' '$@'
+ if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi
+ endef
+else
+ define install-file
+ $(MKDIR) -p $(@D)
+ $(CP) -fP '$<' '$@'
+ endef
+endif
+
+# Convenience functions for working around make's limitations with $(filter ).
+containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
+not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
+
+################################################################################
+# In Cygwin, finds are very costly, both because of expensive forks and because
+# of bad file system caching. Find is used extensively in $(shell) commands to
+# find source files. This makes rerunning make with no or few changes rather
+# expensive. To speed this up, these two macros are used to cache the results
+# of simple find commands for reuse.
+#
+# Runs a find and stores both the directories where it was run and the results.
+# This macro can be called multiple times to add to the cache. Only finds files
+# with no filters.
+#
+# Needs to be called with $(eval )
+#
+# Param 1 - Dir to find in
+ifeq ($(OPENJDK_BUILD_OS),windows)
+ define FillCacheFind
+ FIND_CACHE_DIR += $1
+ FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
+ endef
+else
+ define FillCacheFind
+ endef
+endif
+
+# Mimics find by looking in the cache if all of the directories have been cached.
+# Otherwise reverts to shell find. This is safe to call on all platforms, even if
+# cache is deactivated.
+#
+# The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
+# Param 1 - Dirs to find in
+define CacheFind
+ $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1), \
+ $(shell $(FIND) $1 -type f -o -type l), \
+ $(filter $(addsuffix %,$1),$(FIND_CACHE)))
+endef
+
+################################################################################
+
+endif # _MAKEBASE_GMK
diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk
new file mode 100644
index 0000000..0b9975d
--- /dev/null
+++ b/make/common/NON_CORE_PKGS.gmk
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# This file contains the package names of all the "non-core"
+# API published in the Java 2 SDK documentation. "Non-core" means
+# it includes all published API outside of the JDK API specification.
+#
+# These environment variables are used by javadoc in
+# make/docs/Makefile and are referenced by the localization
+# team when determining which APIs to extract javadoc
+# comments from.
+
+DOMAPI_PKGS = com.sun.java.browser.dom \
+ org.w3c.dom \
+ org.w3c.dom.bootstrap \
+ org.w3c.dom.ls \
+ org.w3c.dom.ranges \
+ org.w3c.dom.traversal \
+ org.w3c.dom.html \
+ org.w3c.dom.stylesheets \
+ org.w3c.dom.css \
+ org.w3c.dom.events \
+ org.w3c.dom.views
+
+JDI_PKGS = com.sun.jdi \
+ com.sun.jdi.event \
+ com.sun.jdi.request \
+ com.sun.jdi.connect \
+ com.sun.jdi.connect.spi
+
+MGMT_PKGS = com.sun.management
+
+JAAS_PKGS = com.sun.security.auth \
+ com.sun.security.auth.callback \
+ com.sun.security.auth.login \
+ com.sun.security.auth.module
+
+JGSS_PKGS = com.sun.security.jgss
+
+OLD_JSSE_PKGS = com.sun.net.ssl
+
+HTTPSERVER_PKGS = com.sun.net.httpserver \
+ com.sun.net.httpserver.spi
+
+NIO_PKGS = com.sun.nio.file
+
+DOCLETAPI_PKGS = com.sun.javadoc
+
+TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java
+
+TAGLETAPI_PKGS = com.sun.tools.doclets
+
+ATTACH_PKGS = com.sun.tools.attach \
+ com.sun.tools.attach.spi
+
+JCONSOLE_PKGS = com.sun.tools.jconsole
+
+TREEAPI_PKGS = com.sun.source.doctree \
+ com.sun.source.tree \
+ com.sun.source.util \
+ jdk
+
+SMARTCARDIO_PKGS = javax.smartcardio
+
+SCTPAPI_PKGS = com.sun.nio.sctp
+
+ifeq ($(PLATFORM), macosx)
+ APPLE_EXT_PKGS = com.apple.concurrent \
+ com.apple.eawt \
+ com.apple.eawt.event \
+ com.apple.eio
+endif
+
+JDK_PKGS = jdk
+
+# non-core packages in rt.jar
+NON_CORE_PKGS = $(DOMAPI_PKGS) \
+ $(MGMT_PKGS) \
+ $(JAAS_PKGS) \
+ $(JGSS_PKGS) \
+ $(NIO_PKGS) \
+ $(OLD_JSSE_PKGS) \
+ $(HTTPSERVER_PKGS) \
+ $(SMARTCARDIO_PKGS) \
+ $(SCTPAPI_PKGS) \
+ $(APPLE_EXT_PKGS) \
+ $(JDK_PKGS)
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
new file mode 100644
index 0000000..161d211
--- /dev/null
+++ b/make/common/NativeCompilation.gmk
@@ -0,0 +1,594 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# When you read this source. Remember that $(sort ...) has the side effect
+# of removing duplicates. It is actually this side effect that is
+# desired whenever sort is used below!
+
+ifeq (,$(_MAKEBASE_GMK))
+ $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
+endif
+
+ifeq ($(COMPILER_TYPE),CC)
+ COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))"
+ LINKING_MSG=echo $(LOG_INFO) "Linking $1"
+ LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1"
+ ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1"
+else
+ COMPILING_MSG=
+ LINKING_MSG=
+ LINKING_EXE_MSG=
+ ARCHIVING_MSG=
+endif
+
+define add_native_source
+ # param 1 = BUILD_MYPACKAGE
+ # parma 2 = the source file name (..../alfa.c or .../beta.cpp)
+ # param 3 = the bin dir that stores all .o (.obj) and .d files.
+ # param 4 = the c flags to the compiler
+ # param 5 = the c compiler
+ # param 6 = the c++ flags to the compiler
+ # param 7 = the c++ compiler
+ # param 8 = the flags to the assembler
+
+ ifneq (,$$(filter %.c,$2))
+ # Compile as a C file
+ $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+ $1_$2_COMP=$5
+ $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
+ else ifneq (,$$(filter %.m,$2))
+ # Compile as a objective-c file
+ $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+ $1_$2_COMP=$5
+ $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
+ else ifneq (,$$(filter %.s,$2))
+ # Compile as assembler file
+ $1_$2_FLAGS=$8 -DTHIS_FILE='"$$(<F)"'
+ $1_$2_COMP=$(AS)
+ $1_$2_DEP_FLAG:=
+ else
+ # Compile as a C++ file
+ $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+ $1_$2_COMP=$7
+ $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
+ endif
+ # Generate the .o (.obj) file name and place it in the bin dir.
+ $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $2)))))
+ # Only continue if this object file hasn't been processed already. This lets the first found
+ # source file override any other with the same name.
+ ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR)))
+ $1_OBJS_SO_FAR+=$$($1_$2_OBJ)
+ ifeq (,$$(filter %.s,$2))
+ # And this is the dependency file for this obj file.
+ $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ))
+ # Include previously generated dependency information. (if it exists)
+ -include $$($1_$2_DEP)
+
+ ifeq ($(COMPILER_TYPE),CL)
+ $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \
+ -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ))
+ endif
+ endif
+
+ $$($1_$2_OBJ) : $2
+ ifeq ($(COMPILER_TYPE),CC)
+ $$(call COMPILING_MSG,$2,$$($1_TARGET))
+ # The Sun studio compiler doesn't output the full path to the object file in the
+ # generated deps files. Fixing it with sed. If compiling assembly, don't try this.
+ ifeq ($(COMPILER_NAME)$$(filter %.s,$2),ossc)
+ $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
+ $(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP)
+ else
+ $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
+ endif
+ endif
+ # The Visual Studio compiler lacks a feature for generating make dependencies, but by
+ # setting -showIncludes, all included files are printed. These are filtered out and
+ # parsed into make dependences.
+ ifeq ($(COMPILER_TYPE),CL)
+ ($$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
+ $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 ; echo $$$$? > $$($1_$2_DEP).exitvalue) \
+ | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \
+ && exit `cat $$($1_$2_DEP).exitvalue`
+ $(RM) $$($1_$2_DEP).exitvalue
+ ($(ECHO) $$@: \\ \
+ && $(SED) -e '/^Note: including file:/!d' \
+ -e 's|Note: including file: *||' \
+ -e 's|\\|/|g' \
+ -e 's|^\([a-zA-Z]\):|/cygdrive/\1|g' \
+ -e '/$(subst /,\/,$(TOPDIR))/!d' \
+ -e 's|$$$$| \\|g' \
+ $$($1_$2_DEP).raw) > $$($1_$2_DEP)
+ endif
+ endif
+endef
+
+define SetupNativeCompilation
+ # param 1 is for example BUILD_MYPACKAGE
+ # param 2,3,4,5,6,7,8 are named args.
+ # SRC one or more directory roots to scan for C/C++ files.
+ # LANG C or C++
+ # CFLAGS the compiler flags to be used, used both for C and C++.
+ # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
+ # LDFLAGS the linker flags to be used, used both for C and C++.
+ # LDFLAGS_SUFFIX the linker flags to be added last on the commandline
+ # typically the libraries linked to.
+ # ARFLAGS the archiver flags to be used
+ # OBJECT_DIR the directory where we store the object files
+ # LIBRARY the resulting library file
+ # PROGRAM the resulting exec file
+ # INCLUDES only pick source from these directories
+ # EXCLUDES do not pick source from these directories
+ # INCLUDE_FILES only compile exactly these files!
+ # EXCLUDE_FILES with these names
+ # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
+ # RC_FLAGS flags for RC.
+ # MAPFILE mapfile
+ # REORDER reorder file
+ # DEBUG_SYMBOLS add debug symbols (if configured on)
+ # CC the compiler to use, default is $(CC)
+ # LDEXE the linker to use for linking executables, default is $(LDEXE)
+ # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))
+ $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
+
+ ifneq (,$$($1_BIN))
+ $$(error BIN has been replaced with OBJECT_DIR)
+ endif
+
+ ifneq (,$$($1_LIB))
+ $$(error LIB has been replaced with LIBRARY)
+ endif
+
+ ifneq (,$$($1_EXE))
+ $$(error EXE has been replaced with PROGRAM)
+ endif
+
+ ifneq (,$$($1_LIBRARY))
+ ifeq (,$$($1_OUTPUT_DIR))
+ $$(error LIBRARY requires OUTPUT_DIR)
+ endif
+
+ ifneq ($$($1_LIBRARY),$(basename $$($1_LIBRARY)))
+ $$(error directory of LIBRARY should be specified using OUTPUT_DIR)
+ endif
+
+ ifneq (,$(findstring $(SHARED_LIBRARY_SUFFIX),$$($1_LIBRARY)))
+ $$(error LIBRARY should be specified without SHARED_LIBRARY_SUFFIX: $(SHARED_LIBRARY_SUFFIX))
+ endif
+
+ ifneq (,$(findstring $(LIBRARY_PREFIX),$$($1_LIBRARY)))
+ $$(error LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX))
+ endif
+
+ $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$(SHARED_LIBRARY_SUFFIX)
+ $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
+
+ endif
+
+ ifneq (,$$($1_STATIC_LIBRARY))
+ ifeq (,$$($1_OUTPUT_DIR))
+ $$(error STATIC_LIBRARY requires OUTPUT_DIR)
+ endif
+
+ ifneq ($$($1_STATIC_LIBRARY),$(basename $$($1_STATIC_LIBRARY)))
+ $$(error directory of STATIC_LIBRARY should be specified using OUTPUT_DIR)
+ endif
+
+ ifneq (,$(findstring $(STATIC_LIBRARY_SUFFIX),$$($1_STATIC_LIBRARY)))
+ $$(error STATIC_LIBRARY should be specified without STATIC_LIBRARY_SUFFIX: $(STATIC_LIBRARY_SUFFIX))
+ endif
+
+ ifneq (,$(findstring $(LIBRARY_PREFIX),$$($1_STATIC_LIBRARY)))
+ $$(error STATIC_LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX))
+ endif
+
+ $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$(STATIC_LIBRARY_SUFFIX)
+ $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
+ endif
+
+ ifneq (,$$($1_PROGRAM))
+ ifeq (,$$($1_OUTPUT_DIR))
+ $$(error PROGRAM requires OUTPUT_DIR)
+ endif
+
+ ifneq ($$($1_PROGRAM),$(basename $$($1_PROGRAM)))
+ $$(error directory of PROGRAM should be specified using OUTPUT_DIR)
+ endif
+
+ ifneq (,$(findstring $(EXE_SUFFIX),$$($1_PROGRAM)))
+ $$(error PROGRAM should be specified without EXE_SUFFIX: $(EXE_SUFFIX))
+ endif
+
+ $1_BASENAME:=$$($1_PROGRAM)$(EXE_SUFFIX)
+ $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
+
+ endif
+
+ ifeq (,$$($1_TARGET))
+ $$(error Neither PROGRAM, LIBRARY nor STATIC_LIBRARY has been specified for SetupNativeCompilation)
+ endif
+
+ ifeq (,$$($1_LANG))
+ $$(error You have to specify LANG for native compilation $1)
+ endif
+ ifeq (C,$$($1_LANG))
+ ifeq ($$($1_LDEXE),)
+ $1_LDEXE:=$(LDEXE)
+ endif
+ $1_LD:=$(LD)
+ else
+ ifeq (C++,$$($1_LANG))
+ $1_LD:=$(LDCXX)
+ $1_LDEXE:=$(LDEXECXX)
+ else
+ $$(error Unknown native language $$($1_LANG) for $1)
+ endif
+ endif
+
+ ifeq ($$($1_CC),)
+ $1_CC:=$(CC)
+ endif
+
+ # Make sure the dirs exist.
+ $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
+ $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
+
+ # Find all files in the source trees. Sort to remove duplicates.
+ $1_ALL_SRCS := $$(sort $$(call CacheFind,$$($1_SRC)))
+ # Extract the C/C++ files.
+ $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
+ $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
+ ifneq ($$($1_EXCLUDE_FILES),)
+ $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES))
+ endif
+ $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.s %.c %.cpp %.m,$$($1_ALL_SRCS)))
+ ifneq (,$$(strip $$($1_INCLUDE_FILES)))
+ $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS))
+ endif
+ ifeq (,$$($1_SRCS))
+ $$(error No sources found for $1 when looking inside the dirs $$($1_SRC))
+ endif
+ # There can be only a single bin dir root, no need to foreach over the roots.
+ $1_BINS := $$(wildcard $$($1_OBJECT_DIR)/*$(OBJ_SUFFIX))
+ # Now we have a list of all c/c++ files to compile: $$($1_SRCS)
+ # and we have a list of all existing object files: $$($1_BINS)
+
+ # Prepend the source/bin path to the filter expressions. Then do the filtering.
+ ifneq ($$($1_INCLUDES),)
+ $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
+ $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
+ endif
+ ifneq ($$($1_EXCLUDES),)
+ $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
+ $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+ endif
+
+ # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides
+ # a reproducable order on the input files to the linker).
+ $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS))))))))
+ # Are there too many object files on disk? Perhaps because some source file was removed?
+ $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
+ # Clean out the superfluous object files.
+ ifneq ($$($1_SUPERFLUOUS_OBJS),)
+ $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
+ endif
+
+ # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CFLAGS.
+ $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS))
+ ifneq ($(DEBUG_LEVEL),release)
+ # Pickup extra debug dependent variables for CFLAGS
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug)
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_debug)
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_debug)
+ else
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_release)
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_release)
+ $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_release)
+ endif
+
+ # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS.
+ $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS))
+ ifneq ($(DEBUG_LEVEL),release)
+ # Pickup extra debug dependent variables for CXXFLAGS
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug)
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_debug)
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_debug)
+ else
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release)
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_release)
+ $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
+ endif
+
+ ifneq (,$$($1_DEBUG_SYMBOLS))
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifdef OPENJDK
+ # Always add debug symbols
+ $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
+ $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
+ else
+ # Programs don't get the debug symbols added in the old build. It's not clear if
+ # this is intentional.
+ ifeq ($$($1_PROGRAM),)
+ $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
+ $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
+ endif
+ endif
+ endif
+ endif
+
+ ifeq ($$($1_CXXFLAGS),)
+ $1_CXXFLAGS:=$$($1_CFLAGS)
+ endif
+ ifeq ($$(strip $$($1_EXTRA_CXXFLAGS)),)
+ $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
+ endif
+
+ ifneq (,$$($1_REORDER))
+ $1_EXTRA_CFLAGS += $$(C_FLAG_REORDER)
+ $1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
+ endif
+
+ ifeq (NONE, $$($1_OPTIMIZATION))
+ $1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
+ $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
+ else ifeq (LOW, $$($1_OPTIMIZATION))
+ $1_EXTRA_CFLAGS += $(C_O_FLAG_NORM)
+ $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NORM)
+ else ifeq (HIGH, $$($1_OPTIMIZATION))
+ $1_EXTRA_CFLAGS += $(C_O_FLAG_HI)
+ $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HI)
+ else ifeq (HIGHEST, $$($1_OPTIMIZATION))
+ $1_EXTRA_CFLAGS += $(C_O_FLAG_HIGHEST)
+ $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HIGHEST)
+ else ifneq (, $$($1_OPTIMIZATION))
+ $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
+ endif
+
+ # Now call add_native_source for each source file we are going to compile.
+ $$(foreach p,$$($1_SRCS), \
+ $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \
+ $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \
+ $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX),$$($1_ASFLAGS))))
+
+ # On windows we need to create a resource file
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ ifneq (,$$($1_VERSIONINFO_RESOURCE))
+ $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res
+ $$($1_RES): $$($1_VERSIONINFO_RESOURCE)
+ $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
+ endif
+ ifneq (,$$($1_MANIFEST))
+ $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest
+ IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER)
+ $$($1_GEN_MANIFEST): $$($1_MANIFEST)
+ $(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@
+ endif
+ endif
+
+ # mapfile doesnt seem to be implemented on macosx (yet??)
+ ifneq ($(OPENJDK_TARGET_OS),macosx)
+ ifneq ($(OPENJDK_TARGET_OS),windows)
+ $1_REAL_MAPFILE:=$$($1_MAPFILE)
+ ifneq (,$$($1_REORDER))
+ $1_REAL_MAPFILE:=$$($1_OBJECT_DIR)/mapfile
+
+ $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
+ $$(MKDIR) -p $$(@D)
+ $$(CP) $$($1_MAPFILE) $$@.tmp
+ $$(SED) -e 's=OUTPUTDIR=$$($1_OBJECT_DIR)=' $$($1_REORDER) >> $$@.tmp
+ $$(MV) $$@.tmp $$@
+ endif
+ endif
+ endif
+
+ # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables
+ # for LDFLAGS and LDFLAGS_SUFFIX
+ $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
+ $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS))
+ ifneq (,$$($1_REAL_MAPFILE))
+ $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
+ endif
+
+ $1 := $$($1_TARGET)
+ ifneq (,$$($1_LIBRARY))
+ # Generating a dynamic library.
+ $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+ endif
+
+ $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
+
+ ifneq (,$$($1_DEBUG_SYMBOLS))
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1_EXTRA_LDFLAGS+="-pdb:$$($1_OBJECT_DIR)/$$($1_LIBRARY).pdb" \
+ "-map:$$($1_OBJECT_DIR)/$$($1_LIBRARY).map"
+ endif
+
+ ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
+ $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
+ $(CP) $$< $$@
+ endif
+
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
+ ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+ # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
+ # empty section headers until a fixed $(OBJCOPY) is available.
+ # An empty section header has sh_addr == 0 and sh_size == 0.
+ # This problem has only been seen on Solaris X64, but we call this tool
+ # on all Solaris builds just in case.
+ #
+ # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+ # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
+ $(RM) $$@
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
+ else # not solaris
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
+ $(RM) $$@
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
+ endif # Touch to not retrigger rule on rebuild
+ $(TOUCH) $$@
+ endif # !windows
+ endif # !macosx
+
+ ifeq ($(ZIP_DEBUGINFO_FILES), true)
+ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
+ $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz
+
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz : $$($1_TARGET)
+ $(CD) $$($1_OBJECT_DIR) \
+ && $(ZIP) -q $$@ $$($1_LIBRARY).map $$($1_LIBRARY).pdb
+ else
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz : $$($1_TARGET) \
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
+ $(CD) $$($1_OBJECT_DIR) \
+ && $(ZIP) -q $$@ $$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
+ endif
+endif # no MacOS X support yet
+ else
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
+ $$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
+ else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
+ $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
+ endif
+ endif
+ endif
+ endif
+
+ $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
+ $$(call LINKING_MSG,$$($1_BASENAME))
+ $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+
+ endif
+
+ ifneq (,$$($1_STATIC_LIBRARY))
+ # Generating a static library, ie object file archive.
+ $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
+ $$(call ARCHIVING_MSG,$$($1_LIBRARY))
+ $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
+ $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
+ endif
+
+ ifneq (,$$($1_PROGRAM))
+ # A executable binary has been specified, setup the target for it.
+ ifneq (,$$($1_DEBUG_SYMBOLS))
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1_EXTRA_LDFLAGS+="-pdb:$$($1_OBJECT_DIR)/$$($1_PROGRAM).pdb" \
+ "-map:$$($1_OBJECT_DIR)/$$($1_PROGRAM).map"
+ endif
+
+ ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
+ $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
+ $(CP) $$< $$@
+ endif
+
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
+ ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+ # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
+ # empty section headers until a fixed $(OBJCOPY) is available.
+ # An empty section header has sh_addr == 0 and sh_size == 0.
+ # This problem has only been seen on Solaris X64, but we call this tool
+ # on all Solaris builds just in case.
+ #
+ # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+ # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
+ $(RM) $$@
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
+ else # not solaris
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
+ $(RM) $$@
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
+ endif
+ $(TOUCH) $$@
+ endif # !windows
+ endif # !macosx
+
+ ifeq ($(ZIP_DEBUGINFO_FILES), true)
+ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
+ $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).diz
+
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).diz : $$($1_TARGET)
+ $(CD) $$($1_OBJECT_DIR) \
+ && $(ZIP) -q $$@ $$($1_PROGRAM).map $$($1_PROGRAM).pdb
+ else
+ $$($1_OBJECT_DIR)/$$(PROGRAM_PREFIX)$$($1_PROGRAM).diz : $$($1_TARGET) \
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo
+ $(CD) $$($1_OBJECT_DIR) \
+ && $(ZIP) -q $$@ $$($1_PROGRAM).debuginfo
+ endif
+endif # no MacOS X support yet
+ else
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
+ $$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
+ else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
+ $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
+ endif
+ endif
+ endif
+ endif
+
+ $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
+
+ $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
+ $$(call LINKING_EXE_MSG,$$($1_BASENAME))
+ $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+ ifneq (,$$($1_GEN_MANIFEST))
+ $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
+ endif
+ # This only works if the openjdk_codesign identity is present on the system. Let
+ # silently fail otherwise.
+ ifneq (,$(CODESIGN))
+ ifneq (,$$($1_CODESIGN))
+ $(CODESIGN) -s openjdk_codesign $$@
+ endif
+ endif
+ endif
+endef
diff --git a/make/common/RMICompilation.gmk b/make/common/RMICompilation.gmk
new file mode 100644
index 0000000..2c87b70
--- /dev/null
+++ b/make/common/RMICompilation.gmk
@@ -0,0 +1,96 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+define SetupRMICompilation
+ # param 1 is a name for a variable to depend on.
+ # param 2 and up are named args.
+ # CLASSES:=List of classes to generate stubs for
+ # CLASSES_DIR:=Directory where to look for classes
+ # STUB_CLASSES_DIR:=Directory in where to put stub classes
+ # RUN_V11:=Set to run rmic with -v1.1
+ # RUN_V12:=Set to run rmic with -v1.2
+ # RUN_IIOP:=Set to run rmic with -iiop
+ # RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
+ # KEEP_GENERATED:=Set to keep generated sources around
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
+
+ $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
+
+ $1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
+ $1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
+ $1_STUB_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Stub.class,$$($1_CLASSES_SLASH)))
+ $1_TARGETS := $$($1_STUB_FILES)
+ $1_ARGS :=
+ ifneq (,$$($1_RUN_V11))
+ $1_SKEL_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Skel.class,$$($1_CLASSES_SLASH)))
+ $1_TARGETS += $$($1_SKEL_FILES)
+ $1_ARGS += -v1.1
+ endif
+ ifneq (,$$($1_RUN_V12))
+ $1_ARGS += -v1.2
+ endif
+
+ $1_TIE_BASE_FILES := $$(foreach f,$$($1_CLASSES_SLASH),$$(dir $$f)_$$(notdir $$f))
+ $1_TIE_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/org/omg/stub/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
+ $1_TIE_STDPKG_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
+
+ ifneq (,$$($1_RUN_IIOP))
+ $1_TARGETS += $$($1_TIE_FILES)
+ $1_ARGS += -iiop -emitPermissionCheck
+ endif
+ ifneq (,$$($1_RUN_IIOP_STDPKG))
+ $1_TARGETS += $$($1_TIE_STDPKG_FILES)
+ $1_ARGS2 := -iiop -emitPermissionCheck -standardPackage
+ endif
+
+ ifneq (,$$($1_KEEP_GENERATED))
+ $1_ARGS += -keepgenerated
+ $1_TARGETS += $$(subst .class,.java,$$($1_TARGETS))
+ endif
+
+ $1_DOLLAR_SAFE_CLASSES := $$(subst $$$$,\$$$$,$$($1_CLASSES))
+
+ $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
+
+ $$($1_DEP_FILE): $$($1_CLASS_FILES)
+ $(MKDIR) -p $$($1_STUB_CLASSES_DIR)
+ if [ "x$$($1_ARGS)" != "x" ]; then \
+ $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \
+ $(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
+ -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
+ fi;
+ if [ "x$$($1_ARGS2)" != "x" ]; then \
+ $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \
+ $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
+ -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
+ fi;
+ $(TOUCH) $$@
+
+
+ $1 := $$($1_TARGETS) $$($1_DEP_FILE)
+
+endef
diff --git a/make/common/support/ListPathsSafely-post-compress.incl b/make/common/support/ListPathsSafely-post-compress.incl
new file mode 100644
index 0000000..d8ccf22
--- /dev/null
+++ b/make/common/support/ListPathsSafely-post-compress.incl
@@ -0,0 +1 @@
+))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
diff --git a/make/common/support/ListPathsSafely-pre-compress.incl b/make/common/support/ListPathsSafely-pre-compress.incl
new file mode 100644
index 0000000..7230c6c
--- /dev/null
+++ b/make/common/support/ListPathsSafely-pre-compress.incl
@@ -0,0 +1 @@
+$(subst com,X01,$(subst org,X02,$(subst sun,X03,$(subst java,X04,$(subst javax,X05,$(subst sun/io,X06,$(subst com/sun,X07,$(subst java/io,X08,$(subst org/omg,X09,$(subst org/w3c,X10,$(subst org/xml,X11,$(subst sun/awt,X12,$(subst sun/net,X13,$(subst sun/nio,X14,$(subst sun/rmi,X15,$(subst java/awt,X16,$(subst java/net,X17,$(subst java/nio,X18,$(subst java/rmi,X19,$(subst META-INF,X20,$(subst sun/font,X21,$(subst sun/misc,X22,$(subst sun/text,X23,$(subst sun/util,X24,$(subst java/lang,X25,$(subst java/math,X26,$(subst java/text,X27,$(subst java/util,X28,$(subst javax/jws,X29,$(subst javax/net,X30,$(subst javax/rmi,X31,$(subst javax/xml,X32,$(subst sun/corba,X33,$(subst sun/print,X34,$(subst sun/swing,X35,$(subst java/beans,X36,$(subst javax/lang,X37,$(subst sun/applet,X38,$(subst sun/java2d,X39,$(subst java/applet,X40,$(subst javax/print,X41,$(subst javax/sound,X42,$(subst javax/swing,X43,$(subst javax/tools,X44,$(subst jdk/classes,X45,$(subst org/relaxng,X46,$(subst sun/reflect,X47,$(subst javax/crypto,X48,$(subst javax/naming,X49,$(subst jaxp/classes,X50,$(subst sun/security,X51,$(subst corba/classes,X52,$(subst java/security,X53,$(subst javax/imageio,X54,$(subst jdk/btclasses,X55,$(subst javax/activity,X56,$(subst javax/security,X57,$(subst jdk/newclasses,X58,$(subst sun/instrument,X59,$(subst sun/management,X60,$(subst corba/btclasses,X61,$(subst jdk/democlasses,X62,$(subst javax/activation,X63,$(subst javax/annotation,X64,$(subst javax/management,X65,$(subst javax/transaction,X66,$(subst jaxws/jaf_classes,X67,$(subst langtools/classes,X68,$(subst META-INF/services,X69,$(subst jdk/newdemoclasses,X70,$(subst javax/accessibility,X71,$(subst jaxws/jaxws_classes,X72,
diff --git a/make/common/support/ListPathsSafely-uncompress.sed b/make/common/support/ListPathsSafely-uncompress.sed
new file mode 100644
index 0000000..cd6966c
--- /dev/null
+++ b/make/common/support/ListPathsSafely-uncompress.sed
@@ -0,0 +1,72 @@
+s|X01|com|g
+s|X02|org|g
+s|X03|sun|g
+s|X04|java|g
+s|X05|javax|g
+s|X06|sun/io|g
+s|X07|com/sun|g
+s|X08|java/io|g
+s|X09|org/omg|g
+s|X10|org/w3c|g
+s|X11|org/xml|g
+s|X12|sun/awt|g
+s|X13|sun/net|g
+s|X14|sun/nio|g
+s|X15|sun/rmi|g
+s|X16|java/awt|g
+s|X17|java/net|g
+s|X18|java/nio|g
+s|X19|java/rmi|g
+s|X20|META-INF|g
+s|X21|sun/font|g
+s|X22|sun/misc|g
+s|X23|sun/text|g
+s|X24|sun/util|g
+s|X25|java/lang|g
+s|X26|java/math|g
+s|X27|java/text|g
+s|X28|java/util|g
+s|X29|javax/jws|g
+s|X30|javax/net|g
+s|X31|javax/rmi|g
+s|X32|javax/xml|g
+s|X33|sun/corba|g
+s|X34|sun/print|g
+s|X35|sun/swing|g
+s|X36|java/beans|g
+s|X37|javax/lang|g
+s|X38|sun/applet|g
+s|X39|sun/java2d|g
+s|X40|java/applet|g
+s|X41|javax/print|g
+s|X42|javax/sound|g
+s|X43|javax/swing|g
+s|X44|javax/tools|g
+s|X45|jdk/classes|g
+s|X46|org/relaxng|g
+s|X47|sun/reflect|g
+s|X48|javax/crypto|g
+s|X49|javax/naming|g
+s|X50|jaxp/classes|g
+s|X51|sun/security|g
+s|X52|corba/classes|g
+s|X53|java/security|g
+s|X54|javax/imageio|g
+s|X55|jdk/btclasses|g
+s|X56|javax/activity|g
+s|X57|javax/security|g
+s|X58|jdk/newclasses|g
+s|X59|sun/instrument|g
+s|X60|sun/management|g
+s|X61|corba/btclasses|g
+s|X62|jdk/democlasses|g
+s|X63|javax/activation|g
+s|X64|javax/annotation|g
+s|X65|javax/management|g
+s|X66|javax/transaction|g
+s|X67|jaxws/jaf_classes|g
+s|X68|langtools/classes|g
+s|X69|META-INF/services|g
+s|X70|jdk/newdemoclasses|g
+s|X71|javax/accessibility|g
+s|X72|jaxws/jaxws_classes|g
diff --git a/make/common/support/unicode2x.sed b/make/common/support/unicode2x.sed
new file mode 100644
index 0000000..5188b97
--- /dev/null
+++ b/make/common/support/unicode2x.sed
@@ -0,0 +1,100 @@
+s/\\u0020/\x20/g
+s/\\u003A/\x3A/g
+s/\\u006B/\x6B/g
+s/\\u0075/\x75/g
+s/\\u00A0/\xA0/g
+s/\\u00A3/\xA3/g
+s/\\u00B0/\xB0/g
+s/\\u00B7/\xB7/g
+s/\\u00BA/\xBA/g
+s/\\u00BF/\xBF/g
+s/\\u00C0/\xC0/g
+s/\\u00C1/\xC1/g
+s/\\u00C2/\xC2/g
+s/\\u00C4/\xC4/g
+s/\\u00C5/\xC5/g
+s/\\u00C8/\xC8/g
+s/\\u00C9/\xC9/g
+s/\\u00CA/\xCA/g
+s/\\u00CD/\xCD/g
+s/\\u00CE/\xCE/g
+s/\\u00D3/\xD3/g
+s/\\u00D4/\xD4/g
+s/\\u00D6/\xD6/g
+s/\\u00DA/\xDA/g
+s/\\u00DC/\xDC/g
+s/\\u00DD/\xDD/g
+s/\\u00DF/\xDF/g
+s/\\u00E0/\xE0/g
+s/\\u00E1/\xE1/g
+s/\\u00E2/\xE2/g
+s/\\u00E3/\xE3/g
+s/\\u00E4/\xE4/g
+s/\\u00E5/\xE5/g
+s/\\u00E6/\xE6/g
+s/\\u00E7/\xE7/g
+s/\\u00E8/\xE8/g
+s/\\u00E9/\xE9/g
+s/\\u00EA/\xEA/g
+s/\\u00EB/\xEB/g
+s/\\u00EC/\xEC/g
+s/\\u00ED/\xED/g
+s/\\u00EE/\xEE/g
+s/\\u00EF/\xEF/g
+s/\\u00F1/\xF1/g
+s/\\u00F2/\xF2/g
+s/\\u00F3/\xF3/g
+s/\\u00F4/\xF4/g
+s/\\u00F5/\xF5/g
+s/\\u00F6/\xF6/g
+s/\\u00F9/\xF9/g
+s/\\u00FA/\xFA/g
+s/\\u00FC/\xFC/g
+s/\\u0020/\x20/g
+s/\\u003f/\x3f/g
+s/\\u006f/\x6f/g
+s/\\u0075/\x75/g
+s/\\u00a0/\xa0/g
+s/\\u00a3/\xa3/g
+s/\\u00b0/\xb0/g
+s/\\u00ba/\xba/g
+s/\\u00bf/\xbf/g
+s/\\u00c1/\xc1/g
+s/\\u00c4/\xc4/g
+s/\\u00c5/\xc5/g
+s/\\u00c8/\xc8/g
+s/\\u00c9/\xc9/g
+s/\\u00ca/\xca/g
+s/\\u00cd/\xcd/g
+s/\\u00d6/\xd6/g
+s/\\u00dc/\xdc/g
+s/\\u00dd/\xdd/g
+s/\\u00df/\xdf/g
+s/\\u00e0/\xe0/g
+s/\\u00e1/\xe1/g
+s/\\u00e2/\xe2/g
+s/\\u00e3/\xe3/g
+s/\\u00e4/\xe4/g
+s/\\u00e5/\xe5/g
+s/\\u00e7/\xe7/g
+s/\\u00e8/\xe8/g
+s/\\u00e9/\xe9/g
+s/\\u00ea/\xea/g
+s/\\u00eb/\xeb/g
+s/\\u00ec/\xec/g
+s/\\u00ed/\xed/g
+s/\\u00ee/\xee/g
+s/\\u00ef/\xef/g
+s/\\u00f0/\xf0/g
+s/\\u00f1/\xf1/g
+s/\\u00f2/\xf2/g
+s/\\u00f3/\xf3/g
+s/\\u00f4/\xf4/g
+s/\\u00f5/\xf5/g
+s/\\u00f6/\xf6/g
+s/\\u00f7/\xf7/g
+s/\\u00f8/\xf8/g
+s/\\u00f9/\xf9/g
+s/\\u00fa/\xfa/g
+s/\\u00fc/\xfc/g
+s/\\u00ff/\xff/g