@echo off
::  Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
::
::  This file is part of Orfeo Toolbox
::
::      https://www.orfeo-toolbox.org/
::
::  Licensed under the Apache License, Version 2.0 (the "License");
::  you may not use this file except in compliance with the License.
::  You may obtain a copy of the License at
::
::      http://www.apache.org/licenses/LICENSE-2.0
::
::  Unless required by applicable law or agreed to in writing, software
::  distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

rem set EXIT_ON_ERROR=0
rem set TEST_VERBOSE=1
rem cmd /k tools\selftester.bat /q > selftest_report.log 2>&1

set MY_TOOLS_DIR=%~dp0
cd %MY_TOOLS_DIR%..
set MY_INSTALL_DIR=%cd%
echo "MY_INSTALL_DIR=%MY_INSTALL_DIR%"

:: this is set in wrapper script
::set EXIT_ON_ERROR=0
IF %EXIT_ON_ERROR%.==. ( set EXIT_ON_ERROR=1)
IF %TEST_VERBOSE%.==. ( set TEST_VERBOSE=1)

echo TEST_VERBOSE=%TEST_VERBOSE%
echo EXIT_ON_ERROR=%EXIT_ON_ERROR%

:: if "/q" is given, hide the error dialogs (hence make the script non-interactive)
if /i not -%1-==-/q- (
  goto :skip_hide_error
)

call :getDontShowUI
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 1
:skip_hide_error
echo Hide error dialogs
:: Get current PID
type NUL > pid.log
wmic PROCESS where "Name='WMIC.exe'" get ParentProcessId >pid.log 2>&1
for /F "TOKENS=1" %%b in ('type pid.log ^| findstr [0-9]') do set CURRENT_PID=%%b

:: setup the otbenv
call otbenv.bat

:: -----------------------------------------------------------------------------------
REM Check 1 : check binaries
for /R %%i in (*.dll) do (
  call :check_binary %%i
)
for %%i in (bin\mapla.exe,bin\monteverdi.exe,bin\otbApplicationLauncherCommandLine.exe,bin\otbApplicationLauncherQt.exe) do (
  call :check_binary %%i
)
call :check_binary lib\python\_otbApplication.pyd

:: -----------------------------------------------------------------------------------
rem Check 2 : check applications and Python wrapping
set /a app_count=0
for /R %%i in (lib\otb\applications\otbapp_*.dll) do (
  call :check_application %%i
)
if %app_count% leq 90 (
  echo WARNING: only %app_count% applications found ! Expected at least 90
)
call :check_python_wrapping

:: -----------------------------------------------------------------------------------
rem Check 3 : check monteverdi & mapla
call :check_desktop_app monteverdi
call :check_desktop_app mapla 20

if /i not -%1-==-/q- (
  goto :skip_restore_error
)
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 0
:skip_restore_error
setlocal
del pid.log
del tmp.log
endlocal
goto :eof

::########################[ FUNCTIONS ]##################################
:check_binary
setlocal
if %TEST_VERBOSE% gtr 1 ( echo ":check_binary %1" )
type NUL > tmp.log
tools\otb_loader.exe %1 > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo "ERROR: otb_loader.exe %1"
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_application
setlocal
set dll_path=%~n1
set app=%dll_path:~7%
if %TEST_VERBOSE% equ 1 ( echo ":check_application %app%" )
if not exist bin\otbcli_%app%.bat (
  echo ERROR : missing cli launcher for application %app%
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  goto :check_gui
)
type NUL > tmp.log
cmd /C bin\otbcli_%app%.bat "-help" ^> tmp.log ^2^>^&^1
call :parse_cli_output
if %parse_cli_result% equ 0 (
  echo ERROR : error launching application otbcli_%app%
  type results.txt
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  )

:check_gui
if not exist bin\otbgui_%app%.bat (
  echo ERROR : missing gui launcher for application %app%
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  goto :check_application_end
)
if %app_count% geq 2 goto :check_application_end
type NUL > tmp.log
start "otbgui application" /b bin\otbgui_%app%.bat ^> tmp.log ^2^>^&^1
timeout 5 >nul
call :get_child_pid %CURRENT_PID% cmd.exe
set first_child=0
if %child_pid% gtr 1 (
  set first_child=%child_pid%
) else (
  echo ERROR : could not launch otbgui_%app%
  type tmp.log
  goto :check_application_clean
)
call :get_child_pid %first_child% otbApplicationLauncherQt.exe
if not %child_pid% gtr 1 (
  echo ERROR : could not launch otbApplicationLauncherQt %app%
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)

:check_application_clean
if not %first_child% == 0 (
  taskkill /PID %first_child% /F /T > NUL 2>&1
)

:check_application_end
endlocal & set /a app_count=app_count+1
goto :eof
::-----------------------------------------------------------------------
:check_desktop_app
setlocal
set appName=%1
set delay=5
if not -%2-==-- set delay=%2
type NUL > tmp.log
start "Desktop app" /b bin\%appName%.exe > tmp.log 2>&1
timeout %delay% >nul
call :get_child_pid %CURRENT_PID% %appName%.exe
if %child_pid% gtr 1 (
  taskkill /PID %child_pid% /F /T > NUL 2>&1
) else (
  echo ERROR : could not launch %appName%.exe
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_python_wrapping
setlocal
type NUL > tmp.log
python3 -c "import otbApplication" > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : failed to run python wrapping
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:parse_cli_output
setlocal
set /a ret=1
findstr /n /r /c:"^This is the %app% application, version " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
  echo "findstr failed 1st regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"^Parameters: " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
  echo "findstr failed 2nd regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"^Examples: " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
    echo "findstr failed 3rd regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"FATAL" tmp.log  > results.txt
if %errorlevel%==0 (
  set /a ret=0
    echo "findstr passed 4th regex in parse_cli_output"
  goto :parse_cli_output_end
)

:parse_cli_output_end
endlocal & set /a parse_cli_result=%ret%
goto :eof
::-----------------------------------------------------------------------

:nb_tmp_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< tmp.log') do set output=%%i
endlocal & set nb_tmp_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:get_child_pid
setlocal
set parent_pid=%1
set process_name=%2
set output=0
type NUL > pid.log
wmic PROCESS where (ParentProcessId=%parent_pid% AND Name="%process_name%") get ProcessId >pid.log 2>&1
for /F "TOKENS=1" %%a in ('type pid.log ^| findstr [0-9]') do set output=%%a
endlocal & set child_pid=%output%
goto :eof
::-----------------------------------------------------------------------
:getDontShowUI
setlocal
set output=0
for /F "TOKENS=3" %%a in ('reg query "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI ^| findstr DontShowUI') do set output=%%a
endlocal & set DONTSHOWUI_VALUE=%output:~2%
goto :eof
::-----------------------------------------------------------------------
:setDontShowUI
setlocal
reg add "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d %1 /f
endlocal
goto :eof

@echo off
::  Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
::
::  This file is part of Orfeo Toolbox
::
::      https://www.orfeo-toolbox.org/
::
::  Licensed under the Apache License, Version 2.0 (the "License");
::  you may not use this file except in compliance with the License.
::  You may obtain a copy of the License at
::
::      http://www.apache.org/licenses/LICENSE-2.0
::
::  Unless required by applicable law or agreed to in writing, software
::  distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

rem set EXIT_ON_ERROR=0
rem set TEST_VERBOSE=1
rem cmd /k tools\selftester.bat /q > selftest_report.log 2>&1

set MY_TOOLS_DIR=%~dp0
cd %MY_TOOLS_DIR%..
set MY_INSTALL_DIR=%cd%
echo "MY_INSTALL_DIR=%MY_INSTALL_DIR%"

:: this is set in wrapper script
::set EXIT_ON_ERROR=0
IF %EXIT_ON_ERROR%.==. ( set EXIT_ON_ERROR=1)
IF %TEST_VERBOSE%.==. ( set TEST_VERBOSE=1)

echo TEST_VERBOSE=%TEST_VERBOSE%
echo EXIT_ON_ERROR=%EXIT_ON_ERROR%

:: if "/q" is given, hide the error dialogs (hence make the script non-interactive)
if /i not -%1-==-/q- (
  goto :skip_hide_error
)

call :getDontShowUI
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 1
:skip_hide_error
echo Hide error dialogs
:: Get current PID
type NUL > pid.log
wmic PROCESS where "Name='WMIC.exe'" get ParentProcessId >pid.log 2>&1
for /F "TOKENS=1" %%b in ('type pid.log ^| findstr [0-9]') do set CURRENT_PID=%%b

:: setup the otbenv
call otbenv.bat

:: -----------------------------------------------------------------------------------
REM Check 1 : check binaries
for /R %%i in (*.dll) do (
  call :check_binary %%i
)
for %%i in (bin\mapla.exe,bin\monteverdi.exe,bin\otbApplicationLauncherCommandLine.exe,bin\otbApplicationLauncherQt.exe) do (
  call :check_binary %%i
)
call :check_binary lib\python\_otbApplication.pyd

:: -----------------------------------------------------------------------------------
rem Check 2 : check applications and Python wrapping
set /a app_count=0
for /R %%i in (lib\otb\applications\otbapp_*.dll) do (
  call :check_application %%i
)
if %app_count% leq 90 (
  echo WARNING: only %app_count% applications found ! Expected at least 90
)
call :check_python_wrapping

:: -----------------------------------------------------------------------------------
rem Check 3 : check monteverdi & mapla
call :check_desktop_app monteverdi
call :check_desktop_app mapla 20

if /i not -%1-==-/q- (
  goto :skip_restore_error
)
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 0
:skip_restore_error
setlocal
del pid.log
del tmp.log
endlocal
goto :eof

::########################[ FUNCTIONS ]##################################
:check_binary
setlocal
if %TEST_VERBOSE% gtr 1 ( echo ":check_binary %1" )
type NUL > tmp.log
tools\otb_loader.exe %1 > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo "ERROR: otb_loader.exe %1"
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_application
setlocal
set dll_path=%~n1
set app=%dll_path:~7%
if %TEST_VERBOSE% equ 1 ( echo ":check_application %app%" )
if not exist bin\otbcli_%app%.bat (
  echo ERROR : missing cli launcher for application %app%
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  goto :check_gui
)
type NUL > tmp.log
cmd /C bin\otbcli_%app%.bat "-help" ^> tmp.log ^2^>^&^1
call :parse_cli_output
if %parse_cli_result% equ 0 (
  echo ERROR : error launching application otbcli_%app%
  type results.txt
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  )

:check_gui
if not exist bin\otbgui_%app%.bat (
  echo ERROR : missing gui launcher for application %app%
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
  goto :check_application_end
)
if %app_count% geq 2 goto :check_application_end
type NUL > tmp.log
start "otbgui application" /b bin\otbgui_%app%.bat ^> tmp.log ^2^>^&^1
timeout 5 >nul
call :get_child_pid %CURRENT_PID% cmd.exe
set first_child=0
if %child_pid% gtr 1 (
  set first_child=%child_pid%
) else (
  echo ERROR : could not launch otbgui_%app%
  type tmp.log
  goto :check_application_clean
)
call :get_child_pid %first_child% otbApplicationLauncherQt.exe
if not %child_pid% gtr 1 (
  echo ERROR : could not launch otbApplicationLauncherQt %app%
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)

:check_application_clean
if not %first_child% == 0 (
  taskkill /PID %first_child% /F /T > NUL 2>&1
)

:check_application_end
endlocal & set /a app_count=app_count+1
goto :eof
::-----------------------------------------------------------------------
:check_desktop_app
setlocal
set appName=%1
set delay=5
if not -%2-==-- set delay=%2
type NUL > tmp.log
start "Desktop app" /b bin\%appName%.exe > tmp.log 2>&1
timeout %delay% >nul
call :get_child_pid %CURRENT_PID% %appName%.exe
if %child_pid% gtr 1 (
  taskkill /PID %child_pid% /F /T > NUL 2>&1
) else (
  echo ERROR : could not launch %appName%.exe
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_python_wrapping
setlocal
type NUL > tmp.log
python -c "import otbApplication" > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : failed to run python wrapping
  type tmp.log
  if %EXIT_ON_ERROR% equ 1 ( exit 1 )
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:parse_cli_output
setlocal
set /a ret=1
findstr /n /r /c:"^This is the %app% application, version " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
  echo "findstr failed 1st regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"^Parameters: " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
  echo "findstr failed 2nd regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"^Examples: " tmp.log  > results.txt
if %errorlevel%==1 (
  set /a ret=0
    echo "findstr failed 3rd regex in parse_cli_output"
  goto :parse_cli_output_end
)
findstr /n /r /c:"FATAL" tmp.log  > results.txt
if %errorlevel%==0 (
  set /a ret=0
    echo "findstr passed 4th regex in parse_cli_output"
  goto :parse_cli_output_end
)

:parse_cli_output_end
endlocal & set /a parse_cli_result=%ret%
goto :eof
::-----------------------------------------------------------------------

:nb_tmp_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< tmp.log') do set output=%%i
endlocal & set nb_tmp_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:get_child_pid
setlocal
set parent_pid=%1
set process_name=%2
set output=0
type NUL > pid.log
wmic PROCESS where (ParentProcessId=%parent_pid% AND Name="%process_name%") get ProcessId >pid.log 2>&1
for /F "TOKENS=1" %%a in ('type pid.log ^| findstr [0-9]') do set output=%%a
endlocal & set child_pid=%output%
goto :eof
::-----------------------------------------------------------------------
:getDontShowUI
setlocal
set output=0
for /F "TOKENS=3" %%a in ('reg query "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI ^| findstr DontShowUI') do set output=%%a
endlocal & set DONTSHOWUI_VALUE=%output:~2%
goto :eof
::-----------------------------------------------------------------------
:setDontShowUI
setlocal
reg add "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d %1 /f
endlocal
goto :eof

use default python

PKG: use default python


@echo off

echo Please select the board for which you want to update firmware:

echo 1 - Official OpenDeck board
echo 2 - Arduino Mega
echo 3 - Arduino Uno
echo 4 - Arduino Leonardo
echo 5 - Arduino Pro Micro
echo 6 - Teensy++ 2.0

set /p board=""

IF "%board%"=="1" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\opendeck.hex
) ELSE IF "%board%"=="2" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega2560 ..\bin\compiled\fw\mega2560.hex
) ELSE IF "%board%"=="3" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega328p ..\bin\compiled\fw\uno.hex
) ELSE IF "%board%"=="4" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\leonardo.hex
) ELSE IF "%board%"=="5" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\promicro.hex
) ELSE IF "%board%"=="6" (
    ..\bin\dfu\hid_bootloader_loader_win.exe at90usb1286 ..\bin\compiled\fw\teensy2pp.hex
) ELSE (
    echo Incorrect board number selected.
)

