Consolidate CFLAGS.
Add support for building libraries.