Merge
authorduke
Wed, 05 Jul 2017 21:49:19 +0200
changeset 38850 268805b678a7
parent 38849 407ee1280983 (current diff)
parent 38848 0bc7ed792590 (diff)
child 38893 9ed71a236594
Merge
--- a/.hgtags-top-repo	Thu Jun 09 17:28:36 2016 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 21:49:19 2017 +0200
@@ -364,3 +364,4 @@
 3463a3f14f0f0e8a68f29ac6405454f2fa2f598a jdk-9+119
 647e0142a5a52749db572b5e6638d561def6479e jdk-9+120
 cae471d3b87783e0a3deea658e1e1c84b2485b6c jdk-9+121
+346be2df0f5b31d423807f53a719d1b9a67f3354 jdk-9+122
--- a/common/autoconf/basics.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/basics.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -99,8 +99,8 @@
   $ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD
   $ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD
   OUTPUT=`$3 $1 -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     $2="[$]$2 $1"
     JVM_ARG_OK=true
@@ -715,7 +715,7 @@
 
         if test -n "$SDKNAME"; then
           # Call xcodebuild to determine SYSROOT
-          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | $GREP '^Path: ' | $SED 's/Path: //'`
         fi
       else
         if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
@@ -994,18 +994,18 @@
   TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
   if test -f $DELETEDIR/TestIfFindSupportsDelete; then
     # No, it does not.
-    rm $DELETEDIR/TestIfFindSupportsDelete
+    $RM $DELETEDIR/TestIfFindSupportsDelete
     if test "x$OPENJDK_TARGET_OS" = "xaix"; then
       # AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
-      FIND_DELETE="-print | xargs rm"
+      FIND_DELETE="-print | $XARGS $RM"
     else
-      FIND_DELETE="-exec rm \{\} \+"
+      FIND_DELETE="-exec $RM \{\} \+"
     fi
     AC_MSG_RESULT([no])
   else
     AC_MSG_RESULT([yes])
   fi
-  rmdir $DELETEDIR
+  $RMDIR $DELETEDIR
   AC_SUBST(FIND_DELETE)
 ])
 
@@ -1080,10 +1080,10 @@
     if test "x$CODESIGN" != "x"; then
       # Verify that the openjdk_codesign certificate is present
       AC_MSG_CHECKING([if openjdk_codesign certificate is present])
-      rm -f codesign-testfile
-      touch codesign-testfile
-      codesign -s openjdk_codesign codesign-testfile 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD || CODESIGN=
-      rm -f codesign-testfile
+      $RM codesign-testfile
+      $TOUCH codesign-testfile
+      $CODESIGN -s openjdk_codesign codesign-testfile 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD || CODESIGN=
+      $RM codesign-testfile
       if test "x$CODESIGN" = x; then
         AC_MSG_RESULT([no])
       else
--- a/common/autoconf/basics_windows.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/basics_windows.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -330,7 +330,7 @@
     fi
     AC_MSG_CHECKING([cygwin root directory as unix-style path])
     # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
-    cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
+    cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"`
     # Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
     CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
     AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
@@ -349,7 +349,7 @@
 
     AC_MSG_CHECKING([msys root directory as unix-style path])
     # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
-    MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
+    MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
     AC_MSG_RESULT([$MSYS_ROOT_PATH])
     WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
@@ -392,7 +392,7 @@
       # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
       # @ was chosen as separator to minimize risk of other tools messing around with it
       all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \
-          | tr ' ' '\n' | grep '^/./' | sort | uniq`
+          | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
       fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
       FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
     fi
--- a/common/autoconf/boot-jdk.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/boot-jdk.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -74,7 +74,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`]
@@ -445,7 +445,7 @@
         BUILD_JDK_FOUND=no
       else
         # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
         # Extra M4 quote needed to protect [] in grep expression.
         [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`]
--- a/common/autoconf/build-performance.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/build-performance.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -383,7 +383,7 @@
       else
         AC_MSG_RESULT([yes])
       fi
-      rm -f conftest.h conftest.hpp.gch
+      $RM conftest.h conftest.hpp.gch
     fi
   fi
 
--- a/common/autoconf/flags.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/flags.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -155,7 +155,7 @@
         AC_MSG_RESULT(no)
         COMPILER_COMMAND_FILE_FLAG=
       fi
-      rm -rf command.file
+      $RM command.file
     fi
   fi
   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
--- a/common/autoconf/generated-configure.sh	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 21:49:19 2017 +0200
@@ -5092,7 +5092,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1464173584
+DATE_WHEN_GENERATED=1465306933
 
 ###############################################################################
 #
@@ -16171,7 +16171,7 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5
 $as_echo_n "checking cygwin root directory as unix-style path... " >&6; }
     # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
-    cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
+    cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"`
     # Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
     CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5
@@ -16194,7 +16194,7 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking msys root directory as unix-style path" >&5
 $as_echo_n "checking msys root directory as unix-style path... " >&6; }
     # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
