@mkdir .shake 2> nul

@set ghcArgs=--make            ^
             -Wall             ^
             src/Main.hs       ^
             -isrc             ^
             -rtsopts          ^
             -with-rtsopts=-I0 ^
             -outputdir=.shake ^
             -j                ^
             -O                ^
             -o .shake/build

@set shakeArgs=--lint      ^
               --directory ^
               ".."        ^
               %*

@rem Unset GHC_PACKAGE_PATH variable, as otherwise ghc-cabal complains
@set GHC_PACKAGE_PATH=

@ghc %ghcArgs% && .shake\build %shakeArgs%

@mkdir .shake 2> nul

@set ghcArgs=--make            ^
             -Wall             ^
             src/Main.hs       ^
             -isrc             ^
             -rtsopts          ^
             -with-rtsopts=-I0 ^
             -outputdir=.shake ^
             -j                ^
             -O                ^
             -o .shake/build

@set shakeArgs=--lint      ^
               --directory ^
               ".."        ^
               %*


@ghc %ghcArgs%

@if %ERRORLEVEL% EQU 0 (
    @rem Unset GHC_PACKAGE_PATH variable, as otherwise ghc-cabal complains
    @set GHC_PACKAGE_PATH=
    @.shake\build %shakeArgs%
)

Reset GHC_PACKAGE_PATH varialbe (5th try).
Reset GHC_PACKAGE_PATH varialbe (5th try).

See #110.
