@echo off

:: clear TERMINATE environment variable
set TERMINATE= 

:: show a welcome message
echo\
echo Portable WinAVR by www.chip45.com
echo ---------------------------------
echo Erik Lins (erik.lins@chip45.com)
echo\
echo Based on the WinAVR-20090313 distribution
echo by Eric B. Weddington
echo (see Portable\WinAVR\WinAVR-user-manual.html)
echo\
echo\

:: now search the Portable WinAVR installation
echo Searching Portable WinAVR installation...

for %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%d:\Portable\here.it.is set DRIVE=%%d

if %DRIVE% == "" goto notfound

echo Found installation on drive %DRIVE%:
echo\

:: set environment variables for WinAVR toolset
set PORTABLEWINAVR=%DRIVE%:\Portable\WinAVR-20090313
set PATH=%PORTABLEWINAVR%\bin;%PORTABLEWINAVR%\utils\bin;%PATH%
set GCC_ROOT=%PORTABLEWINAVR%
set BINUTILS_ROOT=%PORTABLEWINAVR%
set G++_ROOT=%PORTABLEWINAVR%
if exist %DRIVE%:\projects\avrlib set AVRLIB=%DRIVE%:\projects\avrlib
if exist %DRIVE%:\Portable\bin set PATH=%DRIVE%:\Portable\bin;%PATH%

goto end

:notfound
echo Could not find Portable WinAVR installation!
set TERMINATE=yes

:end
