Index: contrib/bmake/parse.c =================================================================== --- contrib/bmake/parse.c +++ contrib/bmake/parse.c @@ -309,6 +309,9 @@ { ".WAIT", SP_WAIT, OP_NONE }, }; +#ifdef POSIX +static int dot_POSIX_valid = 0; +#endif static IncludedFile * GetInclude(size_t i) @@ -1267,6 +1270,8 @@ break; #ifdef POSIX case SP_POSIX: + if (!dot_POSIX_valid) + break; Global_Set("%POSIX", "1003.2"); { static bool first_posix = true; @@ -2898,6 +2903,9 @@ char *line; Buffer buf; +#ifdef POSIX + dot_POSIX_valid = 1; +#endif buf = loadfile(name, fd != -1 ? fd : STDIN_FILENO); if (fd != -1) (void)close(fd); @@ -2911,6 +2919,9 @@ DEBUG2(PARSE, "Parsing line %u: %s\n", CurFile()->lineno, line); ParseLine(line); +#ifdef POSIX + dot_POSIX_valid = 0; +#endif } /* Reached EOF, but it may be just EOF of an include file. */ } while (ParseEOF());