@echo off

echo Please select the board for which you want to update firmware:

echo 1 - Official OpenDeck board
echo 2 - Arduino Mega
echo 3 - Arduino Uno
echo 4 - Arduino Leonardo
echo 5 - Arduino Pro Micro
echo 6 - Teensy++ 2.0

set /p board=""

IF "%board%"=="1" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\avr\atmega32u4\opendeck.hex
) ELSE IF "%board%"=="2" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega2560 ..\bin\compiled\fw\avr\atmega2560\mega2560.hex
) ELSE IF "%board%"=="3" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega328p ..\bin\compiled\fw\avr\atmega328p\uno.hex
) ELSE IF "%board%"=="4" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\avr\atmega32u4\leonardo.hex
) ELSE IF "%board%"=="5" (
    ..\bin\dfu\hid_bootloader_loader_win.exe atmega32u4 ..\bin\compiled\fw\avr\atmega32u4\promicro.hex
) ELSE IF "%board%"=="6" (
    ..\bin\dfu\hid_bootloader_loader_win.exe at90usb1286 ..\bin\compiled\fw\avr\at90usb1286\teensy2pp.hex
) ELSE (
    echo Incorrect board number selected.
)

fix paths in hid_dfu.bat

fix paths in hid_dfu.bat


REM install_program_manager_test_db.bat

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres  -p 5432 -f create_program_manager_test_db.sql 1> install_program_manager_test_db.log 2>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f install_pgcrypto.sql  1>> install_program_manager_test_db.log 2>>&1

REM install the schema
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\create_system_user_schema.sql  1>> install_program_manager_test_db.log 2>>&1

REM install the objects
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_users.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_users_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_state.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_state_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_allowed_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_allowed_actions_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_add_new_user.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_change_password.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_change_user_allowed_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_user_login.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_user_logout.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_list_users.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\util_get_user_state.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\util_is_user_authorized.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_state_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_allowed_actions_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_user_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\insert_master_user_actions_for_a_service.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\install_master_user.sql 1>> install_program_manager_test_db.log 2>>&1

REM install the programs_manager_schema
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\create_programs_manager_schema.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\insert_system_actions_for_prgrm_mngr.sql  1>> install_program_manager_test_db.log 2>>&1

REM Install the programs_manager_schema objects

REM Install the tables
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organizations.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organizations_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organization_level.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organization_level_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\programs.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\programs_history.sql  1>> install_program_manager_test_db.log 2>>&1

REM Install action functions
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\action_functions\action_enter_edit_organizations.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_organizations_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f ..\action_enter_edit_organization_level.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_organization_level_history.sql 1>> install_program_manager_test_db.log 2>>&1

REM Install the master user
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\run_install_master_user.sql 1>> install_program_manager_test_db.log 2>>&1

REM install_program_manager_test_db.bat

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\program_manager_test_database\create_program_manager_test_db.sql 1> install_program_manager_test_db.log 2>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\program_manager_test_database\install_pgcrypto.sql  1>> install_program_manager_test_db.log 2>>&1

REM install the schema
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\create_system_user_schema.sql  1>> install_program_manager_test_db.log 2>>&1

REM install the objects
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_users.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_users_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_state.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_state_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_allowed_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\table_definitions\system_user_allowed_actions_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_add_new_user.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_change_password.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_change_user_allowed_actions.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_user_login.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_user_logout.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\action_functions\action_list_users.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\util_get_user_state.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\util_is_user_authorized.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_state_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_allowed_actions_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\trig_log_user_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\insert_master_user_actions_for_a_service.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\install_master_user.sql 1>> install_program_manager_test_db.log 2>>&1

REM install the programs_manager_schema
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\create_programs_manager_schema.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\insert_system_actions_for_prgrm_mngr.sql  1>> install_program_manager_test_db.log 2>>&1

REM Install the programs_manager_schema objects

REM Install the tables
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organizations.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organizations_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organization_level.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\organization_level_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\programs.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\programs_history.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\system_user_allowed_programs.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\table_definitions\system_user_allowed_programs_history.sql  1>> install_program_manager_test_db.log 2>>&1

REM Install action functions
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\action_functions\action_enter_edit_organizations.sql  1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_organizations_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f ..\action_enter_edit_organization_level.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_organization_level_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f ..\action_enter_edit_programs.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_programs_history.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f ..\action_change_program_user_visibility.sql 1>> install_program_manager_test_db.log 2>>&1

"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\programs_manager\programs_manager_database\utility_functions\trig_log_user_allowed_programs_history.sql 1>> install_program_manager_test_db.log 2>>&1

REM Install the master user
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" -h localhost -U postgres -d program_manager_test_db  -p 5432 -f C:\funda_components\system_user\system_user_database\utility_functions\run_install_master_user.sql 1>> install_program_manager_test_db.log 2>>&1

add absolute paths so all scripts are always run


cd alfont
call fix.bat mingw32
call make
cd ..

cd almp3
call fix.bat mingw32
call make
cd ..

cd fblend
call fix.bat mingw32
call make
cd ..

set attribute to ignore created makefile, add batch file to compile/make all dependencies


echo off
setlocal

%TB-PLATFORM-PROJECTS-DRIVE%
path %TB-PLATFORM-PROJECTS-DRIVE%%TB-PLATFORM-PROJECTS-PATH%\Build\Subscripts;%PATH%

set BIN-PATH=%TB-PLATFORM-PROJECTS-PATH%\Bin

call setMyVersion.bat

set DEP=/DEP:%TB-PLATFORM-PROJECTS-DRIVE%%TB-PLATFORM-PROJECTS-PATH%\Build\ExternalDependencies.txt

echo =================================
echo Making command line utility projects

pushd %TB-PLATFORM-PROJECTS-PATH%\src\CommandLineUtils

call makeExe.bat gbd gbd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gccd gccd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gcd gcd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gtd gtd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gxd gxd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat ltz ltz /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat plord plord /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat uccd uccd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat ucd ucd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat uxd uxd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

popd

@echo off
setlocal

