@echo off
if exist bin\packed.upx goto end

if not "%_CWD%"=="" cdd %0
if not "%CD%"=="" for %%a in (%0) do cd /d %%~dpa

echo.
echo This packs to 3.5 MB instead of 6 MB of HD space (+ runs faster on FAT).
echo.
echo (Press Ctrl-C to abort, else any other key to continue)
pause

if exist bin\djtar.exe bin\stubify.exe bin\djtar.exe
if exist gcc\bin\djtar.exe gcc\bin\stubify.exe gcc\bin\djtar.exe

::upx --best --lzma --all-filters --small .../*.exe
upx -4 .../cc1.exe
upx --best .../*.exe

:: Only DOS' UPX supports ".../" globbing (thanks to DJGPP).
::
:: wget http://upx.sourceforge.net/download/upx303d.zip
:: wget http://rugxulo.googlepages.com/upx303d.bat

echo .EXEs Compressed by UPX! http://upx.sf.net >> bin\packed.upx

:end
