getBuildDirectories
    :: TargetTool
    -> PackageDescription
    -> FilePath
    -> IO ([FilePath], FilePath)
getBuildDirectories tool pkgDesc cabalDir = do
    distDir' <- distDir tool
    let buildDir :: FilePath
        buildDir   = cabalDir </> distDir' </> "build"
        autogenDir :: FilePath
        autogenDir = buildDir </> "autogen"
        executableBuildDir :: Executable -> FilePath
        executableBuildDir e = buildDir </> getExeName e </> (getExeName e ++ "-tmp")
        buildDirs :: [FilePath]
        buildDirs = autogenDir : map executableBuildDir (executables pkgDesc)

        buildDirs' = case library pkgDesc of
            Just _  -> buildDir : buildDirs
            Nothing -> buildDirs
    return (buildDirs', autogenDir)
getBuildDirectories
    :: TargetTool
    -> PackageDescription
    -> FilePath
    -> IO ([FilePath], FilePath)
getBuildDirectories tool pkgDesc cabalDir = do
    distDir' <- distDir tool
    let buildDir :: FilePath
        buildDir   = cabalDir </> distDir' </> "build"
        autogenDir :: FilePath
        autogenDir = buildDir </> "autogen"
        executableBuildDir :: Executable -> FilePath
        executableBuildDir e = buildDir </> getExeName e </> (getExeName e ++ "-tmp")
        buildDirs :: [FilePath]
        buildDirs = autogenDir : map executableBuildDir (executables pkgDesc)

        buildDirs' = case library pkgDesc of
            Just _  -> buildDir : buildDirs
            Nothing -> buildDirs
    return (buildDirs', autogenDir)
getBuildDirectories tool pkgDesc cabalDir = do
    distDir' <- distDir tool
    let buildDir :: FilePath
        buildDir   = cabalDir </> distDir' </> "build"
        autogenDir :: FilePath
        autogenDir = buildDir </> "autogen"
        executableBuildDir :: Executable -> FilePath
        executableBuildDir e = buildDir </> getExeName e </> (getExeName e ++ "-tmp")
        buildDirs :: [FilePath]
        buildDirs = autogenDir : map executableBuildDir (executables pkgDesc)

        buildDirs' = case library pkgDesc of
            Just _  -> buildDir : buildDirs
            Nothing -> buildDirs
    return (buildDirs', autogenDir)