anchor.diff:  :#   2017-03-01 JFL Added variable IGNORE_NMAKEFILE for dealing with unwanted *
   :#                  NMakefile homonyms.                                       *
   :#   2017-03-05 JFL Added variable LOGDIR to control where to store the log.  *
  +:#   2017-03-10 JFL Added support for Visual Studio 2017.		      *
  +:#   2017-03-12 JFL Defining variable OS limits builds to that OS list.       *
   :#                                                                            *
   :#       Copyright 2016-2017 Hewlett Packard Enterprise Development LP       *
   :# Licensed under the Apache 2.0 license  www.apache.org/licenses/LICENSE-2.0 *
   :#*****************************************************************************
   
   setlocal EnableExtensions EnableDelayedExpansion
  -set "VERSION=2017-03-05"
  +set "VERSION=2017-03-12"
   set "SCRIPT=%~nx0"				&:# Script name
   set "SPATH=%~dp0" & set "SPATH=!SPATH:~0,-1!"	&:# Script path, without the trailing \
   set  "ARG0=%~f0"				&:# Script full pathname
  
positive.code: set "COMMENT[OUTDIR]=Output base directory"
  set "COMMENT[LOGDIR]=Log file directory"
  set "COMMENT[IGNORE_NMAKEFILE]=Do not use the NMakefile here"
  for %%v in (OUTDIR LOGDIR IGNORE_NMAKEFILE) do (
    if defined %%v (
      %CONFIG%.
      %CONFIG% SET "%%v=!%%v!" ^&:# !COMMENT[%%v]!
  
negative.code: :#-----------------------------------------------------------------------------
  :# Find Microsoft Visual Studio
  
  :# Sample paths that we want to recognize:
  C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\x86_amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\bin\x86_arm\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\bin\x86_mips\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\bin\x86_sh\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\bin\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\bin\x86_arm\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_arm\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\arm\
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_arm\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24930\bin\HostX64\x64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24930\bin\HostX64\x86\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24930\bin\HostX86\x64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24930\bin\HostX86\x86\cl.exe
  
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.24728\bin\HostX64\x64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.24728\bin\HostX64\x86\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.24728\bin\HostX86\x64\cl.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.24728\bin\HostX86\x86\cl.exe
  
  :findvs.init
  :# Database of binary directories to search, based on VS era, P %ARCH%, Target %OS%
  :# VS 6 to 14 era:
  set "BIN[x86,x86]=bin"
  set "BIN[x86,amd64]=bin\x86_amd64"
  set "BIN[x86,arm]=bin\x86_arm"
  set "BIN[x86,mips]=bin\x86_mips"
  set "BIN[x86,sh]=bin\x86_sh"
  set "BIN[x86,ia64]=bin\x86_ia64"
  
  set "BIN[amd64,x86]=bin\amd64_x86 bin"
  set "BIN[amd64,amd64]=bin\amd64 bin\x86_amd64"
  set "BIN[amd64,arm]=bin\amd64_arm bin\x86_arm"
  
  :# VS 15 era: More regular naming system, but much deeper
  set "BIN15[x86,x86]=bin\HostX86\x86"
  set "BIN15[x86,amd64]=bin\HostX86\x64"
  set "BIN15[amd64,x86]=bin\HostX64\x86"
  set "BIN15[amd64,amd64]=bin\HostX64\x64"
  
  :# Idem for native builds (There must be just one value here)
  set "BIN[x86]=bin"
  set "BIN[amd64]=bin\amd64"
  set "BIN15[x86]=bin\HostX86\x86"
  set "BIN15[amd64]=bin\HostX64\x64"
  
  :# Convert SysToolsLib's OS name to MSVC processor name
  set "PROC[WIN32]=x86"	&:# SysToolsLib name
  set "PROC[x86]=x86"	&:# VC 6+ name
  set "PROC[WIN64]=amd64"	&:# SysToolsLib name
  set "PROC[amd64]=amd64"	&:# VC 6 to 14 name
  set "PROC[x64]=amd64"	&:# VC 15+ name
  set "PROC[ARM]=arm"	&:# SysToolsLib and VC 8+ name
  set "PROC[SH]=sh"	&:# SysToolsLib and VC 8 name
  set "PROC[MIPS]=mips"	&:# SysToolsLib and VC 8 name
  set "PROC[IA64]=ia64"	&:# SysToolsLib and VC 8 name
  
  set "VC15S=Enterprise\VC Professional\VC Community\VC"
  exit /b
  
  :# Find the latest Visual Studio version supporting the specified OS & architecture
  :findvs %1=OS %2=Proc (x86|x64|amd|...) %3=VSVARNAME %4=VCVARNAME
  %FUNCTION0%
  set "VS=%~3"
  set "VC=%~4"
  call :findvs.init
  set "SEARCH_IN=call :FindVsIn !PROC[%~1]!"
  :# If specified on the command line, and looking reasonably valid, then use it.
  if defined VSTUDIO call :FindVsIn %2 "%VSTUDIO%" "%VC15S%" BIN15 && goto :foundvs
  if defined VSTUDIO call :FindVsIn %2 "%VSTUDIO%" "VC VC7 VC98" BIN && goto :foundvs
  :# If VS' vcvars*.bat has already been run manually, then use it.
  if defined VSINSTALLDIR call :FindVsIn %2 "%VSINSTALLDIR%" "%VC15S%" BIN15 && goto :foundvs
  if defined VSINSTALLDIR call :FindVsIn %2 "%VSINSTALLDIR%" "VC VC7 VC98" BIN && goto :foundvs
  :# Else scan all Visual Studio versions, starting from the newest ones.
  goto :lastvs &:# Scan all Visual Studio versions
  
  