Consolidated and improved makefiles

Made batch build and testing simpler. Added clean, rebuild, test
targets.