-    MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
+    MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
 
   windows_path="$MSYS_ROOT_PATH"
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -17185,7 +17185,7 @@
 
         if test -n "$SDKNAME"; then
           # Call xcodebuild to determine SYSROOT
-          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | $GREP '^Path: ' | $SED 's/Path: //'`
         fi
       else
         if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
@@ -21142,12 +21142,12 @@
   TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
   if test -f $DELETEDIR/TestIfFindSupportsDelete; then
     # No, it does not.
-    rm $DELETEDIR/TestIfFindSupportsDelete
+    $RM $DELETEDIR/TestIfFindSupportsDelete
     if test "x$OPENJDK_TARGET_OS" = "xaix"; then
       # AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
-      FIND_DELETE="-print | xargs rm"
-    else
-      FIND_DELETE="-exec rm \{\} \+"
+      FIND_DELETE="-print | $XARGS $RM"
+    else
+      FIND_DELETE="-exec $RM \{\} \+"
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -21155,7 +21155,7 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   fi
-  rmdir $DELETEDIR
+  $RMDIR $DELETEDIR
 
 
 
@@ -23800,10 +23800,10 @@
       # Verify that the openjdk_codesign certificate is present
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if openjdk_codesign certificate is present" >&5
 $as_echo_n "checking if openjdk_codesign certificate is present... " >&6; }
-      rm -f codesign-testfile
-      touch codesign-testfile
-      codesign -s openjdk_codesign codesign-testfile 2>&5 >&5 || CODESIGN=
-      rm -f codesign-testfile
+      $RM codesign-testfile
+      $TOUCH codesign-testfile
+      $CODESIGN -s openjdk_codesign codesign-testfile 2>&5 >&5 || CODESIGN=
+      $RM codesign-testfile
       if test "x$CODESIGN" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -24293,7 +24293,7 @@
   elif test "x$with_copyright_year" != x; then
     COPYRIGHT_YEAR="$with_copyright_year"
   else
-    COPYRIGHT_YEAR=`date +'%Y'`
+    COPYRIGHT_YEAR=`$DATE +'%Y'`
   fi
 
 
@@ -24815,7 +24815,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25017,7 +25017,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25207,7 +25207,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25396,7 +25396,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25585,7 +25585,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25765,7 +25765,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26096,7 +26096,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26427,7 +26427,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26645,7 +26645,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26828,7 +26828,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27039,7 +27039,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27222,7 +27222,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27433,7 +27433,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27616,7 +27616,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27827,7 +27827,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28010,7 +28010,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28208,7 +28208,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28389,7 +28389,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28588,7 +28588,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28769,7 +28769,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28967,7 +28967,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29148,7 +29148,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29347,7 +29347,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29528,7 +29528,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29708,7 +29708,7 @@
           BOOT_JDK_FOUND=no
         else
           # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
           FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -30612,8 +30612,8 @@
   $ECHO "Check if jvm arg is ok: -Xpatch:foo=bar" >&5
   $ECHO "Command: $JAVA -Xpatch:foo=bar -version" >&5
   OUTPUT=`$JAVA -Xpatch:foo=bar -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     dummy="$dummy -Xpatch:foo=bar"
     JVM_ARG_OK=true
