Fix output directory determination logic in the Erlang/Elixir libraries.

Also, pass stuff via attributes to the recipe function, since it
cannot access stuff in the outer scope.
Document attributes reserved for use by libraries.
Error out if a recipe does not produce a target file as expected.