    putInfo "cleaning files"
    liftIO $ removeFiles "build" ["*.o", "*.a"]

  phony "build_cpp" $ do
    putInfo "building cpp files"
    dir <- liftIO getCurrentDirectory
    csrcFiles <- liftIO . listDirectory $ dir </> "csrc"
    let cppFiles = filter (isExtensionOf "cpp") csrcFiles
        cppFilesO = map (overFileName $ (-<.> "o")) cppFiles
    _ <- need $ map (flip replaceDirectory "build") cppFilesO
    need ["buildLib"]

overFileName :: (String -> String) -> FilePath -> FilePath
overFileName f p = replaceFileName p . f . takeFileName $ p