summaryrefslogtreecommitdiff
path: root/tests/scripts/targets/POSIX
blob: bd71686135f9ca29281b3a078bb50e47a2c0f516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#                                                                    -*-perl-*-

$description = "Test the behaviour of the .POSIX target.";

$details = "";


# Ensure turning on .POSIX enables the -e flag for the shell

run_make_test(qq!
.POSIX:
all: ; \@#HELPER# -q fail 1; true
!,
              '', "#MAKE#: *** [#MAKEFILE#:3: all] Error 1\n", 512);

# User settings must override .POSIX
# In the standard .POSIX must be the first thing in the makefile
# but we relax that rule in GNU Make.
run_make_test(qq!
.SHELLFLAGS = -xc
.POSIX:
all: ; \@#HELPER# -q fail 1; true
!,
              '', "+ #HELPER# -q fail 1\n+ true\n");

# 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 => '-O1',
             FC => 'fort77', FFLAGS => '-O1',
             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
%ENV = (%ENV, 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;