diff options
-rw-r--r-- | read.c | 7 | ||||
-rw-r--r-- | tests/scripts/features/sun-targetvars | 23 | ||||
-rw-r--r-- | variable.c | 3 |
3 files changed, 32 insertions, 1 deletions
@@ -1157,6 +1157,10 @@ eval (struct ebuffer *ebuf, int set_default) if (two_colon) p2++; + /* In sunmake mode ":=" means target-specific variable, not ":" */ + if (sun_flag && (*p2 == '=')) + p2++; + /* Test to see if it's a target-specific variable. Copy the rest of the buffer over, possibly temporarily (we'll expand it later if it's not a target-specific variable). PLEN saves the length @@ -2668,7 +2672,8 @@ get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length) case '=': ++p; - wtype = w_varassign; + /* In sunmake mode ":=" acts as ":" in normal mode. */ + wtype = sun_flag ? w_colon : w_varassign; break; } break; diff --git a/tests/scripts/features/sun-targetvars b/tests/scripts/features/sun-targetvars new file mode 100644 index 0000000..157973b --- /dev/null +++ b/tests/scripts/features/sun-targetvars @@ -0,0 +1,23 @@ +# -*-perl-*- +$description = "Check SunOS make target-specific assignment."; + +$details = "In SunOS make mode ':=' is used for target-specific variable, instead of ':' +Thus, ':=' cannot be used as variable assignment at all."; + +# SunOS make mode, $(other) is undefined: +run_make_test(' +FOO = true +all: other + @echo $(FOO) +other := FOO = false +other: + @echo $(FOO) $(other) +', +'--sun', +"false\ntrue\n"); + +# Same file, but in normal mode, $(other) is "FOO = false": +run_make_test(undef, '', "true FOO = false\ntrue\n"); + +# This tells the test driver that the perl test script executed properly. +1; @@ -1492,6 +1492,9 @@ parse_variable_definition (const char *p, struct variable *var) switch (c) { case ':': + /* In sunmake mode ":=" is not a variable assignment. */ + if (sun_flag) + return NULL; var->flavor = f_simple; break; case '+': |