aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/make.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index f44de5df6..0235d9877 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -3156,16 +3156,25 @@ int make_main(int argc UNUSED_PARAM, char **argv)
3156 if (!POSIX_2017) 3156 if (!POSIX_2017)
3157 mark_special(".PHONY", OPT_phony, N_PHONY); 3157 mark_special(".PHONY", OPT_phony, N_PHONY);
3158 3158
3159 if (posix) {
3160 // In POSIX mode only targets should now be in argv.
3161 found_target = FALSE;
3162 for (char **a = argv; *a; a++) {
3163 if (!strchr(*a, '='))
3164 found_target = TRUE;
3165 else if (found_target)
3166 error("macro assignments must precede targets");
3167 }
3168 }
3169
3159 estat = 0; 3170 estat = 0;
3160 found_target = FALSE; 3171 found_target = FALSE;
3161 for (; *argv; argv++) { 3172 for (; *argv; argv++) {
3162 // In POSIX mode only targets should now be in argv. 3173 // Skip macro assignments.
3163 // As an extension macros may still be present: skip them. 3174 if (strchr(*argv, '='))
3164 if (posix || !strchr(*argv, '=')) 3175 continue;
3165 { 3176 found_target = TRUE;
3166 found_target = TRUE; 3177 estat |= make(newname(*argv), 0);
3167 estat |= make(newname(*argv), 0);
3168 }
3169 } 3178 }
3170 if (!found_target) { 3179 if (!found_target) {
3171 if (!firstname) 3180 if (!firstname)