better MAKEFLAGS algorithm