Correct use of CFLAGS and LIBS in Makefiles

The Makefiles in some cases were mixing up CFLAGS and LIBS, causing
unnecessary warnings when building under OSX. This fixes the affected
Makefiles.