Thanks for reporting that problem. I wonder why GNU 'make' sets stdout to append mode? That surprises me, and I don't see where POSIX allows it. Anyway, it's clearly a bug in 'grep' no matter what 'make' is doing. I wrote up a test case for the bug and installed the attached, which is a bit more conservative than the patch you submitted.