update main.mk from coreutils, with small tweaks: