8071329: Stop exporting INCLUDE and LIB when building on windows
authorerikj
Fri, 06 Feb 2015 09:56:30 +0100
changeset 28809 6481e27e00ee
parent 28806 1550b2f6b63d
child 28810 86666ec06518
8071329: Stop exporting INCLUDE and LIB when building on windows Reviewed-by: ihse
common/autoconf/basics.m4
common/autoconf/generated-configure.sh
common/autoconf/hotspot-spec.gmk.in
common/autoconf/spec.gmk.in
common/autoconf/toolchain_windows.m4
make/Main.gmk
make/common/NativeCompilation.gmk
--- a/common/autoconf/basics.m4	Wed Jul 05 20:18:43 2017 +0200
+++ b/common/autoconf/basics.m4	Fri Feb 06 09:56:30 2015 +0100
@@ -242,6 +242,9 @@
 [
   # Save the original command line. This is passed to us by the wrapper configure script.
   AC_SUBST(CONFIGURE_COMMAND_LINE)
+  # Save the path variable before it gets changed
+  ORIGINAL_PATH="$PATH"
+  AC_SUBST(ORIGINAL_PATH)
   DATE_WHEN_CONFIGURED=`LANG=C date`
   AC_SUBST(DATE_WHEN_CONFIGURED)
   AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
--- a/common/autoconf/generated-configure.sh	Wed Jul 05 20:18:43 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Fri Feb 06 09:56:30 2015 +0100
@@ -991,6 +991,7 @@
 BASH
 BASENAME
 DATE_WHEN_CONFIGURED
+ORIGINAL_PATH
 CONFIGURE_COMMAND_LINE
 target_alias
 host_alias
@@ -4333,7 +4334,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1421247827
+DATE_WHEN_GENERATED=1423212925
 
 ###############################################################################
 #
@@ -4366,6 +4367,9 @@
 
   # Save the original command line. This is passed to us by the wrapper configure script.
 
+  # Save the path variable before it gets changed
+  ORIGINAL_PATH="$PATH"
+
   DATE_WHEN_CONFIGURED=`LANG=C date`
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: Configuration created at $DATE_WHEN_CONFIGURED." >&5
@@ -27438,8 +27442,8 @@
     # The trailing space for everyone except PATH is no typo, but is needed due
     # to trailing \ in the Windows paths. These will be stripped later.
     $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
-    $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
-    $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
+    $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
+    $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
     $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
     $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
     $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
@@ -27486,9 +27490,9 @@
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      # Remove any trailing "\" and " " from the variables.
-      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
-      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
+      # Remove any trailing "\" ";" and " " from the variables.
+      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
+      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
       WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
@@ -27499,6 +27503,268 @@
 
 
 
+
+      # Convert VS_INCLUDE into SYSROOT_CFLAGS
+      OLDIFS="$IFS"
+      IFS=";"
+      for i in $VS_INCLUDE; do
+        ipath=$i
+	IFS="$OLDIFS"
+
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$ipath"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of ipath, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of ipath, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of ipath" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-stile (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    ipath="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting ipath to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting ipath to \"$new_path\"" >&6;}
+  fi
+
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$ipath"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    ipath="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting ipath to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting ipath to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+  else
+    # We're on a unix platform. Hooray! :)
+    path="$ipath"
+    has_space=`$ECHO "$path" | $GREP " "`
+    if test "x$has_space" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of ipath, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of ipath, which resolves as \"$path\", is invalid." >&6;}
+      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+    fi
+
+    # Use eval to expand a potential ~
+    eval path="$path"
+    if test ! -f "$path" && test ! -d "$path"; then
+      as_fn_error $? "The path of ipath, which resolves as \"$path\", is not found." "$LINENO" 5
+    fi
+
+    ipath="`cd "$path"; $THEPWDCMD -L`"
+  fi
+
+	IFS=";"
+      	SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
+      done
+      # Convert VS_LIB into SYSROOT_LDFLAGS
+      for i in $VS_LIB; do
+        libpath=$i
+	IFS="$OLDIFS"
+
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$libpath"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of libpath, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of libpath, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of libpath" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-stile (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    libpath="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting libpath to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting libpath to \"$new_path\"" >&6;}
+  fi
+
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$libpath"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    libpath="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting libpath to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting libpath to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+  else
+    # We're on a unix platform. Hooray! :)
+    path="$libpath"
+    has_space=`$ECHO "$path" | $GREP " "`
+    if test "x$has_space" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of libpath, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of libpath, which resolves as \"$path\", is invalid." >&6;}
+      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+    fi
+
+    # Use eval to expand a potential ~
+    eval path="$path"
+    if test ! -f "$path" && test ! -d "$path"; then
+      as_fn_error $? "The path of libpath, which resolves as \"$path\", is not found." "$LINENO" 5
+    fi
+
+    libpath="`cd "$path"; $THEPWDCMD -L`"
+  fi
+
+	IFS=";"
+      	SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
+      done
+      IFS="$OLDIFS"
     fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
