I made a couple changes that might be useful..

* Fixed it to work on amd64 gentoo, by adding some missing flags (extra LD search path)
* Added support for target names != folder name