buildall: Rewrite to be more generic

Signed-off-by: David Vincent <freesilicon@gmail.com>