diff options
-rw-r--r-- | miscutils/make.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index deb04ec88..8394c4e7b 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -750,10 +750,12 @@ is_valid_macro(const char *name) | |||
750 | for (s = name; *s; ++s) { | 750 | for (s = name; *s; ++s) { |
751 | // In POSIX mode only a limited set of characters are guaranteed | 751 | // In POSIX mode only a limited set of characters are guaranteed |
752 | // to be allowed in macro names. | 752 | // to be allowed in macro names. |
753 | if (posix && | 753 | if (posix) { |
754 | ((pragma & P_MACRO_NAME) || !POSIX_2017 ? | 754 | // Find the appropriate character set |
755 | !isfname(*s) : !ispname(*s))) | 755 | if ((pragma & P_MACRO_NAME) || !POSIX_2017 ? |
756 | !isfname(*s) : !ispname(*s)) | ||
756 | return FALSE; | 757 | return FALSE; |
758 | } | ||
757 | // As an extension allow anything that can get through the | 759 | // As an extension allow anything that can get through the |
758 | // input parser, apart from the following. | 760 | // input parser, apart from the following. |
759 | if (*s == '=' || isblank(*s) || iscntrl(*s)) | 761 | if (*s == '=' || isblank(*s) || iscntrl(*s)) |
@@ -1993,6 +1995,10 @@ input(FILE *fd, int ilevel) | |||
1993 | if (p == NULL || gettok(&q)) { | 1995 | if (p == NULL || gettok(&q)) { |
1994 | error("one include file per line"); | 1996 | error("one include file per line"); |
1995 | } | 1997 | } |
1998 | } else if (makefile == old_makefile) { | ||
1999 | // In POSIX 202X no include file is unspecified behaviour. | ||
2000 | if (posix) | ||
2001 | error("no include file"); | ||
1996 | } | 2002 | } |
1997 | 2003 | ||
1998 | makefile = old_makefile; | 2004 | makefile = old_makefile; |
@@ -3071,12 +3077,12 @@ int make_main(int argc UNUSED_PARAM, char **argv) | |||
3071 | setmacro("$", "$", 0 | M_VALID); | 3077 | setmacro("$", "$", 0 | M_VALID); |
3072 | 3078 | ||
3073 | // Process macro definitions from the command line | 3079 | // Process macro definitions from the command line |
3074 | if (posix) | 3080 | if (!posix) |
3081 | process_macros(argv, 1); | ||
3082 | else | ||
3075 | // In POSIX mode macros must appear before targets. | 3083 | // In POSIX mode macros must appear before targets. |
3076 | // argv should now point to targets only. | 3084 | // argv should now point to targets only. |
3077 | argv = process_macros(argv, 1); | 3085 | argv = process_macros(argv, 1); |
3078 | else | ||
3079 | process_macros(argv, 1); | ||
3080 | 3086 | ||
3081 | // Process macro definitions from MAKEFLAGS | 3087 | // Process macro definitions from MAKEFLAGS |
3082 | if (fargv) { | 3088 | if (fargv) { |