diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index e8a9935fcd2..9cbef992955 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -2021,6 +2021,13 @@ ParseSkipLine(int skip, int keep_newline) while (((c = ParseReadc()) != '\n' || lastc == '\\') && c != EOF) { + if (skip && c == '#' && lastc != '\\') { + /* let a comment be terminated even by an escaped \n. + * This is consistent to comment handling in ParseReadLine */ + while ((c = ParseReadc()) != '\n' && c != EOF) + ; + break; + } if (c == '\n') { if (keep_newline) Buf_AddByte(buf, (Byte)c);