@@ -30697,7 +30697,7 @@
         BUILD_JDK_FOUND=no
       else
         # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
         # Extra M4 quote needed to protect [] in grep expression.
         FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`
@@ -47860,7 +47860,7 @@
 $as_echo "yes" >&6; }
       USING_BROKEN_SUSE_LD=yes
     fi
-    rm -rf version-script.map main.c a.out
+    $RM version-script.map main.c a.out
   fi
 
 
@@ -48294,7 +48294,7 @@
 $as_echo "no" >&6; }
         COMPILER_COMMAND_FILE_FLAG=
       fi
-      rm -rf command.file
+      $RM command.file
     fi
   fi
 
@@ -53498,7 +53498,7 @@
       # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
       # @ was chosen as separator to minimize risk of other tools messing around with it
       all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" \
-          | tr ' ' '\n' | grep '^/./' | sort | uniq`
+          | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
       fixpath_argument_list=`echo $all_unique_prefixes  | tr ' ' '@'`
       FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
     fi
@@ -63947,7 +63947,7 @@
         fi
       fi
     done
-    llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
+    llvm_version=$("${LLVM_CONFIG}" --version | $SED 's/\.//; s/svn.*//')
     LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
 
     unset LLVM_LDFLAGS
@@ -65050,8 +65050,8 @@
   $ECHO "Check if jvm arg is ok: -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput" >&5
   $ECHO "Command: $JAVA -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput -version" >&5
   OUTPUT=`$JAVA -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs="$boot_jdk_jvmargs -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput"
     JVM_ARG_OK=true
@@ -65067,8 +65067,8 @@
   $ECHO "Check if jvm arg is ok: $with_boot_jdk_jvmargs" >&5
   $ECHO "Command: $JAVA $with_boot_jdk_jvmargs -version" >&5
   OUTPUT=`$JAVA $with_boot_jdk_jvmargs -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs="$boot_jdk_jvmargs $with_boot_jdk_jvmargs"
     JVM_ARG_OK=true
@@ -65095,8 +65095,8 @@
   $ECHO "Check if jvm arg is ok: -Xms64M" >&5
   $ECHO "Command: $JAVA -Xms64M -version" >&5
   OUTPUT=`$JAVA -Xms64M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xms64M"
     JVM_ARG_OK=true
@@ -65130,8 +65130,8 @@
   $ECHO "Check if jvm arg is ok: -Xmx${JVM_MAX_HEAP}M" >&5
   $ECHO "Command: $JAVA -Xmx${JVM_MAX_HEAP}M -version" >&5
   OUTPUT=`$JAVA -Xmx${JVM_MAX_HEAP}M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xmx${JVM_MAX_HEAP}M"
     JVM_ARG_OK=true
@@ -65145,8 +65145,8 @@
   $ECHO "Check if jvm arg is ok: -XX:ThreadStackSize=$STACK_SIZE" >&5
   $ECHO "Command: $JAVA -XX:ThreadStackSize=$STACK_SIZE -version" >&5
   OUTPUT=`$JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -XX:ThreadStackSize=$STACK_SIZE"
     JVM_ARG_OK=true
@@ -65175,8 +65175,8 @@
   $ECHO "Check if jvm arg is ok: -XX:+UseSerialGC" >&5
   $ECHO "Command: $JAVA -XX:+UseSerialGC -version" >&5
   OUTPUT=`$JAVA -XX:+UseSerialGC -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:+UseSerialGC"
     JVM_ARG_OK=true
@@ -65190,8 +65190,8 @@
   $ECHO "Check if jvm arg is ok: -Xms32M" >&5
   $ECHO "Command: $JAVA -Xms32M -version" >&5
   OUTPUT=`$JAVA -Xms32M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xms32M"
     JVM_ARG_OK=true
@@ -65205,8 +65205,8 @@
   $ECHO "Check if jvm arg is ok: -Xmx512M" >&5
   $ECHO "Command: $JAVA -Xmx512M -version" >&5
   OUTPUT=`$JAVA -Xmx512M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xmx512M"
     JVM_ARG_OK=true
@@ -65220,8 +65220,8 @@
   $ECHO "Check if jvm arg is ok: -XX:TieredStopAtLevel=1" >&5
   $ECHO "Command: $JAVA -XX:TieredStopAtLevel=1 -version" >&5
   OUTPUT=`$JAVA -XX:TieredStopAtLevel=1 -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:TieredStopAtLevel=1"
     JVM_ARG_OK=true
@@ -65270,8 +65270,8 @@
   $ECHO "Check if jvm arg is ok: -d64" >&5
   $ECHO "Command: $SJAVAC_SERVER_JAVA -d64 -version" >&5
   OUTPUT=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64"
     JVM_ARG_OK=true
@@ -65308,8 +65308,8 @@
   $ECHO "Check if jvm arg is ok: -Xms${MS_VALUE}M -Xmx${MX_VALUE}M" >&5
   $ECHO "Command: $SJAVAC_SERVER_JAVA -Xms${MS_VALUE}M -Xmx${MX_VALUE}M -version" >&5
   OUTPUT=`$SJAVAC_SERVER_JAVA -Xms${MS_VALUE}M -Xmx${MX_VALUE}M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
     SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -Xms${MS_VALUE}M -Xmx${MX_VALUE}M"
     JVM_ARG_OK=true
