Added Makefile bugfixes, gen script dep checking