Makefile fixes and new `make deps' rule

Review 1773 by @larkost
Closes #2685
Closes #2209
Patch the phony list

Review 1781 by @larkost
Merge atnnn/2209 into next