summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--read.c7
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/scripts/targets/POSIX25
4 files changed, 41 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d93d61..aa2e517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-09 Paul Smith <psmith@gnu.org>
+
+ * read.c (record_files): Reset the default macro values if .POSIX
+ is set. Fixes Savannah bug #37069.
+
2012-09-01 Eli Zaretskii <eliz@gnu.org>
* README.W32.template: Update for job-server and Guile support.
diff --git a/read.c b/read.c
index f075ef5..7f6939e 100644
--- a/read.c
+++ b/read.c
@@ -1962,6 +1962,13 @@ record_files (struct nameseq *filenames, const char *pattern,
{
posix_pedantic = 1;
define_variable_cname (".SHELLFLAGS", "-ec", o_default, 0);
+ /* These default values are based on IEEE Std 1003.1-2008. */
+ define_variable_cname ("ARFLAGS", "-rv", o_default, 0);
+ define_variable_cname ("CC", "c99", o_default, 0);
+ define_variable_cname ("CFLAGS", "-O", o_default, 0);
+ define_variable_cname ("FC", "fort77", o_default, 0);
+ define_variable_cname ("FFLAGS", "-O 1", o_default, 0);
+ define_variable_cname ("SCCSGETFLAGS", "-s", o_default, 0);
}
else if (streq (name, ".SECONDEXPANSION"))
second_expansion = 1;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 554ffc6..f9585e6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-09 Paul Smith <psmith@gnu.org>
+
+ * scripts/targets/POSIX: Add tests for default macro values as
+ specified by IEEE Std 1003.1-2008. See Savannah bug #37069.
+
2012-03-04 Paul Smith <psmith@gnu.org>
* scripts/features/se_explicit: Test $(x:%=%) format in secondary
diff --git a/tests/scripts/targets/POSIX b/tests/scripts/targets/POSIX
index 35c59b1..a24e3bc 100644
--- a/tests/scripts/targets/POSIX
+++ b/tests/scripts/targets/POSIX
@@ -1,6 +1,6 @@
# -*-perl-*-
-$description = "Test the behaviour of the .PHONY target.";
+$description = "Test the behaviour of the .POSIX target.";
$details = "";
@@ -30,5 +30,28 @@ all: ; \@$script
!,
'', $out);
+# Test the default value of various POSIX-specific variables
+my %POSIX = (AR => 'ar', ARFLAGS => '-rv',
+ YACC => 'yacc', YFLAGS => '',
+ LEX => 'lex', LFLAGS => '',
+ LDFLAGS => '',
+ CC => 'c99', CFLAGS => '-O',
+ FC => 'fort77', FFLAGS => '-O 1',
+ GET => 'get', GFLAGS => '',
+ SCCSFLAGS => '', SCCSGETFLAGS => '-s');
+my $make = join('', map { "\t\@echo '$_=\$($_)'\n" } sort keys %POSIX);
+my $r = join('', map { "$_=$POSIX{$_}\n"} sort keys %POSIX);
+run_make_test(qq!
+.POSIX:
+all:
+$make
+!,
+ '', $r);
+
+# Make sure that local settings take precedence
+%extraENV = map { $_ => "xx-$_" } keys %POSIX;
+$r = join('', map { "$_=xx-$_\n"} sort keys %POSIX);
+run_make_test(undef, '', $r);
+
# This tells the test driver that the perl test script executed properly.
1;