updated makefiles to not rebuild without need, added global makefile

Remade it with the changes and added more cleanup rules, now the checks are blazing fast.