提交 90f78aa1 编写于 作者: K katleman

Merge

...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
<li><a href="#testing">Testing the Build</a> </li> <li><a href="#testing">Testing the Build</a> </li>
<li><a href="#variables">Environment/Make Variables</a></li> <li><a href="#variables">Environment/Make Variables</a></li>
<li><a href="#troubleshooting">Troubleshooting</a></li> <li><a href="#troubleshooting">Troubleshooting</a></li>
<li><a href="#newbuild">The New Build</a></li>
</ul> </ul>
</blockquote> </blockquote>
...@@ -2120,6 +2121,16 @@ ...@@ -2120,6 +2121,16 @@
</li> </li>
</ul> </ul>
</blockquote> </blockquote>
<!-- ------------------------------------------------------ -->
<hr>
<h2><a name="newbuild">The New Build</a></h2>
<blockquote>
The <a href="http://openjdk.java.net/projects/build-infra/">
Build Infrastructure project</a> is working on a new
build. For information on how to try it out, please see the
<a href="http://openjdk.java.net/projects/build-infra/guide.html">
Build Infra User Guide</a>
</blockquote>
<hr> <hr>
</body> </body>
</html> </html>
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
# questions. # questions.
# #
autoconf configure.ac > configure autoconf -W all configure.ac > configure
rm -rf config.status config.log autom4te.cache rm -rf config.status config.log autom4te.cache
...@@ -34,7 +34,7 @@ AC_DEFUN([BDEPS_SCAN_FOR_BUILDDEPS], ...@@ -34,7 +34,7 @@ AC_DEFUN([BDEPS_SCAN_FOR_BUILDDEPS],
. $builddepsfile . $builddepsfile
AC_MSG_RESULT([loaded!]) AC_MSG_RESULT([loaded!])
else else
AC_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!]) AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
fi fi
else else
AC_MSG_CHECKING([for builddeps.conf files in sources...]) AC_MSG_CHECKING([for builddeps.conf files in sources...])
...@@ -47,7 +47,7 @@ AC_DEFUN([BDEPS_SCAN_FOR_BUILDDEPS], ...@@ -47,7 +47,7 @@ AC_DEFUN([BDEPS_SCAN_FOR_BUILDDEPS],
. $builddepsfile . $builddepsfile
AC_MSG_RESULT([found at least one!]) AC_MSG_RESULT([found at least one!])
else else
AC_ERROR([Could not find any builddeps.conf at all!]) AC_MSG_ERROR([Could not find any builddeps.conf at all!])
fi fi
fi fi
# Create build and host names that use _ instead of "-" and ".". # Create build and host names that use _ instead of "-" and ".".
...@@ -117,7 +117,7 @@ AC_DEFUN([BDEPS_FTPGET], ...@@ -117,7 +117,7 @@ AC_DEFUN([BDEPS_FTPGET],
) | ftp -in $FTPSERVER ) | ftp -in $FTPSERVER
fi fi
if test "x$VALID_TOOL" != xyes; then if test "x$VALID_TOOL" != xyes; then
AC_ERROR([I do not know how to use the tool: $BDEPS_FTP]) AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP])
fi fi
]) ])
...@@ -159,7 +159,7 @@ AC_DEFUN([BDEPS_CHECK_MODULE], ...@@ -159,7 +159,7 @@ AC_DEFUN([BDEPS_CHECK_MODULE],
thecflags=${builddep_$2_CFLAGS} thecflags=${builddep_$2_CFLAGS}
thelibs=${builddep_$2_LIBS} thelibs=${builddep_$2_LIBS}
if test "x$depdir" = x; then if test "x$depdir" = x; then
AC_ERROR([Could not download build dependency $2]) AC_MSG_ERROR([Could not download build dependency $2])
fi fi
$1=$depdir $1=$depdir
if test "x$theroot" != x; then if test "x$theroot" != x; then
...@@ -198,17 +198,17 @@ AC_DEFUN([BDEPS_FETCH], ...@@ -198,17 +198,17 @@ AC_DEFUN([BDEPS_FETCH],
mkdir -p $installdir mkdir -p $installdir
fi fi
if test ! -d $installdir; then if test ! -d $installdir; then
AC_ERROR([Could not create directory $installdir]) AC_MSG_ERROR([Could not create directory $installdir])
fi fi
tmpfile=`mktemp $installdir/$1.XXXXXXXXX` tmpfile=`mktemp $installdir/$1.XXXXXXXXX`
touch $tmpfile touch $tmpfile
if test ! -f $tmpfile; then if test ! -f $tmpfile; then
AC_ERROR([Could not create files in directory $installdir]) AC_MSG_ERROR([Could not create files in directory $installdir])
fi fi
BDEPS_FTPGET([$3/$2] , [$tmpfile]) BDEPS_FTPGET([$3/$2] , [$tmpfile])
mv $tmpfile $installdir/$filename mv $tmpfile $installdir/$filename
if test ! -s $installdir/$filename; then if test ! -s $installdir/$filename; then
AC_ERROR([Could not download $3/$2]) AC_MSG_ERROR([Could not download $3/$2])
fi fi
case "$extension" in case "$extension" in
zip) echo "Unzipping $installdir/$filename..." zip) echo "Unzipping $installdir/$filename..."
...@@ -220,7 +220,7 @@ AC_DEFUN([BDEPS_FETCH], ...@@ -220,7 +220,7 @@ AC_DEFUN([BDEPS_FETCH],
tgz) echo "Untaring $installdir/$filename..." tgz) echo "Untaring $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
;; ;;
*) AC_ERROR([Cannot handle build depency archive with extension $extension]) *) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension])
;; ;;
esac esac
fi fi
...@@ -228,4 +228,3 @@ AC_DEFUN([BDEPS_FETCH], ...@@ -228,4 +228,3 @@ AC_DEFUN([BDEPS_FETCH],
$5=$installdir $5=$installdir
fi fi
]) ])
此差异已折叠。
此差异已折叠。
...@@ -23,14 +23,16 @@ ...@@ -23,14 +23,16 @@
# questions. # questions.
# #
function prepare_help_system {
AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
}
function help_on_build_dependency { function help_on_build_dependency {
# Print a helpful message on how to acquire the necessary build dependency. # Print a helpful message on how to acquire the necessary build dependency.
# $1 is the help tag: freetyp2, cups, pulse, alsa etc # $1 is the help tag: freetyp2, cups, pulse, alsa etc
MISSING_DEPENDENCY=$1 MISSING_DEPENDENCY=$1
PKGHANDLER_COMMAND= PKGHANDLER_COMMAND=
AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
case $PKGHANDLER in case $PKGHANDLER in
apt-get) apt-get)
apt_help $MISSING_DEPENDENCY ;; apt_help $MISSING_DEPENDENCY ;;
...@@ -47,7 +49,7 @@ function help_on_build_dependency { ...@@ -47,7 +49,7 @@ function help_on_build_dependency {
esac esac
if test "x$PKGHANDLER_COMMAND" != x; then if test "x$PKGHANDLER_COMMAND" != x; then
HELP_MSG="Try running '$PKGHANDLER_COMMAND'." HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
fi fi
} }
......
...@@ -48,7 +48,7 @@ AC_DEFUN([CHECK_FIND_DELETE], ...@@ -48,7 +48,7 @@ AC_DEFUN([CHECK_FIND_DELETE],
AC_DEFUN([CHECK_NONEMPTY], AC_DEFUN([CHECK_NONEMPTY],
[ [
# Test that variable $1 is not empty. # Test that variable $1 is not empty.
if test "" = "[$]$1"; then AC_ERROR(Could not find translit($1,A-Z,a-z) !); fi if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
]) ])
AC_DEFUN([ADD_JVM_ARG_IF_OK], AC_DEFUN([ADD_JVM_ARG_IF_OK],
...@@ -97,7 +97,7 @@ AC_DEFUN([SPACESAFE], ...@@ -97,7 +97,7 @@ AC_DEFUN([SPACESAFE],
$1=`$CYGPATH -s -m -a "[$]$1"` $1=`$CYGPATH -s -m -a "[$]$1"`
$1=`$CYGPATH -u "[$]$1"` $1=`$CYGPATH -u "[$]$1"`
else else
AC_ERROR([You cannot have spaces in $2! "[$]$1"]) AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
fi fi
fi fi
]) ])
...@@ -215,7 +215,7 @@ AC_DEFUN([SETUP_CCACHE_USAGE], ...@@ -215,7 +215,7 @@ AC_DEFUN([SETUP_CCACHE_USAGE],
AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers]) AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
PUSHED_FLAGS="$CXXFLAGS" PUSHED_FLAGS="$CXXFLAGS"
CXXFLAGS="-fpch-preprocess $CXXFLAGS" CXXFLAGS="-fpch-preprocess $CXXFLAGS"
AC_TRY_COMPILE([], [], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
CXXFLAGS="$PUSHED_FLAGS" CXXFLAGS="$PUSHED_FLAGS"
if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
...@@ -257,7 +257,7 @@ AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS], ...@@ -257,7 +257,7 @@ AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
# The same values are setup for BUILD_... # The same values are setup for BUILD_...
# #
# And the legacy variables, for controlling the old makefiles. # And the legacy variables, for controlling the old makefiles.
# LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64... # LEGACY_HOST_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
# LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64... # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
# LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris) # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
# LEGACY_HOST_OS_API=solaris,windows # LEGACY_HOST_OS_API=solaris,windows
...@@ -277,6 +277,13 @@ AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS], ...@@ -277,6 +277,13 @@ AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
LEGACY_HOST_CPU3="" LEGACY_HOST_CPU3=""
LEGACY_BUILD_CPU3="" LEGACY_BUILD_CPU3=""
fi fi
# On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_HOST_CPU1) ...
if test "x$HOST_OS" = xmacosx && test "x$HOST_CPU" = xx64; then
LEGACY_HOST_CPU1="x86_64"
fi
SET_RELEASE_FILE_OS_VALUES()
]) ])
AC_DEFUN([EXTRACT_VARS_FROM_OS_TO], AC_DEFUN([EXTRACT_VARS_FROM_OS_TO],
...@@ -427,7 +434,7 @@ AC_DEFUN([EXTRACT_VARS_FROM_CPU], ...@@ -427,7 +434,7 @@ AC_DEFUN([EXTRACT_VARS_FROM_CPU],
VAR_LEGACY_CPU=s390x VAR_LEGACY_CPU=s390x
;; ;;
*) *)
AC_ERROR([unsupported cpu $1]) AC_MSG_ERROR([unsupported cpu $1])
;; ;;
esac esac
...@@ -515,3 +522,26 @@ AC_DEFUN([WIN_FIX_PATH], ...@@ -515,3 +522,26 @@ AC_DEFUN([WIN_FIX_PATH],
$1="$tmp" $1="$tmp"
fi fi
]) ])
AC_DEFUN([SET_RELEASE_FILE_OS_VALUES],
[
if test "x$HOST_OS" = "xsolaris"; then
REQUIRED_OS_NAME=SunOS
REQUIRED_OS_VERSION=5.10
fi
if test "x$HOST_OS" = "xlinux"; then
REQUIRED_OS_NAME=Linux
REQUIRED_OS_VERSION=2.6
fi
if test "x$HOST_OS" = "xwindows"; then
REQUIRED_OS_NAME=Windows
REQUIRED_OS_VERSION=5.1
fi
if test "x$HOST_OS" = "xmacosx"; then
REQUIRED_OS_NAME=Darwin
REQUIRED_OS_VERSION=11.2
fi
AC_SUBST(REQUIRED_OS_NAME)
AC_SUBST(REQUIRED_OS_VERSION)
])
...@@ -64,6 +64,9 @@ endif ...@@ -64,6 +64,9 @@ endif
# A self-referential reference to this file. # A self-referential reference to this file.
SPEC:=@SPEC@ SPEC:=@SPEC@
# The "human readable" name of this configuration
CONF_NAME:=@CONF_NAME@
# The built jdk will run in this host system. # The built jdk will run in this host system.
HOST:=@HOST@ HOST:=@HOST@
HOST_OS:=@HOST_OS@ HOST_OS:=@HOST_OS@
...@@ -87,6 +90,10 @@ BUILD_CPU_ARCH:=@BUILD_CPU_ARCH@ ...@@ -87,6 +90,10 @@ BUILD_CPU_ARCH:=@BUILD_CPU_ARCH@
BUILD_CPU_BITS:=@BUILD_CPU_BITS@ BUILD_CPU_BITS:=@BUILD_CPU_BITS@
BUILD_CPU_ENDIAN:=@BUILD_CPU_ENDIAN@ BUILD_CPU_ENDIAN:=@BUILD_CPU_ENDIAN@
# Legacy OS values for use in release file.
REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
# Old name for HOST_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc) # Old name for HOST_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
PLATFORM:=@HOST_OS@ PLATFORM:=@HOST_OS@
# Old name for HOST_CPU, uses i586 and amd64, instead of ia32 and x64. # Old name for HOST_CPU, uses i586 and amd64, instead of ia32 and x64.
...@@ -105,6 +112,7 @@ ENDIAN:=@HOST_CPU_ENDIAN@ ...@@ -105,6 +112,7 @@ ENDIAN:=@HOST_CPU_ENDIAN@
@SET_OPENJDK@ @SET_OPENJDK@
JIGSAW:=@JIGSAW@ JIGSAW:=@JIGSAW@
LIBM:=-lm LIBM:=-lm
LIBDL:=@LIBDL@
# colon or semicolon # colon or semicolon
PATH_SEP:=@PATH_SEP@ PATH_SEP:=@PATH_SEP@
...@@ -287,8 +295,8 @@ CUPS_CFLAGS:=@CUPS_CFLAGS@ ...@@ -287,8 +295,8 @@ CUPS_CFLAGS:=@CUPS_CFLAGS@
PACKAGE_PATH=@PACKAGE_PATH@ PACKAGE_PATH=@PACKAGE_PATH@
CACERTS_FILE:=$(SRC_ROOT)/jdk/src/share/lib/security/cacerts # Source file for cacerts
#CACERTS_INT=$(CLOSED_SHARE_SRC)/lib/security/cacerts.internal CACERTS_FILE=@CACERTS_FILE@
#MOZILLA_HEADERS_PATH:= #MOZILLA_HEADERS_PATH:=
...@@ -308,13 +316,18 @@ LD_OUT_OPTION:=@LD_OUT_OPTION@ ...@@ -308,13 +316,18 @@ LD_OUT_OPTION:=@LD_OUT_OPTION@
AR_OUT_OPTION:=@AR_OUT_OPTION@ AR_OUT_OPTION:=@AR_OUT_OPTION@
# Flags used for overriding the default opt setting for a C/C++ source file. # Flags used for overriding the default opt setting for a C/C++ source file.
C_O_FLAG_HIGHEST:=@C_O_FLAG_HIGHEST@
C_O_FLAG_HI:=@C_O_FLAG_HI@ C_O_FLAG_HI:=@C_O_FLAG_HI@
C_O_FLAG_NORM:=@C_O_FLAG_NORM@ C_O_FLAG_NORM:=@C_O_FLAG_NORM@
C_O_FLAG_NONE:=@C_O_FLAG_NONE@ C_O_FLAG_NONE:=@C_O_FLAG_NONE@
CXX_O_FLAG_HIGHEST:=@CXX_O_FLAG_HIGHEST@
CXX_O_FLAG_HI:=@CXX_O_FLAG_HI@ CXX_O_FLAG_HI:=@CXX_O_FLAG_HI@
CXX_O_FLAG_NORM:=@CXX_O_FLAG_NORM@ CXX_O_FLAG_NORM:=@CXX_O_FLAG_NORM@
CXX_O_FLAG_NONE:=@CXX_O_FLAG_NONE@ CXX_O_FLAG_NONE:=@CXX_O_FLAG_NONE@
C_FLAG_DEPS:=@C_FLAG_DEPS@
CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
# Tools that potentially need to be cross compilation aware. # Tools that potentially need to be cross compilation aware.
CC:=@UNCYGDRIVE@ @CCACHE@ @CC@ CC:=@UNCYGDRIVE@ @CCACHE@ @CC@
...@@ -386,6 +399,11 @@ SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@ ...@@ -386,6 +399,11 @@ SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@
# (Note absence of := assignment, because we do not want to evaluate the macro body here) # (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@ SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
# Options for C/CXX compiler to be used if linking is performed
# using reorder file
C_FLAG_REORDER:=@C_FLAG_REORDER@
CXX_FLAG_REORDER:=@CXX_FLAG_REORDER@
# Options to linker to specify the library name. # Options to linker to specify the library name.
# (Note absence of := assignment, because we do not want to evaluate the macro body here) # (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_NAME=@SET_SHARED_LIBRARY_NAME@ SET_SHARED_LIBRARY_NAME=@SET_SHARED_LIBRARY_NAME@
...@@ -406,6 +424,9 @@ STATIC_LIBRARY_SUFFIX:=@STATIC_LIBRARY_SUFFIX@ ...@@ -406,6 +424,9 @@ STATIC_LIBRARY_SUFFIX:=@STATIC_LIBRARY_SUFFIX@
EXE_SUFFIX:=@EXE_SUFFIX@ EXE_SUFFIX:=@EXE_SUFFIX@
OBJ_SUFFIX:=@OBJ_SUFFIX@ OBJ_SUFFIX:=@OBJ_SUFFIX@
POST_STRIP_CMD:=@POST_STRIP_CMD@
POST_MCS_CMD:=@POST_MCS_CMD@
JAVA_FLAGS:=@BOOT_JDK_JVMARGS@ JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
JAVA=@UNCYGDRIVE@ @JAVA@ $(JAVA_FLAGS) JAVA=@UNCYGDRIVE@ @JAVA@ $(JAVA_FLAGS)
...@@ -419,6 +440,8 @@ JAR:=@UNCYGDRIVE@ @JAR@ ...@@ -419,6 +440,8 @@ JAR:=@UNCYGDRIVE@ @JAR@
RMIC:=@UNCYGDRIVE@ @RMIC@ RMIC:=@UNCYGDRIVE@ @RMIC@
NATIVE2ASCII:=@UNCYGDRIVE@ @NATIVE2ASCII@
BOOT_JAR_CMD:=@UNCYGDRIVE@ @JAR@ BOOT_JAR_CMD:=@UNCYGDRIVE@ @JAR@
BOOT_JAR_JFLAGS:= BOOT_JAR_JFLAGS:=
...@@ -483,6 +506,7 @@ OTOOL:=@OTOOL@ ...@@ -483,6 +506,7 @@ OTOOL:=@OTOOL@
READELF:=@READELF@ READELF:=@READELF@
EXPR:=@EXPR@ EXPR:=@EXPR@
FILE:=@FILE@ FILE:=@FILE@
HG:=@HG@
UNCYGDRIVE:=@UNCYGDRIVE@ UNCYGDRIVE:=@UNCYGDRIVE@
...@@ -584,5 +608,13 @@ INSTALL_SYSCONFDIR=@sysconfdir@ ...@@ -584,5 +608,13 @@ INSTALL_SYSCONFDIR=@sysconfdir@
# Misc # Misc
# #
# Name of Service Agent library
SALIB_NAME=@SALIB_NAME@
# Control wether Hotspot runs Queens test after building # Control wether Hotspot runs Queens test after building
TEST_IN_BUILD=@TEST_IN_BUILD@ TEST_IN_BUILD=@TEST_IN_BUILD@
OS_VERSION_MAJOR:=@OS_VERSION_MAJOR@
OS_VERSION_MINOR:=@OS_VERSION_MINOR@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
# #
if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image" echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image"
echo "" echo ""
echo "Compare the directory structure." echo "Compare the directory structure."
echo "Compare the filenames in the directories." echo "Compare the filenames in the directories."
...@@ -55,11 +55,11 @@ if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then ...@@ -55,11 +55,11 @@ if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
echo "Compare the native executables" echo "Compare the native executables"
echo "Compare the remaining files" echo "Compare the remaining files"
echo "" echo ""
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]" echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]"
echo "" echo ""
echo "Compare only the selected subset of the images." echo "Compare only the selected subset of the images."
echo "" echo ""
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar" echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar"
echo "" echo ""
echo "Compare only the CodePointIM.jar file" echo "Compare only the CodePointIM.jar file"
echo "Can be used to compare zips, libraries and executables." echo "Can be used to compare zips, libraries and executables."
...@@ -114,10 +114,10 @@ else ...@@ -114,10 +114,10 @@ else
CMP_OTHER=true CMP_OTHER=true
fi fi
DIFFJARZIP=`dirname $0`/diffjarzip.sh DIFFJARZIP="/bin/bash `dirname $0`/diffjarzip.sh"
DIFFLIB=`dirname $0`/difflib.sh DIFFLIB="/bin/bash `dirname $0`/difflib.sh"
DIFFEXEC=`dirname $0`/diffexec.sh DIFFEXEC="/bin/bash `dirname $0`/diffexec.sh"
export COMPARE_ROOT=/tmp/cimages export COMPARE_ROOT=/tmp/cimages.$USER
mkdir -p $COMPARE_ROOT mkdir -p $COMPARE_ROOT
# Load the correct exception list. # Load the correct exception list.
...@@ -167,16 +167,64 @@ else ...@@ -167,16 +167,64 @@ else
ONLY_OLD=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '<') ONLY_OLD=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '<')
if [ "$ONLY_OLD" ]; then if [ "$ONLY_OLD" ]; then
echo Only in $OLD echo Only in $OLD
echo $ONLY_OLD | sed 's|< ./|\t|g' | sed 's/ /\n/g' echo "$ONLY_OLD" | sed 's|< ./| |g'
fi fi
# Differences in directories found. # Differences in directories found.
ONLY_NEW=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '>') ONLY_NEW=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '>')
if [ "$ONLY_NEW" ]; then if [ "$ONLY_NEW" ]; then
echo Only in $NEW echo Only in $NEW
echo $ONLY_NEW | sed 's|> ./|\t|g' | sed 's/ /\n/g' echo "$ONLY_NEW" | sed 's|> ./| |g'
fi
fi
if [ "`uname`" == "SunOS" ]; then
PERM="gstat -c%a"
elif [ $OSTYPE == "cygwin" ]; then
PERM=
elif [ "`uname`" == "Darwin" ]; then
PERM="stat -f%p"
elif [ "`uname`" == "Linux" ]; then
PERM="stat -c%A"
else
PERM="stat -c%a"
fi
if [ "${PERM}" ]
then
echo -n Permissions...
found=""
for f in `cd $OLD && find . -type f`
do
if [ ! -f ${OLD}/$f ]; then continue; fi
if [ ! -f ${NEW}/$f ]; then continue; fi
OP=`${PERM} ${OLD}/$f`
NP=`${PERM} ${NEW}/$f`
if [ "$OP" != "$NP" ]
then
if [ -z "$found" ]; then echo ; found="yes"; fi
printf "\told: ${OP} new: ${NP}\t$f\n"
fi fi
done
if [ -z "$found" ]; then echo ; found="yes"; fi
fi fi
GENERAL_FILES=$(cd $OLD && find . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
! -name "ct.sym" \
| grep -v "./bin/" | sort | $FILTER)
echo General files...
for f in $GENERAL_FILES
do
if [ -e $NEW/$f ]; then
DIFF_OUT=$(diff $OLD/$f $NEW/$f 2>&1)
if [ -n "$DIFF_OUT" ]; then
echo $f
echo "$DIFF_OUT"
fi
fi
done
if [ "x$CMP_ZIPS" == "xtrue" ]; then if [ "x$CMP_ZIPS" == "xtrue" ]; then
ZIPS=$(cd $OLD && find . -type f -name "*.zip" | sort | $FILTER) ZIPS=$(cd $OLD && find . -type f -name "*.zip" | sort | $FILTER)
...@@ -194,7 +242,7 @@ if [ "x$CMP_ZIPS" == "xtrue" ]; then ...@@ -194,7 +242,7 @@ if [ "x$CMP_ZIPS" == "xtrue" ]; then
fi fi
if [ "x$CMP_JARS" == "xtrue" ]; then if [ "x$CMP_JARS" == "xtrue" ]; then
JARS=$(cd $OLD && find . -type f -name "*.jar" | sort | $FILTER) JARS=$(cd $OLD && find . -type f -name "*.jar" -o -name "ct.sym" | sort | $FILTER)
if [ -n "$JARS" ]; then if [ -n "$JARS" ]; then
echo Jar files... echo Jar files...
......
...@@ -50,14 +50,21 @@ fi ...@@ -50,14 +50,21 @@ fi
if [ "`uname`" == "SunOS" ]; then if [ "`uname`" == "SunOS" ]; then
NM=gnm NM=gnm
STAT=gstat STAT="gstat -c%s"
LDD=ldd
elif [ $OSTYPE == "cygwin" ]; then elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe" NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports NM_ARGS=/exports
STAT=stat STAT="stat -c%s"
LDD=
elif [ "`uname`" == "Darwin" ]; then
NM=nm
STAT="stat -f%z"
LDD="otool -L"
else else
NM=nm NM=nm
STAT=stat STAT="stat -c%s"
LDD=ldd
fi fi
# Should the differences be viewed? # Should the differences be viewed?
...@@ -72,8 +79,8 @@ fi ...@@ -72,8 +79,8 @@ fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1) OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2) NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$($STAT -c%s "$OLD") OLD_SIZE=$($STAT "$OLD")
NEW_SIZE=$($STAT -c%s "$NEW") NEW_SIZE=$($STAT "$NEW")
if [ $# -gt 3 ] if [ $# -gt 3 ]
then then
...@@ -119,15 +126,41 @@ fi ...@@ -119,15 +126,41 @@ fi
DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS) DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
if [ "${LDD}" ]
then
NAME=`basename $OLD`
TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
rm -rf "${TMP}"
mkdir -p "${TMP}"
(cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
(cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
(cd "${TMP}" && rm -f ${NAME})
DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
DEP_MSG=
if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
DEP_MSG="Identical dependencies"
elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
DEP_MSG="Redundant duplicate dependencies added"
RES=1
else
DEP_MSG="DIFFERENT dependencies"
RES=1
fi
fi
RESULT=0 RESULT=0
if [ -n "$DIFFS" ]; then if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ] if [ $OLD_SIZE -ne $NEW_SIZE ]
then then
echo Differences, content AND size : $OLD_NAME echo Differences, content AND size : $DEP_MSG : $OLD_NAME
RESULT=4 RESULT=4
else else
echo Differences, content BUT SAME size: $OLD_NAME echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME
RESULT=3 RESULT=3
fi fi
if [ "x$VIEW" == "xview" ]; then if [ "x$VIEW" == "xview" ]; then
...@@ -136,10 +169,10 @@ if [ -n "$DIFFS" ]; then ...@@ -136,10 +169,10 @@ if [ -n "$DIFFS" ]; then
else else
if [ $OLD_SIZE -ne $NEW_SIZE ] if [ $OLD_SIZE -ne $NEW_SIZE ]
then then
echo Identical symbols BUT NEW size : $OLD_NAME echo Identical symbols BUT NEW size : $DEP_MSG : $OLD_NAME
RESULT=2 RESULT=2
else else
echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME
RESULT=1 RESULT=1
fi fi
fi fi
......
...@@ -84,8 +84,8 @@ if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then ...@@ -84,8 +84,8 @@ if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then
exit 2 exit 2
fi fi
if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ]; then if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ] && [ "$OLD_SUFFIX" != "sym" ]; then
echo The files have to be zip or jar! They are $OLD_SUFFIX echo The files have to be zip, jar or sym! They are $OLD_SUFFIX
exit 2 exit 2
fi fi
...@@ -128,7 +128,7 @@ if [ -n "$ONLY2" ]; then ...@@ -128,7 +128,7 @@ if [ -n "$ONLY2" ]; then
| sed "s|Only in $NEW_TEMPDIR| |"g | sed 's|: |/|g' | sed "s|Only in $NEW_TEMPDIR| |"g | sed 's|: |/|g'
fi fi
DIFFTEXT=`dirname $0`/difftext.sh DIFFTEXT="/bin/bash `dirname $0`/difftext.sh"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep differ | cut -f 2,4 -d ' ' | \ LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep differ | cut -f 2,4 -d ' ' | \
awk "{ print \"$DIFFTEXT \"\$1\" \"\$2 }" > $COMPARE_ROOT/diffing awk "{ print \"$DIFFTEXT \"\$1\" \"\$2 }" > $COMPARE_ROOT/diffing
......
...@@ -54,14 +54,21 @@ fi ...@@ -54,14 +54,21 @@ fi
if [ "`uname`" == "SunOS" ]; then if [ "`uname`" == "SunOS" ]; then
NM=gnm NM=gnm
STAT=gstat STAT="gstat -c%s"
LDD=ldd
elif [ $OSTYPE == "cygwin" ]; then elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe" NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports NM_ARGS=/exports
STAT=stat STAT="stat -c%s"
LDD=
elif [ "`uname`" == "Darwin" ]; then
NM=nm
STAT="stat -f%z"
LDD="otool -L"
else else
NM=nm NM=nm
STAT=stat STAT="stat -c%s"
LDD=ldd
fi fi
# Should the differences be viewed? # Should the differences be viewed?
...@@ -76,8 +83,8 @@ fi ...@@ -76,8 +83,8 @@ fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1) OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2) NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$($STAT -c%s "$OLD") OLD_SIZE=$($STAT "$OLD")
NEW_SIZE=$($STAT -c%s "$NEW") NEW_SIZE=$($STAT "$NEW")
if [ $# -gt 3 ] if [ $# -gt 3 ]
then then
...@@ -139,13 +146,39 @@ DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS) ...@@ -139,13 +146,39 @@ DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
RESULT=0 RESULT=0
if [ "${LDD}" ]
then
NAME=`basename $OLD`
TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
rm -rf "${TMP}"
mkdir -p "${TMP}"
(cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
(cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
(cd "${TMP}" && rm -f ${NAME})
DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
DEP_MSG=
if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
DEP_MSG="Identical dependencies"
elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
DEP_MSG="Redundant duplicate dependencies added"
RES=1
else
DEP_MSG="DIFFERENT dependencies"
RES=1
fi
fi
if [ -n "$DIFFS" ]; then if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ] if [ $OLD_SIZE -ne $NEW_SIZE ]
then then
echo Differences, content AND size : $OLD_NAME echo Differences, content AND size : $DEP_MSG : $OLD_NAME
RESULT=4 RESULT=4
else else
echo Differences, content BUT SAME size: $OLD_NAME echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME
RESULT=3 RESULT=3
fi fi
if [ "x$VIEW" == "xview" ]; then if [ "x$VIEW" == "xview" ]; then
...@@ -154,10 +187,10 @@ if [ -n "$DIFFS" ]; then ...@@ -154,10 +187,10 @@ if [ -n "$DIFFS" ]; then
else else
if [ $OLD_SIZE -ne $NEW_SIZE ] if [ $OLD_SIZE -ne $NEW_SIZE ]
then then
echo Identical symbols BUT NEW size : $OLD_NAME echo Identical symbols BUT NEW size : $DEP_MSG : $OLD_NAME
RESULT=2 RESULT=2
else else
echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME
RESULT=1 RESULT=1
fi fi
fi fi
......
...@@ -37,10 +37,9 @@ ...@@ -37,10 +37,9 @@
# Create a temporary directory to store the result code from # Create a temporary directory to store the result code from
# the wrapped command. # the wrapped command.
RCDIR=`mktemp -d tmp.XXXXXX` || exit $? RCDIR=`mktemp -dt jdk-build-logger.tmp.XXXXXX` || exit $?
trap "rm -rf '$RCDIR'" EXIT trap "rm -rf \"$RCDIR\"" EXIT
LOGFILE=$1 LOGFILE=$1
shift shift
(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > $RCDIR/rc) | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE (exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
exit `cat $RCDIR/rc` exit `cat "$RCDIR/rc"`
...@@ -126,8 +126,7 @@ define SetupArchive ...@@ -126,8 +126,7 @@ define SetupArchive
# JAR:=Jar file to create # JAR:=Jar file to create
# MANIFEST:=Optional manifest file template. # MANIFEST:=Optional manifest file template.
# JARMAIN:=Optional main class to add to manifest # JARMAIN:=Optional main class to add to manifest
# SETUP:=The Java(h) compiler setup, needed to run javah. # JARINDEX :=
# HEADERS:=Directory to put headers in
# SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
# added to the archive. # added to the archive.
# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
...@@ -143,9 +142,8 @@ define SetupArchive ...@@ -143,9 +142,8 @@ define SetupArchive
$(if $(12),$1_$(strip $(12))) $(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13))) $(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14))) $(if $(14),$1_$(strip $(14)))
$(if $(15),$1_$(strip $(15)))
$1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAH := $$($$($1_SETUP)_JAVAH)
$1_JARMAIN:=$(strip $$($1_JARMAIN)) $1_JARMAIN:=$(strip $$($1_JARMAIN))
$1_JARNAME:=$$(notdir $$($1_JAR)) $1_JARNAME:=$$(notdir $$($1_JAR))
$1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
...@@ -155,19 +153,46 @@ define SetupArchive ...@@ -155,19 +153,46 @@ define SetupArchive
$1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications $1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications
$1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native $1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native
$1_BIN:=$$(dir $$($1_JAR)) $1_BIN:=$$(dir $$($1_JAR))
ifeq (,$$($1_SUFFIXES)) ifeq (,$$($1_SUFFIXES))
# No suffix was set, default to classes. # No suffix was set, default to classes.
$1_SUFFIXES:=.class $1_SUFFIXES:=.class
endif endif
# Convert suffixes to a find expression # Convert suffixes to a find expression
$1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES)) $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)) ifneq (,$$($1_INCLUDES))
$1_GREP_INCLUDES:=| $(GREP) $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_INCLUDES))) $1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),\
$$(addprefix $$(src)/,$$($1_INCLUDES)))
$$(eval $$(call ListPathsSafelyNow,$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)) ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
$1_GREP_EXCLUDES:=| $(GREP) -v $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_EXCLUDES) $$($1_EXCLUDE_FILES))) $1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,\
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
$$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
>> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
$1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
endif
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.
$1_ALL_SRCS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
-a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES))))
ifeq (,$$($1_SKIP_METAINF))
$1_ALL_SRCS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
endif endif
# Utility macros, to make the shell script receipt somewhat easier to dechipher. # Utility macros, to make the shell script receipt somewhat easier to dechipher.
# The capture contents macro finds all files (matching the patterns, typically # The capture contents macro finds all files (matching the patterns, typically
...@@ -187,15 +212,6 @@ define SetupArchive ...@@ -187,15 +212,6 @@ define SetupArchive
(cd $$(src) && \ (cd $$(src) && \
$(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \ $(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \
true) &&) true) &&)
# The capture nativeapi macro scans for native api change notificiations. If such notifications are
# found, then we will run javah on the changed classes. It also collects all classes with native methods
# to be used to find out which classes no longer has native methods, to trigger deletion of those .h files.
$1_CAPTURE_NATIVEAPI=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \
$(FIND) . -name _the.package.native.notify | $(SED) 's/package.native.notify/package.native/' | \
$(XARGS) $(CAT) | $(GREP) '^TYPE ' | $(SED) 's/.*TYPE //' >> $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
$(FIND) . -name _the.package.native -exec $(CAT) \{\} \; | $(SED) -n 's/^TYPE //p' >> $$($1_NATIVEAPI_FILE) ; \
true) &&)
# The update contents macro updates the jar file with the previously capture contents. # The update contents macro updates the jar file with the previously capture contents.
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \ (cd $$(src) && \
...@@ -205,13 +221,18 @@ define SetupArchive ...@@ -205,13 +221,18 @@ define SetupArchive
fi) &&) fi) &&)
# The s-variants of the above macros are used when the jar is created from scratch. # The s-variants of the above macros are used when the jar is created from scratch.
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\ $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && ) (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \
$$(src)/_the.$$($1_JARNAME)_contents) && )
ifeq (,$$($1_SKIP_METAINF)) ifeq (,$$($1_SKIP_METAINF))
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\ $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) && ) ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
$$(src)/_the.$$($1_JARNAME)_contents) && )
endif endif
$1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&) (cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
# The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files. # The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files.
# If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random, # If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random,
# ie independent of package --dependes on-> public api of another package. This is of course # ie independent of package --dependes on-> public api of another package. This is of course
...@@ -223,7 +244,7 @@ define SetupArchive ...@@ -223,7 +244,7 @@ define SetupArchive
# Use a slightly shorter name for logging, but with enough path to identify this jar. # Use a slightly shorter name for logging, but with enough path to identify this jar.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR)) $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
# Here is the rule that creates/updates the jar file. # Here is the rule that creates/updates the jar file.
$$($1_JAR) : $2 $$($1_JAR) : $2 $$($1_ALL_SRC)
$(MKDIR) -p $$($1_BIN) $(MKDIR) -p $$($1_BIN)
if [ -n "$$($1_MANIFEST)" ]; then \ if [ -n "$$($1_MANIFEST)" ]; then \
$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \ $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
...@@ -231,9 +252,11 @@ define SetupArchive ...@@ -231,9 +252,11 @@ define SetupArchive
else \ else \
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \ $(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \
fi fi
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE) if [ -n "$$(strip $$($1_JARMAIN))" ]; then \
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE); \
fi
if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \ if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \
$(ECHO) "$$($1_EXTRA_MANIFEST_ATTR)" >> $$($1_MANIFEST_FILE); \ $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \
fi fi
+if [ -s $$@ ]; then \ +if [ -s $$@ ]; then \
$(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \ $(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \
...@@ -255,20 +278,8 @@ define SetupArchive ...@@ -255,20 +278,8 @@ define SetupArchive
$(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \ $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
fi && \ fi && \
$$($1_UPDATE_CONTENTS) true && \ $$($1_UPDATE_CONTENTS) true && \
$$($1_JARINDEX) && \
$$($1_TOUCH_API_FILES) true && \ $$($1_TOUCH_API_FILES) true && \
$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
$$($1_CAPTURE_NATIVEAPI) true && \
if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ]; then \
$(ECHO) Native api change detected in: && $(CAT) $$($1_NATIVEAPI_NOTIFICATIONS_FILE) && \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
fi && \
$(TOUCH) $$($1_NATIVEAPI_FILE)_prev ; \
($(GREP) -xvf $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev > $$($1_NATIVEAPI_FILE)_deleted; true) && \
$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev && \
if [ -s $$($1_NATIVEAPI_FILE)_deleted ]; then \
$(ECHO) Native methods dropped from classes: && $(CAT) $$($1_NATIVEAPI_FILE)_deleted && \
$(RM) `$(CAT) $$($1_NATIVEAPI_FILE)_deleted | $(SED) -e 's|\.|_|g' -e 's|.*|$$($1_HEADERS)/&.h $$($1_HEADERS)/&_*|'` ; \
fi && \
$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \ $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
fi ; \ fi ; \
else \ else \
...@@ -276,15 +287,9 @@ define SetupArchive ...@@ -276,15 +287,9 @@ define SetupArchive
$$($1_SCAPTURE_CONTENTS) \ $$($1_SCAPTURE_CONTENTS) \
$$($1_SCAPTURE_METAINF) \ $$($1_SCAPTURE_METAINF) \
$$($1_SUPDATE_CONTENTS) \ $$($1_SUPDATE_CONTENTS) \
$$($1_JARINDEX) && \
$$($1_TOUCH_API_FILES) true && \ $$($1_TOUCH_API_FILES) true && \
$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \ $(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
$$($1_CAPTURE_NATIVEAPI) true && \
if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_FILE) ]; then \
$(ECHO) Generating native api headers for `$(CAT) $$($1_NATIVEAPI_FILE) | $(WC) -l` classes && \
$(RM) $$($1_HEADERS)/*.h && \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_FILE) && \
$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev ; \
fi && \
$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \ $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \
fi; fi;
...@@ -297,7 +302,7 @@ endef ...@@ -297,7 +302,7 @@ endef
define SetupZipArchive define SetupZipArchive
# param 1 is for example ZIP_MYSOURCE # param 1 is for example ZIP_MYSOURCE
# param 2,3,4,5,6,7,8,9 are named args. # param 2,3,4,5,6,7,8,9 are named args.
# SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES # SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
$(if $2,$1_$(strip $2)) $(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3)) $(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4)) $(if $4,$1_$(strip $4))
...@@ -308,11 +313,17 @@ define SetupZipArchive ...@@ -308,11 +313,17 @@ define SetupZipArchive
$(if $9,$1_$(strip $9)) $(if $9,$1_$(strip $9))
# Find all files in the source tree. # Find all files in the source tree.
$1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*")) $1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
$1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*" \( -name FALSE_DUMMY $$($1_SUFFIX_FILTER) \) ))
ifneq ($$($1_INCLUDES),) ifneq ($$($1_INCLUDES),)
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($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))) $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
endif
$1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS)) $1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
endif endif
ifneq ($$($1_EXCLUDES),) ifneq ($$($1_EXCLUDES),)
...@@ -329,7 +340,7 @@ define SetupZipArchive ...@@ -329,7 +340,7 @@ define SetupZipArchive
# Explicitly excluded files can be given with absolute path. The patsubst solution # 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 # isn't perfect but the likelyhood of an absolute path to match something in a src
# dir is very small. # dir is very small.
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D) $(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME) $(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)))) ;) true $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES)))) ;) true
...@@ -472,7 +483,7 @@ define add_file_to_copy_and_clean ...@@ -472,7 +483,7 @@ define add_file_to_copy_and_clean
| $(SED) -e '/^#/d' -e '/^$$$$/d' \ | $(SED) -e '/^#/d' -e '/^$$$$/d' \
-e :a -e '/\\$$$$/N; s/\\\n//; ta' \ -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
-e 's/^[ \t]*//;s/[ \t]*$$$$//' \ -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
-e 's/\\=/=/' | LANG=C sort > $$@ -e 's/\\=/=/' | LANG=C $(SORT) > $$@
$(CHMOD) -f ug+w $$@ $(CHMOD) -f ug+w $$@
# And do not forget this target # And do not forget this target
...@@ -623,6 +634,7 @@ define SetupJavaCompilation ...@@ -623,6 +634,7 @@ define SetupJavaCompilation
# JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac. # JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac.
# Its only here until we cleanup some nasty source code pasta in the jdk. # Its only here until we cleanup some nasty source code pasta in the jdk.
# HEADERS:=path to directory where all generated c-headers are written. # HEADERS:=path to directory where all generated c-headers are written.
# DEPENDS:=Extra dependecy
$(if $2,$1_$(strip $2)) $(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3)) $(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4)) $(if $4,$1_$(strip $4))
...@@ -650,9 +662,6 @@ $1_JVM := $$($$($1_SETUP)_JVM) ...@@ -650,9 +662,6 @@ $1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAC := $$($$($1_SETUP)_JAVAC) $1_JAVAC := $$($$($1_SETUP)_JAVAC)
$1_JAVAH := $$($$($1_SETUP)_JAVAH) $1_JAVAH := $$($$($1_SETUP)_JAVAH)
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS) $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
ifeq (,$$($1_HEADERS))
$1_HEADERS := $$($1_BIN)
endif
# Handle addons and overrides. # Handle addons and overrides.
$1_SRC:=$$(call ADD_SRCS,$$($1_SRC)) $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
...@@ -776,24 +785,21 @@ ifeq ($$($1_MODE),SINGLE_THREADED_BATCH) ...@@ -776,24 +785,21 @@ ifeq ($$($1_MODE),SINGLE_THREADED_BATCH)
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC))) $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
endif endif
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS)
endif
# Create a sed expression to remove the source roots and to replace / with . # Create a sed expression to remove the source roots and to replace / with .
# and remove .java at the end. # 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' $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
# Here is the batch rules that depends on all the sources. # Here is the batch rules that depends on all the sources.
$$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D) $(MKDIR) -p $$(@D)
$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp $(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp) $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1 $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1
($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) @$$($1_BIN)/_the.batch.tmp && \ ($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
$$(if $$($1_JAVAH),\
$(CAT) $$($1_BIN)/_the.batch.tmp | $(XARGS) $(GREP) -E "[[:space:]]native[[:space:]]|@GenerateNativeHeader" |\
$(GREP) -v '*' | $(GREP) -v '//' | $(CUT) -f 1 -d ':' | $(SORT) -u |\
$(SED) $$($1_REWRITE_INTO_CLASSES) > $$($1_BIN)/_the.batch.natives && \
if test -s $$($1_BIN)/_the.batch.natives; then \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_BIN)" -d $$($1_HEADERS) @$$($1_BIN)/_the.batch.natives ; \
fi &&) \
$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch) $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
else else
# Ok, we have a modern javac server running! # Ok, we have a modern javac server running!
...@@ -868,6 +874,7 @@ ifneq (,$$($1_JAR)) ...@@ -868,6 +874,7 @@ ifneq (,$$($1_JAR))
JARMAIN:=$$($1_JARMAIN),\ JARMAIN:=$$($1_JARMAIN),\
MANIFEST:=$$($1_MANIFEST),\ MANIFEST:=$$($1_MANIFEST),\
EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\ EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
JARINDEX:=$$($1_JARINDEX),\
HEADERS:=$$($1_HEADERS),\ HEADERS:=$$($1_HEADERS),\
SETUP:=$$($1_SETUP))) SETUP:=$$($1_SETUP)))
endif endif
......
...@@ -91,6 +91,15 @@ $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/b ...@@ -91,6 +91,15 @@ $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/b
> $(BUILDTIMESDIR)/build_time_diff_$1 > $(BUILDTIMESDIR)/build_time_diff_$1
endef endef
# Check if the current target is the final target, as specified by
# the user on the command line. If so, call PrintEndMessage.
define CheckIfFinished
$(if $(filter $@,$(MAKECMDGOALS)),$(call PrintEndMessage))
# If no taget is given, "all" is default. Check for that, too.
# At most one of the tests can be true.
$(if $(MAKECMDGOALS),,$(if $(filter $@,all),$(call PrintEndMessage)))
endef
# Indicate that we are done. # Indicate that we are done.
# Record ending time and print out the total time it took to build. # Record ending time and print out the total time it took to build.
define MakeFinish define MakeFinish
...@@ -101,6 +110,7 @@ $(BUILD_LOG_WRAPPER) $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s ### ...@@ -101,6 +110,7 @@ $(BUILD_LOG_WRAPPER) $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s ###
"########################################################################" \ "########################################################################" \
$(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \ $(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \
"########################################################################" "########################################################################"
$(call CheckIfFinished)
endef endef
# Find all build_time_* files and print their contents in a list sorted # Find all build_time_* files and print their contents in a list sorted
...@@ -126,6 +136,18 @@ define StopTimer ...@@ -126,6 +136,18 @@ define StopTimer
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),) $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
endef endef
# Hook to be called as the very first thing when running a normal build
define AtRootMakeStart
$(call PrintStartMessage)
$(call StartTimer)
endef
# Hook to be called as the very last thing for targets that are "top level" targets
define AtRootMakeEnd
$(call StopTimer)
$(call CheckIfFinished)
endef
# If the variable that you want to send to stdout for piping into a file or otherwise, # 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. # 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 # Then you need to use ListPathsSafely, which optimistically splits the output into several shell
...@@ -324,4 +346,51 @@ define ListPathsSafelyNow ...@@ -324,4 +346,51 @@ define ListPathsSafelyNow
endef 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
ifneq ($(findstring $(LOG),debug trace),)
# Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
OLD_SHELL:=$$(SHELL)
SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
endif
endef
# Make sure logging is setup for everyone that includes MakeBase.gmk.
$(eval $(call SetupLogging))
endif # _MAKEBASE_GMK endif # _MAKEBASE_GMK
...@@ -23,49 +23,144 @@ ...@@ -23,49 +23,144 @@
# questions. # questions.
# #
# Default to sane output from make. # This must be the first rule
# Override with empty string to get insane amount of output. default: all
# Override with -d to get even more insane amount of debugging output.
# Override with "-d -p" to get it all. # Find out which variables were passed explicitely on the make command line. These
VERBOSE=-s # will be passed on to sub-makes, overriding spec.gmk settings.
MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)=$($(var)))
define fatal-error
# If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
$$(if $$(findstring help,$$(MAKECMDGOALS)),,$$(error Cannot continue))
endef
ifeq ($(origin VERBOSE),undefined)
# Setup logging according to LOG (but only if VERBOSE is not given)
ifeq ($(LOG),)
# Set LOG to "warn" as default if not set (and no VERBOSE given)
LOG=warn
endif
ifeq ($(LOG),warn)
VERBOSE=-s
else ifeq ($(LOG),info)
VERBOSE=
else ifeq ($(LOG),debug)
VERBOSE=
else ifeq ($(LOG),trace)
VERBOSE=-d -p
else
$(info Error: LOG must be one of: warn, info, debug or trace.)
$(eval $(call fatal-error))
endif
else
ifneq ($(LOG),)
# We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
# but complain if this is the top-level make call.
ifeq ($(MAKELEVEL),0)
$(info Cannot use LOG=$(LOG) and VERBOSE=$(VERBOSE) at the same time. Choose one.)
$(eval $(call fatal-error))
endif
endif
endif
# TODO: Fix duplication in MakeBase.gmk
define SetupLogging
ifneq ($(findstring $(LOG),debug trace),)
# Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
OLD_SHELL:=$$(SHELL)
SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
endif
endef
$(eval $(call SetupLogging))
# Find all environment or command line variables that begin with ALT. # Find all environment or command line variables that begin with ALT.
list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))) list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins))) list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
ifneq ($(list_alt_overrides),)
$(info You have set the following ALT_ variables:) ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
$(foreach var,$(list_alt_overrides), $(info $(var)=$($(var)))) makefile_path=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
$(error Using ALT_ variables is deprecated! Please clean your environment!) else
makefile_path=$(lastword $(MAKEFILE_LIST))
endif endif
root_dir=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
output_dir=$(root_dir)/build
# The spec.gmk file contains the variables extracted by the configure script. ifneq ($(origin SPEC),undefined)
# It is usually set with SPEC=....spec.gmk on the make command line. # We have been given a SPEC, check that it works out properly
# However if you simply type make from the openjdk source root, it will go looking ifeq ($(wildcard $(SPEC)),)
# for a spec file, if only one is found, use it. If more than one is found, $(info Cannot locate spec.gmk, given by SPEC=$(SPEC))
# complain. If none is found, request the user to run configure! $(eval $(call fatal-error))
SPEC ?= $(wildcard $(CURDIR)/../../build/*/spec.gmk) endif
ifneq ($(origin CONF),undefined)
# We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
# but complain if this is the top-level make call.
ifeq ($(MAKELEVEL),0)
$(info Cannot use CONF=$(CONF) and SPEC=$(SPEC) at the same time. Choose one.)
$(eval $(call fatal-error))
endif
endif
# ... OK, we're satisfied, we'll use this SPEC later on
else
# Find all spec.gmk files in the build output directory
all_spec_files=$(wildcard $(output_dir)/*/spec.gmk)
ifeq ($(all_spec_files),)
$(info No configurations found for $(root_dir)! Please run configure to create a configuration.)
$(eval $(call fatal-error))
endif
# Extract the configuration names from the path
all_confs=$(patsubst %/spec.gmk,%,$(patsubst $(output_dir)/%,%,$(all_spec_files)))
ifeq ($(words $(SPEC)),0) ifneq ($(origin CONF),undefined)
$(error You must run configure!) # User have given a CONF= argument.
endif ifeq ($(CONF),)
# If given CONF=, match all configurations
matching_confs=$(strip $(all_confs))
else
# Otherwise select those that contain the given CONF string
matching_confs=$(strip $(foreach var,$(all_confs),$(if $(findstring $(CONF),$(var)),$(var))))
endif
ifeq ($(matching_confs),)
$(info No configurations found matching CONF=$(CONF))
$(info Available configurations:)
$(foreach var,$(all_confs),$(info * $(var)))
$(eval $(call fatal-error))
else
ifeq ($(words $(matching_confs)),1)
$(info Building '$(matching_confs)' (matching CONF=$(CONF)))
else
$(info Building the following configurations (matching CONF=$(CONF)):)
$(foreach var,$(matching_confs),$(info * $(var)))
endif
endif
ifneq ($(words $(SPEC)),1) # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
ifeq ($(MAKECMDGOALS),all-conf) SPEC=$(addsuffix /spec.gmk,$(addprefix $(output_dir)/,$(matching_confs)))
SPECS:=$(shell echo $(SPEC) | sed -e 's|$(CURDIR)/build/||g' -e 's|/spec.gmk|\\n|g' -e 's| ||g')
allconf:
@echo Building configurations:
@printf "$(SPECS)"
@$(foreach s,$(SPEC),($(MAKE) SPEC=$s $(VERBOSE) VERBOSE=$(VERBOSE) images) &&) true
@echo Done building configurations:
@printf "$(SPECS)"
.PHONY: all-conf
else else
$(error Since you have more than one output dir configured under build, \ # No CONF or SPEC given, check the available configurations
you have to either run make from the output dir of your choice \ ifneq ($(words $(all_spec_files)),1)
or specify run "make SPEC=build/.../spec.gmk" or run all the build configurations \ $(info No CONF or SPEC given, but more than one spec.gmk found in $(output_dir).)
using "make all-conf") $(info Available configurations:)
$(foreach var,$(all_confs),$(info * $(var)))
$(info Please retry building with CONF=<config> or SPEC=<specfile>)
$(eval $(call fatal-error))
endif endif
# We found exactly one configuration, use it
SPEC=$(strip $(all_spec_files))
endif
endif
ifneq ($(words $(SPEC)),1)
# We have multiple configurations to build, call make repeatedly
all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean:
@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true
.PHONY: all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean
else else
# This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
# Now load the spec # Now load the spec
-include $(SPEC) -include $(SPEC)
...@@ -88,51 +183,101 @@ $(eval $(call ResetTimers)) ...@@ -88,51 +183,101 @@ $(eval $(call ResetTimers))
# Clean out any notifications from the previous build. # Clean out any notifications from the previous build.
$(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) $(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
# If make was called explicitely with -j, don't add a -j ourself to sub-makes, since
# this will be inherited automatically by make. Otherwise use our default for sub-makes.
# The -j in MAKEFLAGS is only visible when executing a recipe, hence this macro.
define GetMakeJobFlag
$(if $(findstring -j,$(MAKEFLAGS)),,-j$(NUM_CORES))
endef
define CheckEnvironment
$(if $(list_alt_overrides),
@$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
@$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
@$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n"
)
endef
define PrintStartMessage
$(if $(VERBOSE),,@$(ECHO) Running make as $(MAKE) $(MFLAGS) $(MAKE_ARGS))
$(call CheckEnvironment)
@$(ECHO) "Building OpenJDK for target $(if $(MAKECMDGOALS),'$(MAKECMDGOALS)','all') in configuration '$(CONF_NAME)'"
endef
define PrintEndMessage
@$(ECHO) "Finished building OpenJDK for target '$@'"
$(call CheckEnvironment)
endef
all: jdk all: jdk
@$(call StopTimer)
@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
@$(call AtRootMakeEnd)
langtools: start-timer langtools: start-make
@$(call MakeStart,langtools,all) @$(call MakeStart,langtools,all)
@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(LANGTOOLS_MAKE_ARGS)) @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(LANGTOOLS_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,langtools,all) @$(call MakeFinish,langtools,all)
corba: langtools corba: langtools
@$(call MakeStart,corba,all) @$(call MakeStart,corba,all)
@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,corba,all) @$(call MakeFinish,corba,all)
jaxp: langtools jaxp: langtools
@$(call MakeStart,jaxp,all) @$(call MakeStart,jaxp,all)
@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,jaxp,all) @$(call MakeFinish,jaxp,all)
jaxws: langtools jaxp jaxws: langtools jaxp
@$(call MakeStart,jaxws,all) @$(call MakeStart,jaxws,all)
@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,jaxws,all) @$(call MakeFinish,jaxws,all)
hotspot: langtools hotspot: langtools
@$(call MakeStart,hotspot,all) @$(call MakeStart,hotspot,all)
@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS)) @($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,hotspot,all) @$(call MakeFinish,hotspot,all)
jdk: langtools corba jaxp jaxws hotspot jdk: langtools corba jaxp jaxws hotspot
@$(call MakeStart,jdk,all) @$(call MakeStart,jdk,all)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS)) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS))
@$(call MakeFinish,jdk,all) @$(call MakeFinish,jdk,all)
images install packages: start-timer jdk langtools corba jaxp jaxws hotspot images install packages: source-tips start-make jdk langtools corba jaxp jaxws hotspot
@$(call MakeStart,jdk-images,$@) @$(call MakeStart,jdk-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS) $@) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
@$(call MakeFinish,jdk-images,$@) @$(call MakeFinish,jdk-images,$@)
@$(call StopTimer)
@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
@$(call AtRootMakeEnd)
old-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot
@$(call MakeStart,jdk-old-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
@$(call MakeFinish,old-jdk-images,$@)
@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
@$(call AtRootMakeEnd)
start-make:
@$(call AtRootMakeStart)
start-timer: .PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-make
@$(call StartTimer)
test: start-make
@$(call MakeStart,test,$(if $(TEST),$(TEST),all))
@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
@$(call MakeFinish,test,$(if $(TEST),$(TEST),all))
@$(call AtRootMakeEnd)
.PHONY: test
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
source-tips: $(OUTPUT_ROOT)/source_tips
$(OUTPUT_ROOT)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(call GetSourceTips)
.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-timer
# Remove everything, except the output from configure. # Remove everything, except the output from configure.
clean: clean:
...@@ -152,25 +297,35 @@ clean-jdk: ...@@ -152,25 +297,35 @@ clean-jdk:
@$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)" @$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
.PHONY: clean .PHONY: clean
endif
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
# If you addd more global targets, please update the fatal-error macro.
help: help:
$(info ) $(info )
$(info Typical make commands:) $(info OpenJDK Makefile help)
$(info make) $(info =====================)
$(info make VERBOSE= # print all commands) $(info )
$(info make VERBOSE="-d -p" # debug make as well) $(info Common make targets)
$(info make all-conf # build images for all configurations) $(info . make [all] # Compile all code but do not create images)
$(info make clean # remove build artifacts) $(info . make images # Create complete j2sdk and j2re images)
$(info make dist-clean # you have to rerun configure) $(info . make install # Install the generated images locally)
# $(info make test # run tests) $(info . make clean # Remove all files generated by make, but not those generated by configure)
$(info make images # create the jdk and jre images) $(info . make dist-clean # Remove all files generated by both make and configure)
$(info make install # install the jdk image) $(info . make help # Give some help on using make)
# $(info make modules # EXPERIMENTAL: Migrate JDK into a modularized form!) $(info . make test # Run tests, default is all tests (see TEST below))
$(info make packages # create zips and other packages) $(info )
$(info Useful make variables)
# $(info make eclipse_workspace # Create an Eclipse workspace) $(info . make CONF= # Build all configurations (note, assignment is empty))
# $(info make netbeans_workspace # Create a NetBeans workspace) $(info . make CONF=<substring> # Build the configuration(s) with a name matching the given substring)
# $(info make vs_workspace # Create a Visual Studio workspace) $(info )
$(info . make LOG=<loglevel> # Change loglevel from warn (default) to the given loglevel)
$(info . # Available loglevels are: warn, info, debug and trace)
$(info . # To see executed command lines, use LOG=info)
$(info )
$(info . make test TEST=<test> # Only run the given test or tests, e.g.)
$(info . # make test TEST="jdk_lang jdk_net")
$(info )
.PHONY: help .PHONY: help
FRC: # Force target
endif
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# desired whenever sort is used below! # desired whenever sort is used below!
ifeq (,$(_MAKEBASE_GMK)) ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
endif endif
ifeq ($(COMPILER_TYPE),CC) ifeq ($(COMPILER_TYPE),CC)
...@@ -54,15 +54,22 @@ define add_native_source ...@@ -54,15 +54,22 @@ define add_native_source
ifneq (,$$(filter %.c,$2)) ifneq (,$$(filter %.c,$2))
# Compile as a C file # Compile as a C file
$1_$2_FLAGS=$4 $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS)
$1_$2_COMP=$5 $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)
$1_$2_COMP=$5
$1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
else else
# Compile as a C++ file # Compile as a C++ file
$1_$2_FLAGS=$6 $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS)
$1_$2_COMP=$7 $1_$2_COMP=$7
$1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
endif endif
# Generate the .o (.obj) file name and place it in the bin dir. # 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),$$(notdir $2))) $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $2))))
# Only continue if this object file hasn't been processed already. This lets the first found # 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. # source file override any other with the same name.
ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR))) ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR)))
...@@ -80,7 +87,7 @@ define add_native_source ...@@ -80,7 +87,7 @@ define add_native_source
$$($1_$2_OBJ) : $2 $$($1_$2_OBJ) : $2
ifeq ($(COMPILER_TYPE),CC) ifeq ($(COMPILER_TYPE),CC)
$$(call COMPILING_MSG,$$(notdir $2)) $$(call COMPILING_MSG,$$(notdir $2))
$$($1_$2_COMP) $$($1_$2_FLAGS) -MMD -MF $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
endif endif
ifeq ($(COMPILER_TYPE),CL) ifeq ($(COMPILER_TYPE),CL)
$$(call COMPILING_MSG,$$(notdir $2)) $$(call COMPILING_MSG,$$(notdir $2))
...@@ -109,6 +116,8 @@ define SetupNativeCompilation ...@@ -109,6 +116,8 @@ define SetupNativeCompilation
# EXCLUDE_FILES with these names # EXCLUDE_FILES with these names
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
# RC_FLAGS flags for RC. # RC_FLAGS flags for RC.
# MAPFILE mapfile
# REORDER reorder file
$(if $2,$1_$(strip $2)) $(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3)) $(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4)) $(if $4,$1_$(strip $4))
...@@ -154,7 +163,7 @@ define SetupNativeCompilation ...@@ -154,7 +163,7 @@ define SetupNativeCompilation
ifneq ($$($1_EXCLUDE_FILES),) ifneq ($$($1_EXCLUDE_FILES),)
$1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES)) $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES))
endif endif
$1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp,$$($1_ALL_SRCS))) $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp %.m,$$($1_ALL_SRCS)))
ifneq (,$$(strip $$($1_INCLUDE_FILES))) ifneq (,$$(strip $$($1_INCLUDE_FILES)))
$1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS)) $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS))
endif endif
...@@ -178,7 +187,7 @@ define SetupNativeCompilation ...@@ -178,7 +187,7 @@ define SetupNativeCompilation
# Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides
# a reproducable order on the input files to the linker). # a reproducable order on the input files to the linker).
$1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS)))))) $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS)))))))
$1 := $$($1_EXPECTED_OBJS) $1 := $$($1_EXPECTED_OBJS)
# Are there too many object files on disk? Perhaps because some source file was removed? # 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))) $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
...@@ -218,6 +227,11 @@ define SetupNativeCompilation ...@@ -218,6 +227,11 @@ define SetupNativeCompilation
$1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS) $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
endif endif
ifneq (,$$($1_REORDER))
$1_EXTRA_CFLAGS += $$(C_FLAG_REORDER)
$1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
endif
# Now create a list of the packages that are about to compile. Used when sending source # Now create a list of the packages that are about to compile. Used when sending source
# in a batch to the compiler. # in a batch to the compiler.
$$(shell $(RM) $$($1_BIN)/_the.list_of_sources) $$(shell $(RM) $$($1_BIN)/_the.list_of_sources)
...@@ -233,29 +247,53 @@ define SetupNativeCompilation ...@@ -233,29 +247,53 @@ define SetupNativeCompilation
ifeq ($(HOST_OS_API), winapi) ifeq ($(HOST_OS_API), winapi)
ifneq (,$$($1_VERSIONINFO_RESOURCE)) ifneq (,$$($1_VERSIONINFO_RESOURCE))
ifneq (,$$($1_LIB)) ifneq (,$$($1_LIB))
ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB))) $1_BASENAME:=$$(basename $$(notdir $$($1_LIB)))
$1_RES:=$$(patsubst %$(SHARED_LIBRARY_SUFFIX),%.res,$$($1_LIB))
else
$1_RES:=$$(patsubst %$(STATIC_LIBRARY_SUFFIX),%.res,$$($1_LIB))
endif
endif endif
ifneq (,$$($1_EXE)) ifneq (,$$($1_EXE))
$1_RES:=$$(patsubst %$(EXE_SUFFIX),%.res,$$($1_EXE)) $1_BASENAME:=$$(basename $$(notdir $$($1_EXE)))
endif endif
$1_RES:=$$($1_BIN)/$$($1_BASENAME).res
$$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES): $$($1_VERSIONINFO_RESOURCE)
$(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
endif endif
ifneq (,$$($1_MANIFEST))
$1_PROGRAM:=$$(basename $$(notdir $$($1_EXE)))
$1_GEN_MANIFEST:=$$($1_BIN)/$$($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 ($(HOST_OS),macosx)
ifneq ($(HOST_OS),windows)
$1_REAL_MAPFILE := $$($1_MAPFILE)
ifneq (,$$($1_REORDER))
$1_REAL_MAPFILE := $$($1_BIN)/mapfile
$$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
$$(MKDIR) -p $$(@D)
$$(CP) $$($1_MAPFILE) $$@.tmp
$$(SED) -e 's=OUTPUTDIR=$$($1_BIN)=' $$($1_REORDER) >> $$@.tmp
$$(MV) $$@.tmp $$@
endif
endif
endif endif
# Pickup extra HOST_OS_API dependent variables (posix or winapi) and # Pickup extra HOST_OS_API dependent variables (posix or winapi) and
# (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX # (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX
$1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(HOST_OS_API)) $$($1_LDFLAGS_$(PLATFORM)) $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(HOST_OS_API)) $$($1_LDFLAGS_$(PLATFORM))
$1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(HOST_OS_API)) $$($1_LDFLAGS_SUFFIX_$(PLATFORM)) $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(HOST_OS_API)) $$($1_LDFLAGS_SUFFIX_$(PLATFORM))
ifneq (,$$($1_REAL_MAPFILE))
$1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
endif
ifneq (,$$($1_LIB)) ifneq (,$$($1_LIB))
ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB))) ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB)))
# Generating a dynamic library. # Generating a dynamic library.
$1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$(notdir $$($1_LIB))) $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$(notdir $$($1_LIB)))
$$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
$$(call LINKING_MSG,$$(notdir $$($1_LIB))) $$(call LINKING_MSG,$$(notdir $$($1_LIB)))
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$($1_LIB) \ $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$($1_LIB) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
...@@ -269,9 +307,13 @@ define SetupNativeCompilation ...@@ -269,9 +307,13 @@ define SetupNativeCompilation
endif endif
ifneq (,$$($1_EXE)) ifneq (,$$($1_EXE))
# A executable binary has been specified, setup the target for it. # A executable binary has been specified, setup the target for it.
$$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
$$(call LINKING_EXE_MSG,$$(notdir $$($1_EXE))) $$(call LINKING_EXE_MSG,$$(notdir $$($1_EXE)))
$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_EXE) \ $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_EXE) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($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
endif endif
endef endef
...@@ -112,6 +112,9 @@ for i in ${repos} ; do ...@@ -112,6 +112,9 @@ for i in ${repos} ; do
sleep 5 sleep 5
fi fi
done done
# Wait for all hg commands to complete
wait
if [ "${repos_extra}" != "" ] ; then if [ "${repos_extra}" != "" ] ; then
for i in ${repos_extra} ; do for i in ${repos_extra} ; do
echo "Starting on ${i}" echo "Starting on ${i}"
...@@ -127,11 +130,10 @@ if [ "${repos_extra}" != "" ] ; then ...@@ -127,11 +130,10 @@ if [ "${repos_extra}" != "" ] ; then
sleep 5 sleep 5
fi fi
done done
# Wait for all hg commands to complete
wait
fi fi
# Wait for all hg commands to complete
wait
# Cleanup # Cleanup
rm -f -r ${tmp} rm -f -r ${tmp}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册