Convert make-* scripts to functions