%TB-PLATFORM-PROJECTS-DRIVE%
path %TB-PLATFORM-PROJECTS-DRIVE%%TB-PLATFORM-PROJECTS-PATH%\Build\Subscripts;%PATH%

set BIN-PATH=%TB-PLATFORM-PROJECTS-PATH%\Bin

call setMyVersion.bat

set DEP=/DEP:%TB-PLATFORM-PROJECTS-DRIVE%%TB-PLATFORM-PROJECTS-PATH%\Build\ExternalDependencies.txt

if not "%~1"=="" (
	pushd %TB-PLATFORM-PROJECTS-PATH%\src\CommandLineUtils
	echo =================================
	echo Making command line utility project %~1
	call makeExe.bat %~1 %~1 /CONSOLE /NOV6CC /M:E %DEP%
	popd
	exit /B
)

echo =================================
echo Making command line utility projects

pushd %TB-PLATFORM-PROJECTS-PATH%\src\CommandLineUtils

call makeExe.bat gbd gbd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gccd gccd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gcd gcd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gtd gtd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat gxd gxd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat ltz ltz /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat plord plord /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat uccd uccd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat ucd ucd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

call makeExe.bat uxd uxd /CONSOLE /NOV6CC /M:E %DEP%
if errorlevel 1 pause

popd

Add parameter to makeCommandLineTools.bat to allow a single command line utility to be built


@echo off

set BUILDSYS=%1
if "%BUILDSYS%" == "vc" goto build_makefiles
if "%BUILDSYS%" == "mingw" goto build_makefiles
echo Unrecognized build system %BUILDSYS%.
echo.
goto usage

:build_makefiles
rem Create Makefiles in subdirectories
for %d in ( lib examples ) do call buildmf.bat %BUILDSYS% %d

rem Create top-level Makefile
echo all: > Makefile
echo 	@cmd /c mkbindirs.bat >> Makefile
echo 	cd lib ^&^& $(MAKE) BIN_DIR=debug all example_setup >> Makefile
echo 	cd lib ^&^& $(MAKE) BIN_DIR=release >> Makefile
echo 	cd examples ^&^& $(MAKE) >> Makefile
echo. >> Makefile
echo install: >> Makefile
echo 	@cmd /c install.bat %BUILDSYS% >> Makefile
echo. >> Makefile
echo clean debug release: >> Makefile
echo 	cd lib ^&^& $(MAKE) $@ >> Makefile
echo 	cd examples ^&^& $(MAKE) $@ >> Makefile

echo Created Makefiles successfully.
goto end

rem Display usage message
:usage
echo usage: makemake {vc, mingw}
echo.
echo     You must give one of the compiler parameters:
echo.
echo         vc: Visual C++ command-line compiler (cl)
echo         mingw: MinGW GCC (g++)
goto end

:end

@echo off

set BUILDSYS=%1
if "%BUILDSYS%" == "vc" goto build_makefiles
if "%BUILDSYS%" == "mingw" goto build_makefiles
echo Unrecognized build system %BUILDSYS%.
echo.
goto usage

:build_makefiles
rem Create Makefiles in subdirectories
for %d in ( lib examples ) do call buildmf.bat %BUILDSYS% %d

rem Create top-level Makefile
echo all: > Makefile
echo 	@cmd /c mkbindirs.bat >> Makefile
echo 	cd lib ^&^& $(MAKE) BIN_DIR=debug all example_setup >> Makefile
echo 	cd lib ^&^& $(MAKE) BIN_DIR=release >> Makefile
echo 	cd examples ^&^& $(MAKE) >> Makefile
echo. >> Makefile
echo install: all >> Makefile
echo 	@cmd /c install.bat %BUILDSYS% >> Makefile
echo. >> Makefile
echo clean debug release: >> Makefile
echo 	cd lib ^&^& $(MAKE) $@ >> Makefile
echo 	cd examples ^&^& $(MAKE) $@ >> Makefile

echo Created Makefiles successfully.
goto end

rem Display usage message
:usage
echo usage: makemake {vc, mingw}
echo.
echo     You must give one of the compiler parameters:
echo.
echo         vc: Visual C++ command-line compiler (cl)
echo         mingw: MinGW GCC (g++)
goto end

:end

install target of top-level Makefile generated by makemake now depends
on all target.

git-svn-id: 1a57124bbb9aca193a920d0ffd753d488afb922b@1112 5946f024-35f4-0310-b1b3-9a3be3380cfb


:: Ring - native Windows LRC project generator

@echo off
if "%1" == "/?" goto Usage
if "%~1" == "" goto Usage

set doGen=N
set doBuild=N

set SCRIPTNAME=%~nx0

if "%1"=="gen" (
    set doGen=Y
    set command=Generate
) else if "%1"=="build" (
    set doBuild=Y
    set command=Build
) else (
    goto Usage
)

if "%doGen%"=="Y" (
    if NOT "%4"=="" goto Version_New
    goto Default_version
) else (
    goto StartLocal
)

:Version_New
set QtDir=C:\\Qt\\%4%
set Version=%4%
if not exist "%QtDir%" echo This Qt path does not exist, using default version.
if exist "%QtDir%" goto StartLocal
:Default_version
set QtDir=C:\\Qt\\5.9.4
set Version=5.9.4
if not exist "%QtDir%" echo Default Qt path does not exist, check your installation path. &goto Usage

setlocal
:StartLocal

set arch=N

shift
:ParseArgs
if "%1" == "" goto FinishedArgs
if /I "%1"=="x86" (
    set arch=x86
) else if /I "%1"=="x64" (
    set arch=x64
) else if /I "%1"=="version" (
    shift
) else (
    goto Usage
)
shift
goto ParseArgs

:FinishedArgs
if "%arch%"=="x86" (
    set MSBUILD_ARGS=/nologo /p:useenv=true /p:Configuration=Release /p:Platform=Win32 /verbosity:normal /maxcpucount:%NUMBER_OF_PROCESSORS%
) else if "%arch%"=="x64" (
    set MSBUILD_ARGS=/nologo /p:useenv=true /p:Configuration=Release /p:Platform=x64 /verbosity:normal /maxcpucount:%NUMBER_OF_PROCESSORS%
)

@setlocal

set VSInstallerFolder="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
if %PROCESSOR_ARCHITECTURE%==x86 set VSInstallerFolder="%ProgramFiles%\Microsoft Visual Studio\Installer"

pushd %VSInstallerFolder%
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
  set VSLATESTDIR=%%i
)
popd

echo VS Installation folder: %VSLATESTDIR%

if not exist "%VSLATESTDIR%\VC\Auxiliary\Build\vcvarsall.bat" (
    echo:
    echo VSInstallDir not found or not installed correctly.
    goto cleanup
)

if %PROCESSOR_ARCHITECTURE%==x86 (
    set Comp_x86=x86 10.0.15063.0
    set Comp_x64=x86_amd64 10.0.15063.0
) else (
    set Comp_x86=amd64_x86 10.0.15063.0
    set Comp_x64=amd64 10.0.15063.0
)

set path=%path:"=%
if "%arch%"=="x86" (
    call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x86%
) else if "%arch%"=="x64" (
    call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x64%
)

if "%arch%" neq "N" (
    if "%doGen%" neq "N" (
        goto genLRC
    ) else if "%doBuild%" neq "N" (
		goto buildLRC
    )
    goto :eof
)
goto Usage

:genLRC
echo Generating using Qt version: %Version%
setlocal EnableDelayedExpansion
set DaemonDir=%cd%\\..\\daemon
mkdir msvc
cd msvc
set PATH=C:\\Program Files\\CMake\\bin\\;%PATH%
if "echo QtDir is: %QtDir%"=="" (
    echo Error: QtDir not specified
    goto cleanup
)
set CMAKE_GENERATOR_STRING=""
set CMAKE_OPTIONS=""
if "%arch%"=="x86" (
    set CMAKE_GENERATOR_STRING="Visual Studio 15 2017 Win32"
    set QtCmakeDir=%QtDir%\\msvc2017\\lib\\cmake
) else if "%arch%"=="x64" (
    set CMAKE_GENERATOR_STRING="Visual Studio 15 2017 Win64"
    set QtCmakeDir=%QtDir%\\msvc2017_64\\lib\\cmake
)
set CMAKE_OPTIONS=-DQt5Core_DIR=!QtCmakeDir!\\Qt5Core -DQt5Sql_DIR=!QtCmakeDir!\\Qt5Sql -DQt5LinguistTools_DIR=!QtCmakeDir!\\Qt5LinguistTools -DQt5Concurrent_DIR=!QtCmakeDir!\\Qt5Concurrent -DQt5Gui_DIR=!QtCmakeDir!\\Qt5Gui -Dring_BIN=!DaemonDir!\MSVC\x64\ReleaseLib_win32\bin\dring.lib -DRING_INCLUDE_DIR=!DaemonDir!\src\dring
cmake .. -G !CMAKE_GENERATOR_STRING! !CMAKE_OPTIONS!
endlocal
goto cleanup

:buildLRC
:: build qtwrapper
msbuild msvc\src\qtwrapper\qtwrapper.vcxproj %MSBUILD_ARGS%
:: build lrc
msbuild msvc\ringclient_static.vcxproj %MSBUILD_ARGS%
goto cleanup

@endlocal

:Usage
echo:
echo The correct usage is:
echo:
echo     %SCRIPTNAME% [action] [architecture] [version] [version_para]
echo:
echo where
echo:
echo [action]           is: gen   ^| build
echo [architecture]     is: x86   ^| x64
echo [version]          is: version - optional
echo [version_para]     is: 5.9.4 ^| Qt version installed
echo:
echo For example:
echo     %SCRIPTNAME% gen x86                    - gen x86 static lib vs projects for qtwrapper/lrc for Qt version 5.9.4
echo     %SCRIPTNAME% gen x86 version 5.12.0     - gen x86 static lib vs projects for qtwrapper/lrc for Qt version 5.12.0
echo     %SCRIPTNAME% build x64                  - build x64 qtwrapper/lrc static libs
echo:
goto :eof

:cleanup
endlocal
if %ERRORLEVEL% geq 1 (
    echo %command% failed
    exit %ERRORLEVEL%
) else (
    echo %command% succeeded
    exit /B %ERRORLEVEL%
)

:: Ring - native Windows LRC project generator

@echo off
if "%1" == "/?" goto Usage
if "%~1" == "" goto Usage

set doGen=N
set doBuild=N

set SCRIPTNAME=%~nx0

