tweak some Makefile variable names to be more conventional

rename:
PREFIX -> prefix
LIBDIR -> libdir
INCDIR -> includedir

refactor CFLAGS and LDFLAGS to better work with user preferences:
ALL_CFLAGS and ALL_LDFLAGS for flags that are probably required
replace LDLIBS with ALL_LDFLAGS
SHARED_LDFLAGS for building the shared library
use ALL_CFLAGS everywhere CC is used, including for linking
test tweaks: separate failures from warnings, exit with error if any failures