Fix a bunch of missing dependencies and makefile problems