if "%1"=="gen" (
    set doGen=Y
    set command=Generate
) else if "%1"=="build" (
    set doBuild=Y
    set command=Build
) else (
    goto Usage
)

if "%doGen%"=="Y" (
    if NOT "%4"=="" goto Version_New
    goto Default_version
) else (
    goto StartLocal
)

:Version_New
set QtDir=C:\\Qt\\%4%
set Version=%4%
if not exist "%QtDir%" echo This Qt path does not exist, using default version.
if exist "%QtDir%" goto StartLocal
:Default_version
set QtDir=C:\\Qt\\5.9.4
set Version=5.9.4
if not exist "%QtDir%" echo Default Qt path does not exist, check your installation path. &goto Usage

setlocal
:StartLocal

set arch=N

shift
:ParseArgs
if "%1" == "" goto FinishedArgs
if /I "%1"=="x86" (
    set arch=x86
) else if /I "%1"=="x64" (
    set arch=x64
) else if /I "%1"=="version" (
    shift
) else (
    goto Usage
)
shift
goto ParseArgs

:FinishedArgs
if "%arch%"=="x86" (
    set MSBUILD_ARGS=/nologo /p:useenv=true /p:Configuration=Release /p:Platform=Win32 /verbosity:normal /maxcpucount:%NUMBER_OF_PROCESSORS%
) else if "%arch%"=="x64" (
    set MSBUILD_ARGS=/nologo /p:useenv=true /p:Configuration=Release /p:Platform=x64 /verbosity:normal /maxcpucount:%NUMBER_OF_PROCESSORS%
)

@setlocal

set VSInstallerFolder="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
if %PROCESSOR_ARCHITECTURE%==x86 set VSInstallerFolder="%ProgramFiles%\Microsoft Visual Studio\Installer"

pushd %VSInstallerFolder%
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
  set VSLATESTDIR=%%i
)
popd

echo VS Installation folder: %VSLATESTDIR%

if not exist "%VSLATESTDIR%\VC\Auxiliary\Build\vcvarsall.bat" (
    echo:
    echo VSInstallDir not found or not installed correctly.
    goto cleanup
)

if %PROCESSOR_ARCHITECTURE%==x86 (
    set Comp_x86=x86 10.0.16299.0
    set Comp_x64=x86_amd64 10.0.16299.0
) else (
    set Comp_x86=amd64_x86 10.0.16299.0
    set Comp_x64=amd64 10.0.16299.0
)

set path=%path:"=%
if "%arch%"=="x86" (
    call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x86%
) else if "%arch%"=="x64" (
    call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x64%
)

if "%arch%" neq "N" (
    if "%doGen%" neq "N" (
        goto genLRC
    ) else if "%doBuild%" neq "N" (
		goto buildLRC
    )
    goto :eof
)
goto Usage

:genLRC
echo Generating using Qt version: %Version%
setlocal EnableDelayedExpansion
set DaemonDir=%cd%\\..\\daemon
mkdir msvc
cd msvc
set PATH=C:\\Program Files\\CMake\\bin\\;%PATH%
if "echo QtDir is: %QtDir%"=="" (
    echo Error: QtDir not specified
    goto cleanup
)
set CMAKE_GENERATOR_STRING=""
set CMAKE_OPTIONS=""
if "%arch%"=="x86" (
    set CMAKE_GENERATOR_STRING="Visual Studio 15 2017 Win32"
    set QtCmakeDir=%QtDir%\\msvc2017\\lib\\cmake
) else if "%arch%"=="x64" (
    set CMAKE_GENERATOR_STRING="Visual Studio 15 2017 Win64"
    set QtCmakeDir=%QtDir%\\msvc2017_64\\lib\\cmake
)
set CMAKE_OPTIONS=-DQt5Core_DIR=!QtCmakeDir!\\Qt5Core -DQt5Sql_DIR=!QtCmakeDir!\\Qt5Sql -DQt5LinguistTools_DIR=!QtCmakeDir!\\Qt5LinguistTools -DQt5Concurrent_DIR=!QtCmakeDir!\\Qt5Concurrent -DQt5Gui_DIR=!QtCmakeDir!\\Qt5Gui -Dring_BIN=!DaemonDir!\MSVC\x64\ReleaseLib_win32\bin\dring.lib -DRING_INCLUDE_DIR=!DaemonDir!\src\dring
cmake .. -G !CMAKE_GENERATOR_STRING! !CMAKE_OPTIONS!
endlocal
goto cleanup

:buildLRC
:: build qtwrapper
msbuild msvc\src\qtwrapper\qtwrapper.vcxproj %MSBUILD_ARGS%
:: build lrc
msbuild msvc\ringclient_static.vcxproj %MSBUILD_ARGS%
goto cleanup

@endlocal

:Usage
echo:
echo The correct usage is:
echo:
echo     %SCRIPTNAME% [action] [architecture] [version] [version_para]
echo:
echo where
echo:
echo [action]           is: gen   ^| build
echo [architecture]     is: x86   ^| x64
echo [version]          is: version - optional
echo [version_para]     is: 5.9.4 ^| Qt version installed
echo:
echo For example:
echo     %SCRIPTNAME% gen x86                    - gen x86 static lib vs projects for qtwrapper/lrc for Qt version 5.9.4
echo     %SCRIPTNAME% gen x86 version 5.12.0     - gen x86 static lib vs projects for qtwrapper/lrc for Qt version 5.12.0
echo     %SCRIPTNAME% build x64                  - build x64 qtwrapper/lrc static libs
echo:
goto :eof

:cleanup
endlocal
if %ERRORLEVEL% geq 1 (
    echo %command% failed
    exit %ERRORLEVEL%
) else (
    echo %command% succeeded
    exit /B %ERRORLEVEL%
)

update environment sdk to 16299

win32: update environment sdk to 16299

Change-Id: I14582e74503a9ab9209c5c3fe9a78606a7d0e0d9


@echo off
rem THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
rem THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
rem PARTICULAR PURPOSE.
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.

setlocal
set error=0

if %1.==xbox. goto continuexbox
if %1.==. goto continue
echo usage: CompileShaders [xbox]
exit /b

:continuexbox
set XBOXFXC="%XboxOneXDKLatest%xdk\FXC\amd64\FXC.exe"
if exist %XBOXFXC% goto continue
set XBOXFXC="%XboxOneXDKBuild%xdk\FXC\amd64\FXC.exe"
if exist %XBOXFXC% goto continue
set XBOXFXC="%DurangoXDK%xdk\FXC\amd64\FXC.exe"
if not exist %XBOXFXC% goto needxdk

:continue

call :CompileShader%1 AlphaTestEffect vs VSAlphaTest
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestNoFog
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVc
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVcNoFog

call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGt
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGtNoFog
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNe
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNeNoFog

call :CompileShader%1 BasicEffect vs VSBasic
call :CompileShader%1 BasicEffect vs VSBasicNoFog
call :CompileShader%1 BasicEffect vs VSBasicVc
call :CompileShader%1 BasicEffect vs VSBasicVcNoFog
call :CompileShader%1 BasicEffect vs VSBasicTx
call :CompileShader%1 BasicEffect vs VSBasicTxNoFog
call :CompileShader%1 BasicEffect vs VSBasicTxVc
call :CompileShader%1 BasicEffect vs VSBasicTxVcNoFog

call :CompileShader%1 BasicEffect vs VSBasicVertexLighting
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingVc
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingVcBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTx
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxVc
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxVcBn

call :CompileShader%1 BasicEffect vs VSBasicOneLight
call :CompileShader%1 BasicEffect vs VSBasicOneLightBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightVc
call :CompileShader%1 BasicEffect vs VSBasicOneLightVcBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightTx
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxVc
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxVcBn

call :CompileShader%1 BasicEffect vs VSBasicPixelLighting
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingVc
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingVcBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTx
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxVc
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxVcBn

call :CompileShader%1 BasicEffect ps PSBasic
call :CompileShader%1 BasicEffect ps PSBasicNoFog
call :CompileShader%1 BasicEffect ps PSBasicTx
call :CompileShader%1 BasicEffect ps PSBasicTxNoFog

call :CompileShader%1 BasicEffect ps PSBasicVertexLighting
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingNoFog
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTx
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTxNoFog

call :CompileShader%1 BasicEffect ps PSBasicPixelLighting
call :CompileShader%1 BasicEffect ps PSBasicPixelLightingTx

call :CompileShader%1 DualTextureEffect vs VSDualTexture
call :CompileShader%1 DualTextureEffect vs VSDualTextureNoFog
call :CompileShader%1 DualTextureEffect vs VSDualTextureVc
call :CompileShader%1 DualTextureEffect vs VSDualTextureVcNoFog

call :CompileShader%1 DualTextureEffect ps PSDualTexture
call :CompileShader%1 DualTextureEffect ps PSDualTextureNoFog

call :CompileShader%1 EnvironmentMapEffect vs VSEnvMap
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapFresnel
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapFresnelBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLight
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightFresnel
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightFresnelBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapPixelLighting
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapPixelLightingBn

call :CompileShader%1 EnvironmentMapEffect ps PSEnvMap
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecular
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecularNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLighting
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingFresnel
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingFresnelNoFog

call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingFourBonesBn

call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightFourBonesBn

call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingFourBonesBn

call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLighting
call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLightingNoFog
call :CompileShader%1 SkinnedEffect ps PSSkinnedPixelLighting

call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTx
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxBn
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVc
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVcBn

call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTx
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoFog
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoSpec
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoFogSpec

call :CompileShader%1 SpriteEffect vs SpriteVertexShader
call :CompileShader%1 SpriteEffect ps SpritePixelShader

call :CompileShader%1 DGSLEffect vs main
call :CompileShader%1 DGSLEffect vs mainVc
call :CompileShader%1 DGSLEffect vs main1Bones
call :CompileShader%1 DGSLEffect vs main1BonesVc
call :CompileShader%1 DGSLEffect vs main2Bones
call :CompileShader%1 DGSLEffect vs main2BonesVc
call :CompileShader%1 DGSLEffect vs main4Bones
call :CompileShader%1 DGSLEffect vs main4BonesVc

call :CompileShaderHLSL%1 DGSLUnlit ps main
call :CompileShaderHLSL%1 DGSLLambert ps main
call :CompileShaderHLSL%1 DGSLPhong ps main

call :CompileShaderHLSL%1 DGSLUnlit ps mainTk
call :CompileShaderHLSL%1 DGSLLambert ps mainTk
call :CompileShaderHLSL%1 DGSLPhong ps mainTk

