Fixed some wrong Makefile target dependencies and enhances error reporting