Make build more configurable via cmd line options.

The script now uses the bash getops builtin to parse its command line.