@@ -66140,7 +66140,7 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
       fi
-      rm -f conftest.h conftest.hpp.gch
+      $RM conftest.h conftest.hpp.gch
     fi
   fi
 
--- a/common/autoconf/jdk-options.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/jdk-options.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -224,7 +224,7 @@
   elif test "x$with_copyright_year" != x; then
     COPYRIGHT_YEAR="$with_copyright_year"
   else
-    COPYRIGHT_YEAR=`date +'%Y'`
+    COPYRIGHT_YEAR=`$DATE +'%Y'`
   fi
   AC_SUBST(COPYRIGHT_YEAR)
 ])
--- a/common/autoconf/libraries.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/libraries.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -122,7 +122,7 @@
         fi
       fi
     done
-    llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
+    llvm_version=$("${LLVM_CONFIG}" --version | $SED 's/\.//; s/svn.*//')
     LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
 
     unset LLVM_LDFLAGS
--- a/common/autoconf/toolchain.m4	Thu Jun 09 17:28:36 2016 +0000
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 21:49:19 2017 +0200
@@ -934,7 +934,7 @@
       AC_MSG_RESULT(yes)
       USING_BROKEN_SUSE_LD=yes
     fi
-    rm -rf version-script.map main.c a.out
+    $RM version-script.map main.c a.out
   fi
   AC_SUBST(USING_BROKEN_SUSE_LD)
 
--- a/make/CompileJavaModules.gmk	Thu Jun 09 17:28:36 2016 +0000
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 21:49:19 2017 +0200
@@ -477,6 +477,13 @@
 # be recompiled. If multiple paths are separated by comma, convert that into a
 # space separated list.
 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
+ifeq ($(JDK_FILTER), )
+  FAIL_NO_SRC := true
+else
+  # When using JDK_FILTER, most module java compilations will end up finding
+  # no source files. Don't let that fail the build.
+  FAIL_NO_SRC := false
+endif
 
 # Get the complete module source path.
 MODULESOURCEPATH := $(call GetModuleSrcPath)
@@ -496,7 +503,8 @@
     SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
     MODULE := $(MODULE), \
     SRC := $(wildcard $(MODULE_SRC_DIRS)), \
-    INCLUDES := $(JDK_USER_DEFINED_FILTER),\
+    INCLUDES := $(JDK_USER_DEFINED_FILTER), \
+    FAIL_NO_SRC := $(FAIL_NO_SRC), \
     BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
     HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
     ADD_JAVAC_FLAGS := \
--- a/make/CreateJmods.gmk	Thu Jun 09 17:28:36 2016 +0000
+++ b/make/CreateJmods.gmk	Wed Jul 05 21:49:19 2017 +0200
@@ -82,6 +82,12 @@
   endif
 endif
 
+# Changes to the jmod tool itself should also trigger a rebuild of all jmods
+DEPS += $(JMOD_CMD)
+ifeq ($(EXTERNAL_BUILDJDK), false)
+  DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
+endif
+
 # TODO: What about headers?
 # Create jmods in a temp dir and then move them into place to keep the
 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
--- a/make/Images.gmk	Thu Jun 09 17:28:36 2016 +0000
+++ b/make/Images.gmk	Wed Jul 05 21:49:19 2017 +0200
@@ -115,16 +115,16 @@
 # Use this file inside the image as target for make rule
 JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
 
-JLINK_ORDER_RESOURCES := *module-info.class*
+JLINK_ORDER_RESOURCES := **module-info.class
 ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
   JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/classlist/classlist
 endif
 JLINK_ORDER_RESOURCES += \
