Build system improvements.

Closes #1.