call :CompileShaderHLSL%1 DGSLUnlit ps mainTx
call :CompileShaderHLSL%1 DGSLLambert ps mainTx
call :CompileShaderHLSL%1 DGSLPhong ps mainTx

call :CompileShaderHLSL%1 DGSLUnlit ps mainTxTk
call :CompileShaderHLSL%1 DGSLLambert ps mainTxTk
call :CompileShaderHLSL%1 DGSLPhong ps mainTxTk

call :CompileShaderSM4%1 PostProcess vs VSQuad
call :CompileShaderSM4%1 PostProcess ps PSCopy
call :CompileShaderSM4%1 PostProcess ps PSMonochrome
call :CompileShaderSM4%1 PostProcess ps PSSepia
call :CompileShaderSM4%1 PostProcess ps PSDownScale2x2
call :CompileShaderSM4%1 PostProcess ps PSDownScale4x4
call :CompileShaderSM4%1 PostProcess ps PSGaussianBlur5x5
call :CompileShaderSM4%1 PostProcess ps PSBloomExtract
call :CompileShaderSM4%1 PostProcess ps PSBloomBlur
call :CompileShaderSM4%1 PostProcess ps PSMerge
call :CompileShaderSM4%1 PostProcess ps PSBloomCombine

call :CompileShaderSM4%1 ToneMap vs VSQuad
call :CompileShaderSM4%1 ToneMap ps PSCopy
call :CompileShaderSM4%1 ToneMap ps PSSaturate
call :CompileShaderSM4%1 ToneMap ps PSReinhard
call :CompileShaderSM4%1 ToneMap ps PSACESFilmic
call :CompileShaderSM4%1 ToneMap ps PS_SRGB
call :CompileShaderSM4%1 ToneMap ps PSSaturate_SRGB
call :CompileShaderSM4%1 ToneMap ps PSReinhard_SRGB
call :CompileShaderSM4%1 ToneMap ps PSACESFilmic_SRGB
call :CompileShaderSM4%1 ToneMap ps PSHDR10

if NOT %1.==xbox. goto skipxboxonly

call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard
call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate_SRGB
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard_SRGB
call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic_SRGB

:skipxboxonly

echo.

if %error% == 0 (
    echo Shaders compiled ok
) else (
    echo There were shader compilation errors!
)

endlocal
exit /b

:CompileShader
set fxc=fxc /nologo %1.fx /T%2_4_0_level_9_1 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderSM4
set fxc=fxc /nologo %1.fx /T%2_4_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderHLSL
set fxc=fxc /nologo %1.hlsl /T%2_4_0_level_9_1 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderxbox
:CompileShaderSM4xbox
set fxc=%XBOXFXC% /nologo %1.fx /T%2_5_0 /Zpc /Zi /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderHLSLxbox
set fxc=%XBOXFXC% /nologo %1.hlsl /T%2_5_0 /Zpc /Zi /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:needxdk
echo ERROR: CompileShaders xbox requires the Microsoft Xbox One XDK
echo        (try re-running from the XDK Command Prompt)

@echo off
rem THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
rem THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
rem PARTICULAR PURPOSE.
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.

setlocal
set error=0

if %1.==xbox. goto continuexbox
if %1.==. goto continue
echo usage: CompileShaders [xbox]
exit /b

:continuexbox
set XBOXFXC="%XboxOneXDKLatest%\xdk\FXC\amd64\FXC.exe"
if exist %XBOXFXC% goto continue
set XBOXFXC="%XboxOneXDKLatest%xdk\FXC\amd64\FXC.exe"
if exist %XBOXFXC% goto continue
set XBOXFXC="%XboxOneXDKBuild%xdk\FXC\amd64\FXC.exe"
if exist %XBOXFXC% goto continue
set XBOXFXC="%DurangoXDK%xdk\FXC\amd64\FXC.exe"
if not exist %XBOXFXC% goto needxdk

:continue

call :CompileShader%1 AlphaTestEffect vs VSAlphaTest
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestNoFog
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVc
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVcNoFog

call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGt
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGtNoFog
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNe
call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNeNoFog

call :CompileShader%1 BasicEffect vs VSBasic
call :CompileShader%1 BasicEffect vs VSBasicNoFog
call :CompileShader%1 BasicEffect vs VSBasicVc
call :CompileShader%1 BasicEffect vs VSBasicVcNoFog
call :CompileShader%1 BasicEffect vs VSBasicTx
call :CompileShader%1 BasicEffect vs VSBasicTxNoFog
call :CompileShader%1 BasicEffect vs VSBasicTxVc
call :CompileShader%1 BasicEffect vs VSBasicTxVcNoFog

call :CompileShader%1 BasicEffect vs VSBasicVertexLighting
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingVc
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingVcBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTx
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxBn
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxVc
call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxVcBn

call :CompileShader%1 BasicEffect vs VSBasicOneLight
call :CompileShader%1 BasicEffect vs VSBasicOneLightBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightVc
call :CompileShader%1 BasicEffect vs VSBasicOneLightVcBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightTx
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxBn
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxVc
call :CompileShader%1 BasicEffect vs VSBasicOneLightTxVcBn

call :CompileShader%1 BasicEffect vs VSBasicPixelLighting
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingVc
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingVcBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTx
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxBn
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxVc
call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxVcBn

call :CompileShader%1 BasicEffect ps PSBasic
call :CompileShader%1 BasicEffect ps PSBasicNoFog
call :CompileShader%1 BasicEffect ps PSBasicTx
call :CompileShader%1 BasicEffect ps PSBasicTxNoFog

call :CompileShader%1 BasicEffect ps PSBasicVertexLighting
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingNoFog
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTx
call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTxNoFog

call :CompileShader%1 BasicEffect ps PSBasicPixelLighting
call :CompileShader%1 BasicEffect ps PSBasicPixelLightingTx

call :CompileShader%1 DualTextureEffect vs VSDualTexture
call :CompileShader%1 DualTextureEffect vs VSDualTextureNoFog
call :CompileShader%1 DualTextureEffect vs VSDualTextureVc
call :CompileShader%1 DualTextureEffect vs VSDualTextureVcNoFog

call :CompileShader%1 DualTextureEffect ps PSDualTexture
call :CompileShader%1 DualTextureEffect ps PSDualTextureNoFog

call :CompileShader%1 EnvironmentMapEffect vs VSEnvMap
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapFresnel
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapFresnelBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLight
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightFresnel
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightFresnelBn
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapPixelLighting
call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapPixelLightingBn

call :CompileShader%1 EnvironmentMapEffect ps PSEnvMap
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecular
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecularNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLighting
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingNoFog
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingFresnel
call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapPixelLightingFresnelNoFog

call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingFourBonesBn

call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightFourBonesBn

call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingOneBone
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingOneBoneBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingTwoBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingTwoBonesBn
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingFourBones
call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingFourBonesBn

call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLighting
call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLightingNoFog
call :CompileShader%1 SkinnedEffect ps PSSkinnedPixelLighting

call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTx
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxBn
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVc
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVcBn

call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTx
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoFog
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoSpec
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoFogSpec

call :CompileShader%1 SpriteEffect vs SpriteVertexShader
call :CompileShader%1 SpriteEffect ps SpritePixelShader

call :CompileShader%1 DGSLEffect vs main
call :CompileShader%1 DGSLEffect vs mainVc
call :CompileShader%1 DGSLEffect vs main1Bones
call :CompileShader%1 DGSLEffect vs main1BonesVc
call :CompileShader%1 DGSLEffect vs main2Bones
call :CompileShader%1 DGSLEffect vs main2BonesVc
call :CompileShader%1 DGSLEffect vs main4Bones
call :CompileShader%1 DGSLEffect vs main4BonesVc

call :CompileShaderHLSL%1 DGSLUnlit ps main
call :CompileShaderHLSL%1 DGSLLambert ps main
call :CompileShaderHLSL%1 DGSLPhong ps main

call :CompileShaderHLSL%1 DGSLUnlit ps mainTk
call :CompileShaderHLSL%1 DGSLLambert ps mainTk
call :CompileShaderHLSL%1 DGSLPhong ps mainTk

call :CompileShaderHLSL%1 DGSLUnlit ps mainTx
call :CompileShaderHLSL%1 DGSLLambert ps mainTx
call :CompileShaderHLSL%1 DGSLPhong ps mainTx

call :CompileShaderHLSL%1 DGSLUnlit ps mainTxTk
call :CompileShaderHLSL%1 DGSLLambert ps mainTxTk
call :CompileShaderHLSL%1 DGSLPhong ps mainTxTk

call :CompileShaderSM4%1 PostProcess vs VSQuad
call :CompileShaderSM4%1 PostProcess ps PSCopy
call :CompileShaderSM4%1 PostProcess ps PSMonochrome
call :CompileShaderSM4%1 PostProcess ps PSSepia
call :CompileShaderSM4%1 PostProcess ps PSDownScale2x2
call :CompileShaderSM4%1 PostProcess ps PSDownScale4x4
call :CompileShaderSM4%1 PostProcess ps PSGaussianBlur5x5
call :CompileShaderSM4%1 PostProcess ps PSBloomExtract
call :CompileShaderSM4%1 PostProcess ps PSBloomBlur
call :CompileShaderSM4%1 PostProcess ps PSMerge
call :CompileShaderSM4%1 PostProcess ps PSBloomCombine

call :CompileShaderSM4%1 ToneMap vs VSQuad
call :CompileShaderSM4%1 ToneMap ps PSCopy
call :CompileShaderSM4%1 ToneMap ps PSSaturate
call :CompileShaderSM4%1 ToneMap ps PSReinhard
call :CompileShaderSM4%1 ToneMap ps PSACESFilmic
call :CompileShaderSM4%1 ToneMap ps PS_SRGB
call :CompileShaderSM4%1 ToneMap ps PSSaturate_SRGB
call :CompileShaderSM4%1 ToneMap ps PSReinhard_SRGB
call :CompileShaderSM4%1 ToneMap ps PSACESFilmic_SRGB
call :CompileShaderSM4%1 ToneMap ps PSHDR10

if NOT %1.==xbox. goto skipxboxonly

call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard
call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate_SRGB
call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard_SRGB
call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic_SRGB

:skipxboxonly

echo.

