Allow custom CFLAGS, CPPFLAGS, LDFLAGS, and CC variables

Extend CFLAGS and LDFLAGS instead of overriding them, use CPPFLAGS, and
don't override CC.

This allows setting custom optimizations, security features, and
compilers.