summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-03-24 21:29:00 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-03-24 21:34:59 +0300
commit036ccd8efa9ca16734b8baf4cc022eacb5d78576 (patch)
tree9338084f941380ef56eda8e52042652d5690656d
parent87e2dd5c98e7bdd770914c2404efd8194778fc93 (diff)
downloadgunmake-036ccd8efa9ca16734b8baf4cc022eacb5d78576.tar.gz
Support SunOS make target-specific variables
-rw-r--r--read.c7
-rw-r--r--tests/scripts/features/sun-targetvars23
-rw-r--r--variable.c3
3 files changed, 32 insertions, 1 deletions
diff --git a/read.c b/read.c
index e67d386..38cdbdd 100644
--- a/read.c
+++ b/read.c
@@ -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;
diff --git a/variable.c b/variable.c
index 0b89d37..207b6d8 100644
--- a/variable.c
+++ b/variable.c
@@ -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 '+':