if %error% == 0 (
    echo Shaders compiled ok
) else (
    echo There were shader compilation errors!
)

endlocal
exit /b

:CompileShader
set fxc=fxc /nologo %1.fx /T%2_4_0_level_9_1 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderSM4
set fxc=fxc /nologo %1.fx /T%2_4_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderHLSL
set fxc=fxc /nologo %1.hlsl /T%2_4_0_level_9_1 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderxbox
:CompileShaderSM4xbox
set fxc=%XBOXFXC% /nologo %1.fx /T%2_5_0 /Zpc /Zi /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:CompileShaderHLSLxbox
set fxc=%XBOXFXC% /nologo %1.hlsl /T%2_5_0 /Zpc /Zi /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b

:needxdk
echo ERROR: CompileShaders xbox requires the Microsoft Xbox One XDK
echo        (try re-running from the XDK Command Prompt)

Fix for build script

Fix for build script


@echo off
call setvar.bat
rem nasm -f win64 -D_WIN64 src\asm\low_x86-64.asm
rem lib /OUT:lib\mcl.lib /nodefaultlib fp.obj src\asm\low_x86-64.obj

echo cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj
     cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj
echo lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj
     lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj

echo cl /c %CFLAGS% src\bn_c.cpp /Foobj\bn_c256.obj /D"MCLBN_FP_UNIT_SIZE=4"
     cl /c %CFLAGS% src\bn_c.cpp /Foobj\bn_c256.obj /D"MCLBN_FP_UNIT_SIZE=4"
echo link /nologo /DLL /OUT:bin\mclbn256.dll obj\bn_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn256.lib
     link /nologo /DLL /OUT:bin\mclbn256.dll obj\bn_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn256.lib

echo cl /c %CFLAGS% src\bn_c.cpp /Foobj\bn_c384.obj /D"MCLBN_FP_UNIT_SIZE=6"
     cl /c %CFLAGS% src\bn_c.cpp /Foobj\bn_c384.obj /D"MCLBN_FP_UNIT_SIZE=6"
echo link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib
     link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib

@echo off
call setvar.bat
rem nasm -f win64 -D_WIN64 src\asm\low_x86-64.asm
rem lib /OUT:lib\mcl.lib /nodefaultlib fp.obj src\asm\low_x86-64.obj

echo cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj
     cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj
echo lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj
     lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj

echo cl /c %CFLAGS% src\bn_c256.cpp /Foobj\bn_c256.obj
     cl /c %CFLAGS% src\bn_c256.cpp /Foobj\bn_c256.obj
echo link /nologo /DLL /OUT:bin\mclbn256.dll obj\bn_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn256.lib
     link /nologo /DLL /OUT:bin\mclbn256.dll obj\bn_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn256.lib

echo cl /c %CFLAGS% src\bn_c384.cpp /Foobj\bn_c384.obj
     cl /c %CFLAGS% src\bn_c384.cpp /Foobj\bn_c384.obj
echo link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib
     link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib

fix source

fix source


del *.ipk

call tools\deploy.bat

copy appinfo.json deploy\
call palm-package package\ deploy\ service\
call palm-install *.ipk
REM pscp -P 55022 -l root -pw "" -scp *.ipk 127.0.0.1:/media/internal/

del *.ipk

call tools\deploy.bat

copy appinfo.json deploy\
call palm-package package\ deploy\ service\
call palm-install *.ipk

pscp -P 55022 -l root -pw "" -scp *.ipk 127.0.0.1:/media/internal/
adb push *.ipk /media/internal/

copy ipk to devices on build.

copy ipk to devices on build.


perl util\mkfiles.pl >MINFO
rem perl util\mk1mf.pl VC-MSDOS no-sock >ms\msdos.mak
rem perl util\mk1mf.pl VC-W31-32 >ms\w31.mak
perl util\mk1mf.pl VC-W31-32 dll >ms\w31dll.mak
perl util\mk1mf.pl VC-WIN32 no-asm >ms\nt.mak
perl util\mk1mf.pl VC-WIN32 dll no-asm >ms\ntdll.mak

perl util\mkdef.pl 16 libeay > ms\libeay16.def
perl util\mkdef.pl 32 libeay > ms\libeay32.def
perl util\mkdef.pl 16 ssleay > ms\ssleay16.def
perl util\mkdef.pl 32 ssleay > ms\ssleay32.def

Convert ms/do_ms.bat to DOS EOL format of DOS chokes on it.


@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

ECHO.
IF "%1"=="" (
	ECHO SUMMARY
	ECHO 	Deletes the specified IP from the ARP table, then pings the IP to
	ECHO 	extablish the correct Physical Address.
	ECHO 	The script will then continually monitor the specified IP's entry in
	ECHO 	the ARP table. If the IP's ARP table ever changes or is removed, the
	ECHO 	script will BEEP and set the Physical Address back to the correct value.
	ECHO AUTHOR
	ECHO 	Alan Reed
	ECHO 	Please contact the author with any questions, comments, or concers
	ECHO 	at al.reed13@gmail.com
	ECHO LICENSE
	ECHO 	Copyright 2012. This script is free to use, modify, and redistribute
	ECHO 	so long as you give credit to the original author.
	ECHO SYNTAX
	ECHO 	"defendARP.bat <IPAddr to monitor>"
	ECHO DESCRIPTION
	ECHO 	^<IPAddr to monitor^> should NOT be your own IPAddr. Use the IPAddr
	ECHO 	of a different device on you LAN that you are communicating with. Try
	ECHO 	the IPAddr of your network gateway.
	ECHO.
	GOTO ERROR
)

 :: Check if $1 is Local hosts IP
FOR /F "tokens=2" %%i in ('ARP -A ^| FINDSTR \-\-\-') do (

	IF "%1"=="%%i" (
		ECHO Cannot protect your own IP Address -- Try using the Default Gateway or router's IP Address.
		GOTO ERROR
	)
)

ECHO INITIALIZING...
ECHO.
ECHO Removing %1 from ARP table.
 :: Remove %1 from arp table
ARP -d %1
ECHO OK.

 :: Ping the IP to establish it's correct MAC address.
 :: Note that ARP could still be poisoned if attcker sends poison packet while we are pinging.
ECHO Obtaining MAC address.
PING -n 1 %1 >nul
IF ERRORLEVEL 1 (
	ECHO Bad IP Address.
	GOTO ERROR
)

 :: Find the specified IP in the ARP Table
SET PhysAddr=""
SET tmp=""
FOR /F "tokens=*" %%a in ('ARP -a ^| findstr "%1"') do (
	SET tmp=%%a
 	:: We do this little trick with the question marks to avoid return the wrong line from the ARP table.
	SET tmp=!tmp: =?!
	FOR /F "tokens=*" %%b in ('ECHO !tmp! ^| findstr %1?') do (
		SET PhysAddr=%%b
	)
)
 :: Check that the specified IP was found in the ARP table
IF %PhysAddr%=="" (
	ECHO Host Not Found.
	GOTO ERROR
)
 :: Extract the actualy Physical Address
SET PhysAddr=%PhysAddr:~15,-11%
SET PhysAddr=%PhysAddr:?=%
ECHO OK.

:QUESTION
SET /p  a=Is %PhysAddr% the correct MAC for %1 (y/n)?
IF "%a%"=="n" (
	ECHO.
	ECHO If this is not the correct MAC then you have already been poinsoned.
	ECHO You must start this script in a 'safe' state.
	arp -d %1
	GOTO DONE
) else IF "%a%"=="y" (
	ECHO OK.
	ECHO.
	ECHO Monitoring your ARP table...
	ECHO.
	SET GoodMAC=%PhysAddr%
	GOTO LOOP
) else ( GOTO QUESTION )

:LOOP
	 :: Find the specified IP in the ARP Table
	SET PhysAddr=""
	SET tmp=""
	FOR /F "tokens=*" %%a in ('ARP -a ^| FINDSTR "%1"') do (
		SET tmp=%%a
		SET tmp=!tmp: =?!
		FOR /F "tokens=*" %%b in ('ECHO !tmp! ^| findstr %1?') do (
			SET PhysAddr=%%b
		)
	)
	IF %PhysAddr%=="" (
		ECHO %1 not found. Reestablishing connection...
		ping -n 1 %1 | findstr TTL >nul
		IF ERRORLEVEL 1 (
			ECHO Lost Connection to %1
			GOTO ERROR
		)
		ECHO OK.
		GOTO LOOP
	)
	 :: Extract the Physical Address
	SET PhysAddr=%PhysAddr:~15,-11%
	SET PhysAddr=%PhysAddr:?=%

	 :: check that the MAC did not change
	IF NOT "%GoodMAC%"=="%PhysAddr%" (
		ECHO.
		 :: BEEP - echo <ctrl+g> to a .txt, then copy the result onto the line below
		ECHO
		ECHO ARP POISONED!
		ECHO Spoofed IP: %1
		ECHO %1's actual Physical Address: %GoodMAC%
		ECHO Attcker's Physical Address: %PhysAddr%
		ECHO Attempting to reset the correct Physical Address...
		 :: Attempt to reset ARP table. This will not work if we are continually being poisoned.
		ARP -d %1
		PING -n 1 %1 >nul
		ECHO ARP Table reset.
		ECHO.
		ECHO Monitoring your ARP table...
	)
	 :: wait for 5 seconds
	ping -n 5 127.0.0.1 >nul
GOTO LOOP

GOTO DONE
:ERROR
ECHO.
:DONE

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

ECHO.
IF "%1"=="" (
	ECHO SUMMARY
	ECHO 	Deletes the specified IP from the ARP table, then pings the IP to
	ECHO 	extablish the correct Physical Address.
	ECHO 	The script will then continually monitor the specified IP's entry in
	ECHO 	the ARP table. If the IP's ARP table ever changes or is removed, the
	ECHO 	script will BEEP and set the Physical Address back to the correct value.
	ECHO AUTHOR
	ECHO 	Alan Reed
	ECHO 	Please contact the author with any questions, comments, or concers
	ECHO 	at al.reed13@gmail.com
	ECHO LICENSE
	ECHO 	Copyright 2012. This script is free to use, modify, and redistribute
	ECHO 	so long as you give credit to the original author.
	ECHO SYNTAX
	ECHO 	"defendARP.bat <IPAddr to monitor>"
	ECHO DESCRIPTION
	ECHO 	^<IPAddr to monitor^> should NOT be your own IPAddr. Use the IPAddr
	ECHO 	of a different device on you LAN that you are communicating with. Try
	ECHO 	the IPAddr of your network gateway.
	ECHO.
	GOTO ERROR
)

 :: Check if $1 is Local hosts IP
