Avoid hardcoding compiler/flags

Also, `CC` and `CFLAGS` are meant to be used for C projects, right? For C++, `CXX` and `CXXFLAGS` should be used instead. This patch changes that. Or am I missing something here?

This would be preferable for the Homebrew formula; see https://github.com/Homebrew/homebrew/pull/28443. But of course, feel free to close this if this change would hinder your workflow in any way.