LDFLAGS is supposed to be given to CC not LD. Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD