Moved the bulk of the makefile to toolchain to keep it DRY.