Here it seemed that the library doesn't belong into $out, so I left most in $out and separated $lib (and $doc).