Oops. Nowadays I try to avoid writing build scripts by hand and use tools/meta-languages that autogenerate the scripts/commands and that query the system in question to optimize the resource usage.