Add defaults array to generated makefile, and fix up some places where generate fails (e.g. if there are no modules).