Added proper compilation as a library and updated doc accordingly.