-    /java.base/java/* \
-    /java.base/jdk/* \
-    /java.base/sun/* \
-    /java.base/com/* \
-    /jdk.localedata/* \
+    /java.base/java/** \
+    /java.base/jdk/** \
+    /java.base/sun/** \
+    /java.base/com/** \
+    /jdk.localedata/** \
     #
 
 JLINK_TOOL := $(JLINK) --modulepath $(IMAGES_OUTPUTDIR)/jmods \
--- a/make/Main.gmk	Thu Jun 09 17:28:36 2016 +0000
+++ b/make/Main.gmk	Wed Jul 05 21:49:19 2017 +0200
@@ -65,20 +65,24 @@
 ################################################################################
 # Interim/build tools targets, compiling tools used during the build
 
-buildtools-langtools:
+# When creating a BUILDJDK, the buildtools and interim targets have already
+# been built and should not be built again.
+ifneq ($(CREATING_BUILDJDK), true)
+  buildtools-langtools:
 	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
 
-interim-langtools:
+  interim-langtools:
 	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
 
-interim-rmic:
+  interim-rmic:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
 
-interim-cldrconverter:
+  interim-cldrconverter:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
 
-buildtools-jdk:
+  buildtools-jdk:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
+endif
 
 ALL_TARGETS += buildtools-langtools interim-langtools \
     interim-rmic interim-cldrconverter buildtools-jdk
@@ -99,35 +103,40 @@
 
 ################################################################################
 # Gensrc targets, generating source before java compilation can be done
-$(eval $(call DeclareRecipesForPhase, GENSRC, \
-    TARGET_SUFFIX := gensrc, \
-    FILE_PREFIX := Gensrc, \
-    MAKE_SUBDIR := gensrc, \
-    CHECK_MODULES := $(ALL_MODULES), \
-    MULTIPLE_MAKEFILES := true))
+#
+# When creating a BUILDJDK, the java targets have already been built and copied
+# into the buildjdk so no need to generate sources.
+ifneq ($(CREATING_BUILDJDK), true)
+  $(eval $(call DeclareRecipesForPhase, GENSRC, \
+      TARGET_SUFFIX := gensrc, \
+      FILE_PREFIX := Gensrc, \
+      MAKE_SUBDIR := gensrc, \
+      CHECK_MODULES := $(ALL_MODULES), \
+      MULTIPLE_MAKEFILES := true))
 
-JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
-LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
-CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
-HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
+  JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
+  LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
+  CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
+  HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
 
-GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
-GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
-    $(GENSRC_MODULEINFO_MODULES))
+  GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
+  GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
+      $(GENSRC_MODULEINFO_MODULES))
 
-GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
-GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
-    $(addsuffix -gensrc, $(GENSRC_MODULES)))
+  GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
+  GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
+      $(addsuffix -gensrc, $(GENSRC_MODULES)))
 
-define DeclareModuleInfoRecipe
-  $1-gensrc-moduleinfo:
+  define DeclareModuleInfoRecipe
+    $1-gensrc-moduleinfo:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
 	    -f GensrcModuleInfo.gmk MODULE=$1)
 
-  $1-gensrc: $1-gensrc-moduleinfo
-endef
+    $1-gensrc: $1-gensrc-moduleinfo
+  endef
 
-$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+  $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+endif
 
 ALL_TARGETS += $(GENSRC_TARGETS)
 
--- a/make/common/JavaCompilation.gmk	Thu Jun 09 17:28:36 2016 +0000
+++ b/make/common/JavaCompilation.gmk	Wed Jul 05 21:49:19 2017 +0200
@@ -170,6 +170,8 @@
 #   DEPENDS:=Extra dependecy
 #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
 #   KEEP_DUPS:=Do not remove duplicate file names from different source roots.
+#   FAIL_NO_SRC:=Set to false to not fail the build if no source files are found,
+#        default is true.
 SetupJavaCompilation = $(NamedParamsMacroTemplate)
 define SetupJavaCompilationBody
 
@@ -191,7 +193,7 @@
   $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
   $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
   $1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC)
- 
+
   ifneq ($$($1_MODULE), )
     $1_MODULE_SUBDIR := /$$($1_MODULE)
   endif
@@ -246,146 +248,148 @@
   endif
 
   ifeq ($$(strip $$($1_SRCS)), )
-    $$(error No source files found for $1)
-  endif
+    ifneq ($$($1_FAIL_NO_SRC), false)
+      $$(error No source files found for $1)
+    endif
+  else
 
-  $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
+    $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
 
-  # All files below META-INF are always copied.
-  $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
-  # Find all files to be copied from source to bin.
-  ifneq (,$$($1_COPY)$$($1_COPY_FILES))
-    # 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)
-  endif
-  # Copy must also respect filters.
-  ifneq (,$$($1_INCLUDE_PATTERN))
-    $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
-  endif
-  ifneq (,$$($1_EXCLUDE_PATTERN))
-    $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
-  endif
-  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
-
-  # Find all property files to be copied and cleaned from source to bin.
-  ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
-    # Search for all files to be copied.
-    $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
-    # Clean these explicitly
-    $1_ALL_CLEANS += $$($1_CLEAN_FILES)
-    # Copy and clean must also respect filters.
+    # All files below META-INF are always copied.
+    $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
+    # Find all files to be copied from source to bin.
+    ifneq (,$$($1_COPY)$$($1_COPY_FILES))
+      # 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)
+    endif
+    # Copy must also respect filters.
     ifneq (,$$($1_INCLUDE_PATTERN))
-      $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
+      $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
     endif
     ifneq (,$$($1_EXCLUDE_PATTERN))
-      $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
+      $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
     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_clean,$1,$$i)))
-      # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+    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
 
-  # 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'
+    # Find all property files to be copied and cleaned from source to bin.
+    ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
+      # Search for all files to be copied.
+      $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
+      # Clean these explicitly
+      $1_ALL_CLEANS += $$($1_CLEAN_FILES)
+      # Copy and clean must also respect filters.
+      ifneq (,$$($1_INCLUDE_PATTERN))
+        $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
+      endif
+      ifneq (,$$($1_EXCLUDE_PATTERN))
+        $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_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_clean,$1,$$i)))
+        # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+      endif
+    endif
 
-  # Create SJAVAC variable from 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))))
+    # 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'
 
-  $1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
+    # Create SJAVAC variable from 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))
 
-  ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
-    # Using sjavac to compile.
+    # 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_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
+
+    ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
+      # Using sjavac to compile.
 
-    # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
-    # match the absolute path, only the part inside each src dir. Instead -i and
-    # -x flags apply only to the next -src arg on the command line.
-    $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
-    $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
-    $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
-        $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
-        $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
-        $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
-        $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
-        $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
-        -src $$(s))
+      # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
+      # match the absolute path, only the part inside each src dir. Instead -i and
+      # -x flags apply only to the next -src arg on the command line.
+      $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
+      $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
+      $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
+          $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
+          $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
+          $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
+          $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
+          $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
+          -src $$(s))
 
-    ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
-      $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
-      $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
-    else
-      $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
-    endif
+      ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
+        $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
+        $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
+      else
+        $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
+      endif
 
 
-    ifneq (,$$($1_HEADERS))
-      $1_HEADERS_ARG := -h $$($1_HEADERS)
-    endif
+      ifneq (,$$($1_HEADERS))
+        $1_HEADERS_ARG := -h $$($1_HEADERS)
+      endif
 
-    $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
-        $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
-        $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
-    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
-        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
+      $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
+          $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
+          $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
+      $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+          $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
 
-    $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
-	$$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
-	$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
-        ifneq ($$($1_SJAVAC_ARGS_FILE), )
-	  $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
-        endif
-	$$(call LogWarn, Compiling $1)
-	$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
-	    $$($1_JVM) $$($1_SJAVAC) \
-	        $$($1_REMOTE) \
-	        -j 1 \
-	        --permit-unidentified-artifacts \
-	        --permit-sources-without-package \
-	        --compare-found-sources $$@.tmp \
-	        --log=$(LOG_LEVEL) \
-	        --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
-	        $$($1_SJAVAC_ARGS) \
-	        $$($1_FLAGS) \
-	        $$($1_HEADERS_ARG) \
-	        -d $$($1_BIN)) && \
-	$(MV) $$@.tmp $$@
-        # Create a pubapi file that only changes when the pubapi changes. Dependent
-        # compilations can use this file to only get recompiled when pubapi has changed.
-        # Grep returns 1 if no matching lines are found. Do not fail for this.
-	$(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state > $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
-	    || test "$$$$?" = "1"
-	if [ ! -f $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi ] \
-	    || [ "`$(DIFF) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi \
-	        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp`" != "" ]; then \
-	  $(MV) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
-	      $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi; \
-	fi
+      $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
+		$$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
+		$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+                ifneq ($$($1_SJAVAC_ARGS_FILE), )
+		  $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
+                endif
+		$$(call LogWarn, Compiling $1)
+		$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
+		    $$($1_JVM) $$($1_SJAVAC) \
+		        $$($1_REMOTE) \
+		        -j 1 \
+		        --permit-unidentified-artifacts \
+		        --permit-sources-without-package \
+		        --compare-found-sources $$@.tmp \
+		        --log=$(LOG_LEVEL) \
+		        --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
+		        $$($1_SJAVAC_ARGS) \
+		        $$($1_FLAGS) \
+		        $$($1_HEADERS_ARG) \
+		        -d $$($1_BIN)) && \
+		$(MV) $$@.tmp $$@
+                # Create a pubapi file that only changes when the pubapi changes. Dependent
+                # compilations can use this file to only get recompiled when pubapi has changed.
+                # Grep returns 1 if no matching lines are found. Do not fail for this.
+		$(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state > $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
+		    || test "$$$$?" = "1"
+		if [ ! -f $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi ] \
+		    || [ "`$(DIFF) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi \
+		        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp`" != "" ]; then \
+		  $(MV) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
+		      $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi; \
+		fi
 
-  else
-    # Using plain javac to batch compile everything.
+    else
+      # Using plain javac to batch compile everything.
 
-    # 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).$1.tmp
+      # 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).$1.tmp
 
-      $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
+        $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
 		$(MKDIR) -p $$(@D)
 		if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
 		  for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
@@ -399,78 +403,79 @@
 		$(RM) -r $$($1_HEADERS).$1.tmp
 		$(TOUCH) $$@
 
-      $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
-    endif
+        $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
+      endif
+
+      $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
+          $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
+          $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
+      $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+          $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
 
-    $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
-        $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
-        $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
-    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
-        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
+      ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
+        $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
+      else
+        $1_JAVAC_CMD := $$($1_JAVAC)
+      endif
 
-    ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
-      $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
-    else
-      $1_JAVAC_CMD := $$($1_JAVAC)
+      # When not using sjavac, pass along all sources to javac using an @file.
+      $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
+		$$(call MakeDir, $$(@D))
+		$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+		$$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
+		$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
+		    $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
+		        -implicit:none \
+			-d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
+		$(MV) $$@.tmp $$@
     endif
 
-    # When not using sjavac, pass along all sources to javac using an @file.
-    $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
-	$$(call MakeDir, $$(@D))
-	$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
-	$$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
-	$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
-	    $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
-	        -implicit:none \
-		-d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
-	$(MV) $$@.tmp $$@
-  endif
+    # Add all targets to main variable
+    $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
+        $$($1_HEADER_TARGETS)
+
+    # 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
 
-  # Add all targets to main variable
-  $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
-      $$($1_HEADER_TARGETS)
+      $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
+          DEPENDENCIES:=$$($1), \
+          SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
+          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), \
+      ))
 
-  # 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)
+      # Add jar to target list
+      $1 += $$($1_JAR)
     endif
 
-    $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
-        DEPENDENCIES:=$$($1), \
-        SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
-        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), \
-    ))
+    # Check if a srczip was specified, then setup the rules for the srczip.
+    ifneq (,$$($1_SRCZIP))
+      $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \
+          SRC:=$$($1_SRC), \
+          ZIP:=$$($1_SRCZIP), \
+          INCLUDES:=$$($1_INCLUDES), \
+          EXCLUDES:=$$($1_EXCLUDES), \
+          EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
 
-    # Add jar to target list
-    $1 += $$($1_JAR)
-  endif
-
-  # Check if a srczip was specified, then setup the rules for the srczip.
-  ifneq (,$$($1_SRCZIP))
-    $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \
-        SRC:=$$($1_SRC), \
-        ZIP:=$$($1_SRCZIP), \
-        INCLUDES:=$$($1_INCLUDES), \
-        EXCLUDES:=$$($1_EXCLUDES), \
-        EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
-
-    # Add zip to target list
-    $1 += $$($1_SRCZIP)
-  endif
+      # Add zip to target list
+      $1 += $$($1_SRCZIP)
+    endif
+  endif # Source files found
 endef
 
 # Use this macro to find the correct target to depend on when the original