Make the makefile care about whether the target is already up to date.

This patch will make it such that files will only be built if they weren't already done.

The previous file also had a bunch of rules which were pointless. Just use environment variables for variables instead of n\*m rules per variable.