Fix warnings and add deps

This pulls in several changes:
  - Warning cleanup (code is now 100% clean on Linux and NaCl)
  - NaCl builds fixes
  - automatic dependency generation on NaCl and Linux.

(I promise not to re-write the pull request this time :)