diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/make.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index 111ab2914..daad75f5c 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -1120,7 +1120,11 @@ process_line(char *s) | |||
1120 | r = s; | 1120 | r = s; |
1121 | 1121 | ||
1122 | // Strip comment | 1122 | // Strip comment |
1123 | t = strchr(s, '#'); | 1123 | // don't treat '#' in macro expansion as a comment |
1124 | if (!posix) | ||
1125 | t = find_char(s, '#'); | ||
1126 | else | ||
1127 | t = strchr(s, '#'); | ||
1124 | if (t) | 1128 | if (t) |
1125 | *t = '\0'; | 1129 | *t = '\0'; |
1126 | 1130 | ||
@@ -1401,9 +1405,18 @@ static char * | |||
1401 | process_command(char *s) | 1405 | process_command(char *s) |
1402 | { | 1406 | { |
1403 | char *t, *u; | 1407 | char *t, *u; |
1404 | int len = strlen(s) + 1; | 1408 | int len; |
1405 | char *outside = xzalloc(len); | 1409 | char *outside; |
1410 | |||
1411 | if (posix) { | ||
1412 | // POSIX strips comments from command lines | ||
1413 | t = strchr(s, '#'); | ||
1414 | if (t) | ||
1415 | *t = '\0'; | ||
1416 | } | ||
1406 | 1417 | ||
1418 | len = strlen(s) + 1; | ||
1419 | outside = xzalloc(len); | ||
1407 | for (t = skip_macro(s); *t; t = skip_macro(t + 1)) { | 1420 | for (t = skip_macro(s); *t; t = skip_macro(t + 1)) { |
1408 | outside[t - s] = 1; | 1421 | outside[t - s] = 1; |
1409 | } | 1422 | } |