FOR /F "tokens=2" %%i in ('ARP -A ^| FINDSTR \-\-\-') do (

	IF "%1"=="%%i" (
		ECHO Cannot protect your own IP Address -- Try using the Default Gateway or router's IP Address.
		GOTO ERROR
	)
)

ECHO INITIALIZING...
ECHO.
ECHO Removing %1 from ARP table.
 :: Remove %1 from arp table
ARP -d %1
ECHO OK.

 :: Ping the IP to establish it's correct MAC address.
 :: Note that ARP could still be poisoned if attcker sends poison packet while we are pinging.
ECHO Obtaining MAC address.
PING -n 1 %1 >nul
IF ERRORLEVEL 1 (
	ECHO Bad IP Address.
	GOTO ERROR
)

 :: Find the specified IP in the ARP Table
SET PhysAddr=""
SET tmp=""
FOR /F "tokens=*" %%a in ('ARP -a ^| findstr "%1"') do (
	SET tmp=%%a
 	:: We do this little trick with the question marks to avoid return the wrong line from the ARP table.
	SET tmp=!tmp: =?!
	FOR /F "tokens=*" %%b in ('ECHO !tmp! ^| findstr %1?') do (
		SET PhysAddr=%%b
	)
)
 :: Check that the specified IP was found in the ARP table
IF %PhysAddr%=="" (
	ECHO Host Not Found.
	GOTO ERROR
)
 :: Extract the actualy Physical Address
SET PhysAddr=%PhysAddr:~15,-11%
SET PhysAddr=%PhysAddr:?=%
ECHO OK.

:QUESTION
SET /p  a=Is %PhysAddr% the correct MAC for %1 (y/n)?
IF "%a%"=="n" (
	ECHO.
	ECHO If this is not the correct MAC then you have already been poinsoned.
	ECHO You must start this script in a 'safe' state.
	arp -d %1
	GOTO DONE
) else IF "%a%"=="y" (
	ECHO OK.
	ECHO.
	ECHO Monitoring your ARP table...
	ECHO.
	SET GoodMAC=%PhysAddr%
	GOTO LOOP
) else ( GOTO QUESTION )

 :: Monitor the ARP Table
:LOOP
	 :: Find the specified IP in the ARP Table
	SET PhysAddr=""
	SET tmp=""
	FOR /F "tokens=*" %%a in ('ARP -a ^| FINDSTR "%1"') do (
		SET tmp=%%a
		SET tmp=!tmp: =?!
		FOR /F "tokens=*" %%b in ('ECHO !tmp! ^| findstr %1?') do (
			SET PhysAddr=%%b
		)
	)
	IF %PhysAddr%=="" (
		ECHO %1 not found. Reestablishing connection...
		ping -n 1 %1 | findstr TTL >nul
		IF ERRORLEVEL 1 (
			ECHO Lost Connection to %1
			GOTO ERROR
		)
		ECHO OK.
		GOTO LOOP
	)
	 :: Extract the Physical Address
	SET PhysAddr=%PhysAddr:~15,-11%
	SET PhysAddr=%PhysAddr:?=%

	 :: check that the MAC did not change
	IF NOT "%GoodMAC%"=="%PhysAddr%" (
		ECHO.
		 :: BEEP - echo <ctrl+g> to a .txt, then copy the result onto the line below
		ECHO
		ECHO ARP POISONED!
		ECHO Spoofed IP: %1
		ECHO %1's actual Physical Address: %GoodMAC%
		ECHO Attcker's Physical Address: %PhysAddr%
		ECHO Attempting to reset the correct Physical Address...
		 :: Attempt to reset ARP table. This will not work if we are continually being poisoned.
		ARP -d %1
		PING -n 1 %1 >nul
		ECHO ARP Table reset.
		ECHO.
		ECHO Monitoring your ARP table...
	)
	 :: wait for 5 seconds
	ping -n 5 127.0.0.1 >nul
GOTO LOOP

GOTO DONE
:ERROR
ECHO.
:DONE

add comments

add comments


REM @echo off
@echo on
Echo Windows SYNC

REM # XEON x64 Build Vars #
set _SCRIPT_DRIVE=%~d0
set _SCRIPT_FOLDER=%~dp0
set INITDIR=%CD%
SET GITPath="C:\Program Files\Git\bin"
set PATH=%GITPath%;%PATH%
set REPO=%_SCRIPT_FOLDER%

bash %REPO%_sync.sh

Create publish_eyetune.bat

Create publish_eyetune.bat


call dnvm use 1.0.0-rc1-update1 -r clr || goto error
call dnu restore || goto error

set PROJECTS=src\Google.Api.CommonProtos src\Google.Api.Gax src\Google.Api.Gax.Rest testing\Google.Api.Gax.Testing
set TESTS=test\Google.Api.Gax.Tests test\Google.Api.Gax.Rest.Tests

for %%P in (%PROJECTS%) do (
  call dnu build --configuration %Configuration% %%P || goto error
)

for %%P in (%TESTS%) do (
  call dnu build --configuration %Configuration% %%P || goto error
  dnx --configuration %Configuration% -p %%P test || goto error
)

for %%P in (%PROJECTS%) do (
  call dnu pack --configuration %Configuration% %%P || goto error
)

goto end

:error
echo Build failed due to error. Please address.
exit /b 1

:end

@echo on
call dnvm use 1.0.0-rc1-update1 -r clr || goto error
call dnu restore || goto error

set PROJECTS=src\Google.Api.CommonProtos src\Google.Api.Gax src\Google.Api.Gax.Rest testing\Google.Api.Gax.Testing
set TESTS=test\Google.Api.Gax.Tests test\Google.Api.Gax.Rest.Tests

for %%P in (%PROJECTS%) do (
  echo Building %%P
  call dnu build --configuration %Configuration% %%P || goto error
)

for %%P in (%TESTS%) do (
  echo Testing %%P
  call dnu build --configuration %Configuration% %%P || goto error
  dnx --configuration %Configuration% -p %%P test || goto error
)

for %%P in (%PROJECTS%) do (
  echo Packing %%P
  call dnu pack --configuration %Configuration% %%P || goto error
)

echo Done!

goto end

:error
echo Build failed due to error. Please address.
echo Pausing for build logs to catch up
timeout /T 5
exit /b 1

:end

Add more diagnostics in myget

Add more diagnostics in myget


sed -i 's/gnu/msvc/' changeforest-r/src/Makevars.win
sed -i '1s/^/export CXX_STD=CXX11\n/' Makevars.win
sed -i '1s/^/export PKG_CXXFLAGS=$(CXX_VISIBILITY)\n/' Makevars.win
"%R%" CMD INSTALL --build changeforest-r
IF %ERRORLEVEL% NEQ 0 exit 1

sed -i 's/gnu/msvc/' changeforest-r/src/Makevars.win
sed -i '1s/^/export CXX_STD=CXX11\n/' changeforest-r/src/Makevars.win
sed -i '1s/^/export PKG_CXXFLAGS=$(CXX_VISIBILITY)\n/' changeforest-r/src/Makevars.win
"%R%" CMD INSTALL --build changeforest-r
IF %ERRORLEVEL% NEQ 0 exit 1

Use the correct path for makevars.

Use the correct path for makevars.


DisableICloudNotificationBanner.exe
if %ERRORLEVEL% equ 0 goto okay
if %ERRORLEVEL% neq 0 goto fail

:okay
taskkill /f /im explorer.exe
start explorer.exe

:fail
exit /b 1

Add useful batch.

Add useful batch.


@rem The cmd /C hack circumvents a regression where conda installs a conda.bat
@rem script in non-root environments.
set CONDA=cmd /C conda
set CONDA_INSTALL=%CONDA% install -q -y
set PIP_INSTALL=pip install -q

@echo on

@rem Deactivate any environment
call deactivate
@rem Update conda
%CONDA% update -q -y conda
@rem Display root environment (for debugging)
%CONDA% list
@rem Clean up any left-over from a previous build
%CONDA% remove --all -q -y -n %CONDA_ENV%

@rem Create test environment
@rem (note: no cytoolz as it seems to prevent faulthandler tracebacks on crash)
%CONDA% create -n %CONDA_ENV% -q -y ^
    bokeh ^
    click ^
    cloudpickle ^
    dask ^
    dill ^
    futures ^
    lz4 ^
    ipykernel ^
    ipywidgets ^
    joblib ^
    jupyter_client ^
    mock ^
    psutil ^
    pytest ^
    python=%PYTHON% ^
    requests ^
    toolz ^
    tblib ^
    tornado=4.5 ^
    zict ^
    -c conda-forge

call activate %CONDA_ENV%

%CONDA% uninstall -q -y --force dask joblib zict
%PIP_INSTALL% git+https://github.com/dask/dask --upgrade
%PIP_INSTALL% git+https://github.com/joblib/joblib.git --upgrade
%PIP_INSTALL% git+https://github.com/dask/zict --upgrade

%PIP_INSTALL% pytest-repeat pytest-timeout pytest-faulthandler sortedcollections
%PIP_INSTALL% msgpack

@rem Display final environment (for reproducing)
%CONDA% list
%CONDA% list --explicit
where python
where pip
pip list
python -m site

@rem The cmd /C hack circumvents a regression where conda installs a conda.bat
@rem script in non-root environments.
set CONDA=cmd /C conda
set CONDA_INSTALL=%CONDA% install -q -y
set PIP_INSTALL=pip install -q

@echo on

@rem Deactivate any environment
call deactivate
@rem Update conda
%CONDA% update -q -y conda
@rem Display root environment (for debugging)
%CONDA% list
@rem Clean up any left-over from a previous build
%CONDA% remove --all -q -y -n %CONDA_ENV%

@rem Create test environment
@rem (note: no cytoolz as it seems to prevent faulthandler tracebacks on crash)
%CONDA% create -n %CONDA_ENV% -q -y ^
    bokeh ^
    click ^
    cloudpickle ^
    dask ^
    dill ^
    futures ^
    lz4 ^
    ipykernel ^
    ipywidgets ^
    joblib ^
    jupyter_client ^
    mock ^
    msgpack-python ^
    psutil ^
    pytest ^
    python=%PYTHON% ^
    requests ^
    toolz ^
    tblib ^
    tornado=4.5 ^
    zict ^
    -c conda-forge

