Autotools: configure/make
If you are using configure/make you can use the AutoToolsBuildEnvironment helper.
This helper sets LIBS, LDFLAGS, CFLAGS, CXXFLAGS and CPPFLAGS environment variables based on your requirements.
Check Building with Autotools for more info.