--- a/common/autoconf/hotspot-spec.gmk.in	Wed Jul 05 20:18:43 2017 +0200
+++ b/common/autoconf/hotspot-spec.gmk.in	Fri Feb 06 09:56:30 2015 +0100
@@ -132,6 +132,13 @@
   ZIP_DEBUGINFO_FILES:=0
 endif
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  # On Windows, the Visual Studio toolchain needs the LIB and INCLUDE
+  # environment variables (in Windows path style).
+  export INCLUDE:=@VS_INCLUDE@
+  export LIB:=@VS_LIB@
+endif
+
 # Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files.
 # This is needed to get the LOG setting to work properly.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
--- a/common/autoconf/spec.gmk.in	Wed Jul 05 20:18:43 2017 +0200
+++ b/common/autoconf/spec.gmk.in	Fri Feb 06 09:56:30 2015 +0100
@@ -129,14 +129,12 @@
 # colon or semicolon
 PATH_SEP:=@PATH_SEP@
 
+# Save the original path before replacing it with the Visual Studio tools
+ORIGINAL_PATH:=@ORIGINAL_PATH@
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  # On Windows, the Visual Studio toolchain needs the LIB and INCLUDE
-  # environment variables (in Windows path style), and the PATH needs to
-  # be adjusted to include Visual Studio tools (but this needs to be in
-  # cygwin/msys style).
+  # On Windows, the Visual Studio toolchain needs the PATH to be adjusted
+  # to include Visual Studio tools (this needs to be in cygwin/msys style).
   export PATH:=@VS_PATH@
-  export INCLUDE:=@VS_INCLUDE@
-  export LIB:=@VS_LIB@
 endif
 
 SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
--- a/common/autoconf/toolchain_windows.m4	Wed Jul 05 20:18:43 2017 +0200
+++ b/common/autoconf/toolchain_windows.m4	Fri Feb 06 09:56:30 2015 +0100
@@ -213,9 +213,9 @@
       AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
     else
       AC_MSG_RESULT([ok])
-      # Remove any trailing "\" and " " from the variables.
-      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
-      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
+      # Remove any trailing "\" ";" and " " from the variables.
+      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
+      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
       WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
@@ -226,6 +226,26 @@
       AC_SUBST(VS_PATH)
       AC_SUBST(VS_INCLUDE)
       AC_SUBST(VS_LIB)
+
+      # Convert VS_INCLUDE into SYSROOT_CFLAGS
+      OLDIFS="$IFS"
+      IFS=";"
+      for i in $VS_INCLUDE; do
+        ipath=$i
+	IFS="$OLDIFS"
+        BASIC_FIXUP_PATH([ipath])
+	IFS=";"
+      	SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
+      done
+      # Convert VS_LIB into SYSROOT_LDFLAGS
+      for i in $VS_LIB; do
+        libpath=$i
+	IFS="$OLDIFS"
+        BASIC_FIXUP_PATH([libpath])
+	IFS=";"
+      	SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
+      done
+      IFS="$OLDIFS"
     fi
   else
     AC_MSG_RESULT([not found])
--- a/make/Main.gmk	Wed Jul 05 20:18:43 2017 +0200
+++ b/make/Main.gmk	Fri Feb 06 09:56:30 2015 +0100
@@ -553,7 +553,8 @@
         else
 	  @$(ECHO) "Re-running configure using default settings"
         endif
-	@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
+	@( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 
 ALL_TARGETS += reconfigure
 
--- a/make/common/NativeCompilation.gmk	Wed Jul 05 20:18:43 2017 +0200
+++ b/make/common/NativeCompilation.gmk	Fri Feb 06 09:56:30 2015 +0100
@@ -469,9 +469,10 @@
 
       $$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
 		$(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))"
-		$(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
+		$(RC) $$($1_RC_FLAGS) $(SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
+		    $$($1_VERSIONINFO_RESOURCE)
                 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
-		$(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \
+		$(CC) $$($1_RC_FLAGS) $(SYSROOT_CFLAGS) -showIncludes -nologo -TC \
 		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0
 		($(ECHO) $$($1_RES): \\ \
 		&& $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP)