dedup some code
cabalise
Makefile slightly cabalised