call activate %CONDA_ENV%

%CONDA% uninstall -q -y --force dask joblib zict
%PIP_INSTALL% git+https://github.com/dask/dask --upgrade
%PIP_INSTALL% git+https://github.com/joblib/joblib.git --upgrade
%PIP_INSTALL% git+https://github.com/dask/zict --upgrade

%PIP_INSTALL% pytest-repeat pytest-timeout pytest-faulthandler sortedcollections

@rem Display final environment (for reproducing)
%CONDA% list
%CONDA% list --explicit
where python
where pip
pip list
python -m site

Install msgpack-python with conda on AppVeyor. (#2075)

This is a cleanup of the mspack-python to msgpack renaming on PyPI.


start javaw -jar TSPReadCoordinatesFromFile.jar
::java -jar TSPReadCoordinatesFromFile.jar
pause;

Update runTSPReadFromFileCoordinatesJar.bat

Minor changes. Remove unneeded ";" character.


@REM
@REM To build the installer, you will need the WiX Toolset, available at
@REM http://wixtoolset.org/
@REM
@REM To build the zip distribution, the 7za command line utility (7za.exe) from
@REM the 7-Zip Extra package must be present in this script's folder:
@REM http://www.7-zip.org/download.html
@REM

@ECHO OFF
TITLE 3RVX Installer Builder
ECHO "   _____ ______     ____  _______   "
ECHO "  |___ /|  _ \ \   / /\ \/ /___ /   "
ECHO "    |_ \| |_) \ \ / /  \  /  |_ \   "
ECHO "   ___) |  _ < \ V /   /  \ ___) |  "
ECHO "  |____/|_| \_\ \_/   /_/\_\____/   "
ECHO "                                    "

ECHO This script will generate a 3RVX installer.
set /p version= "Enter 3RVX Version (X.X): "
ECHO.

ECHO Setting Version: %version%
ECHO.

ECHO Setting PATH...
ECHO ON

set PATH=%PATH%;%WIX%\bin
heat dir ../Release -gg -srd -cg 3RVXComponents -dr INSTALLFOLDER -out 3RVXComponents.wxs
candle -pedantic -dProductVersion=%version%.0.0 ./3RVX.wxs ./3RVXComponents.wxs
light -b ../Release -ext WixUIExtension ./3RVX.wixobj ./3RVXComponents.wixobj -o 3RVX-%version%.msi
del 3RVX.wixobj 3RVX.wixpdb 3RVXComponents.wxs 3RVXComponents.wixobj

@ECHO OFF
ECHO.
ECHO.
IF EXIST "7za.exe" (
	ECHO Creating .zip distribution...
	ECHO.
	ECHO ON
	del 3RVX-%version%.zip
	copy "..\Assets\EmptySettings.xml" "..\Release\Settings.xml"
	7za a -tzip -mx9 3RVX-%version%.zip ../Release/*
)

@ECHO OFF
ECHO.

PAUSE

@REM
@REM To build the installer, you will need the WiX Toolset, available at
@REM http://wixtoolset.org/
@REM
@REM To build the zip distribution, the 7za command line utility (7za.exe) from
@REM the 7-Zip Extra package must be present in this script's folder:
@REM http://www.7-zip.org/download.html
@REM

@ECHO OFF
TITLE 3RVX Installer Builder
ECHO "   _____ ______     ____  _______   "
ECHO "  |___ /|  _ \ \   / /\ \/ /___ /   "
ECHO "    |_ \| |_) \ \ / /  \  /  |_ \   "
ECHO "   ___) |  _ < \ V /   /  \ ___) |  "
ECHO "  |____/|_| \_\ \_/   /_/\_\____/   "
ECHO "                                    "

ECHO This script will generate a 3RVX installer.
set /p version= "Enter 3RVX Version (X.X.X): "
ECHO.

ECHO Setting Version: %version%
ECHO.

ECHO Setting PATH...
ECHO ON

set PATH=%PATH%;%WIX%\bin
heat dir ../Release -gg -srd -cg 3RVXComponents -dr INSTALLFOLDER -out 3RVXComponents.wxs
candle -pedantic -dProductVersion=%version%.0 ./3RVX.wxs ./3RVXComponents.wxs
light -b ../Release -ext WixUIExtension ./3RVX.wixobj ./3RVXComponents.wixobj -o 3RVX-%version%.msi
del 3RVX.wixobj 3RVX.wixpdb 3RVXComponents.wxs 3RVXComponents.wixobj

@ECHO OFF
ECHO.
ECHO.
IF EXIST "7za.exe" (
	ECHO Creating .zip distribution...
	ECHO.
	ECHO ON
	del 3RVX-%version%.zip
	copy "..\Assets\EmptySettings.xml" "..\Release\Settings.xml"
	7za a -tzip -mx9 3RVX-%version%.zip ../Release/*
)

@ECHO OFF
ECHO.

PAUSE

Add support for 3-number versions (major, minor, revision)


@echo off
set RC=
setlocal

if "%1" == "" (
echo ERROR: Please specify a build target: Debug or Release
set ERRORLEVEL=1
goto end
)

if "%2" == "" (
set PROJECT_NAME=cefclient
) else (
set PROJECT_NAME=%2
)

echo Configuring Visual Studio environment...
if "%GYP_MSVS_VERSION%" == "2008" (
call "%VS90COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcproj
) else (
call "%VS100COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcxproj
)

if exist "%DevEnvDir%\devenv.com" (
echo Building %1 target for %PROJECT_NAME% project...
"%DevEnvDir%\devenv.com" /build %1 ..\cef.sln /project %PROJECT_NAME%%PROJECT_EXT%
) else if exist "%VCINSTALLDIR%\vcpackages\vcbuild.exe" (
echo Building %1 target for all projects...
"%VCINSTALLDIR%\vcpackages\vcbuild.exe" ..\cef.sln "%1|Win32"
) else (
echo ERROR: Cannot find Visual Studio builder
set ERRORLEVEL=1
)

:end
endlocal & set RC=%ERRORLEVEL%
goto omega

:returncode
exit /B %RC%

:omega
call :returncode %RC%

@echo off
set RC=
setlocal

if "%1" == "" (
echo ERROR: Please specify a build target: Debug or Release
set ERRORLEVEL=1
goto end
)

if "%2" == "" (
set PROJECT_NAME=cefclient
) else (
set PROJECT_NAME=%2
)

echo Configuring Visual Studio environment...
if "%GYP_MSVS_VERSION%" == "2008" (
call "%VS90COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcproj
) else (
call "%VS100COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcxproj
set CEF_MSBUILD_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
)

if exist "%CEF_MSBUILD_PATH%" (
"%CEF_MSBUILD_PATH%" /v:m /p:Configuration=%1;Platform=Win32 /t:"%PROJECT_NAME%" ..\cef.sln
) else if exist "%DevEnvDir%\devenv.com" (
echo Building %1 target for %PROJECT_NAME% project...
"%DevEnvDir%\devenv.com" /build %1 ..\cef.sln /project %PROJECT_NAME%%PROJECT_EXT%
) else if exist "%VCINSTALLDIR%\vcpackages\vcbuild.exe" (
echo Building %1 target for all projects...
"%VCINSTALLDIR%\vcpackages\vcbuild.exe" ..\cef.sln "%1|Win32"
) else (
echo ERROR: Cannot find Visual Studio builder
set ERRORLEVEL=1
)

:end
endlocal & set RC=%ERRORLEVEL%
goto omega

:returncode
exit /B %RC%

:omega
call :returncode %RC%

Windows: Update build_projects.bat to use MSBuild if available (issue #688).


C:\MinGW\bin\g++ -I%LIBRARY_INC% -o test test.cc

test.exe

Test with MinGW instead.

eigen: Test with MinGW instead.


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

add bld.bat

add bld.bat


@echo off
setlocal

REM ---------------------------------------------------------------------------
set ROOT=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :CLEANUP
)

REM ---------------------------------------------------------------------------
pushd "%ROOT%"

REM Check access priviledge
if exist ".\makelinks.tmp" del ".\makelinks.tmp"
(mklink ".\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Administrator priviledge needed.
    goto :CLEANUP
)

set DOTVIM=.vim
call :MAIN
set DOTVIM=_vim
call :MAIN

:CLEANUP
del ".\makelinks.tmp" > NUL
popd
goto :EOF

REM ---------------------------------------------------------------------------
:MAIN
    call :MAKE_SYMLINK "%USERPROFILE%\%DOTVIM%rc" "%ROOT%.vimrc"
    call :ENSURE_DIR "%USERPROFILE%\%DOTVIM%"
    call :ENSURE_DIR "%USERPROFILE%\%DOTVIM%\ftplugin"
    for %%I in (.vim\ftplugin\*.vim) do (
        call :MAKE_SYMLINK "%USERPROFILE%\%DOTVIM%\ftplugin\%%~nxI" "%%~fI"
    )
    exit /b 0

:MAKE_SYMLINK
    del /q "%~1" 2> NUL
    mklink "%~f1" "%~f2" > NUL
    echo mklink "%~f1" "%~f2"
    exit /b 0

:ENSURE_DIR
    if not exist "%~1" (
        mkdir "%~1"
        echo mkdir "%~f1"
    )
    exit /b 0

@echo off
setlocal EnableExtensions

REM ---------------------------------------------------------------------------
set ROOT=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :CLEANUP
)

REM ---------------------------------------------------------------------------
pushd "%ROOT%"

REM Check access priviledge
if exist ".\makelinks.tmp" del ".\makelinks.tmp"
(mklink ".\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Administrator priviledge needed.
    goto :CLEANUP
)

call :MKLINK "%USERPROFILE%\_vimrc" "%ROOT%.vimrc"
call :MKDIR "%USERPROFILE%\_vim"
call :MKDIR "%USERPROFILE%\_vim\ftplugin"
for %%I in (.vim\ftplugin\*.vim) do (
    call :MKLINK "%USERPROFILE%\_vim\ftplugin\%%~nxI" "%%~fI"
)

:CLEANUP
del ".\makelinks.tmp" > NUL
popd
goto :EOF

REM ---------------------------------------------------------------------------
:MKLINK
    if exist "%~1" del /q "%~1"
    mklink "%~1" "%~2" > NUL
    echo New link: %~1
    exit /b 0

:MKDIR
    if not exist "%~1" (
        mkdir "%~1"
        echo New dir: %~1
    )
    exit /b 0

Update makelinks.bat

Update makelinks.bat