build: support an install target

And refactor CXXFLAGS and LDFLAGS.