Make it possible to generate source files in custom targets.
Made all unit tests pass again.