mirror of
https://github.com/mirror/make.git
synced 2025-01-04 09:20:43 +08:00
11444fb001
Original patches provided by Igor Todorovski <itodorov@ca.ibm.com> Reworked by Paul Smith <psmith@gnu.org>. Thanks to IBM for providing a test system. * NEWS: Announce support. * AUTHORS: Ditto. * README.zOS: Provide details on building GNU Make on z/OS. * build.sh (get_mk_var): z/OS sh has a strange bug which causes it to generate extra lines of output: rework the function to print output as we compute it instead of collecting it into a variable, which works around this bug. * src/makeint.h: Declare MK_OS_ZOS if we're building for z/OS. * src/arscan.c: Don't include <ar.h> on z/OS. * src/job.c: We can't change environ in ASCII mode on z/OS. * src/main.c: Ditto. Also we can't use pselect() on z/OS. * src/posixos.c: pselect() seems to hang on z/OS: don't use it. * tests/run_make_tests.pl: Handle different exit codes on z/OS. * tests/test_driver.pl: Preserve some special z/OS env.vars. Add special checks to output comparisons when on z/OS. * tests/scripts/features/archives: Don't validate names. Don't try to compile empty files as IBM compilers complain. * tests/scripts/features/shell_assignment: Fix octal value of #. * tests/scripts/features/temp_stdin: Don't print "term". * tests/scripts/functions/shell: Handle shell exit codes. * tests/scripts/targets/ONESHELL: Ditto. * tests/scripts/targets/POSIX: sh -x prints differently. * tests/scripts/variables/SHELL: Ditto.
70 lines
1.8 KiB
Perl
70 lines
1.8 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test BSD-style shell assignments (VAR != VAL) for variables.";
|
|
|
|
$details = "";
|
|
|
|
# TEST 0: Basic shell assignment (!=).
|
|
|
|
run_make_test('
|
|
.POSIX:
|
|
|
|
demo1!=printf \' 1 2 3\n4\n\n5 \n \n 6\n\n\n\n\'
|
|
demo2 != printf \'7 8\n \'
|
|
demo3 != printf \'$$(demo2)\'
|
|
demo4 != printf \' 2 3 \n\'
|
|
demo5 != printf \' 2 3 \n\n\'
|
|
all: ; @echo "<$(demo1)> <$(demo2)> <$(demo3)> <$(demo4)> <${demo5}>"
|
|
',
|
|
'', "< 1 2 3 4 5 6 > <7 8 > <7 8 > < 2 3 > < 2 3 >\n");
|
|
|
|
# TEST 1: Handle '#' the same way as BSD make
|
|
$hashOctal = "\\043";
|
|
if ($osname eq 'os390') {
|
|
$hashOctal = "\\173";
|
|
}
|
|
|
|
run_make_test('
|
|
foo1!=echo bar#baz
|
|
hash != printf \'' . $hashOctal . '\'
|
|
foo2!= echo "bar$(hash)baz"
|
|
|
|
all: ; @echo "<$(foo1)> <$(hash)> <$(foo2)>"
|
|
',
|
|
'', "<bar> <#> <bar#baz>\n");
|
|
|
|
# TEST 2: shell assignment variables (from !=) should be recursive.
|
|
# Note that variables are re-evaluated later, so the shell can output
|
|
# a value like $(XYZZY) as part of !=. The $(XYZZY) will be EVALUATED
|
|
# when the value containing it is evaluated. On the negative side, this
|
|
# means if you don't want this, you need to escape dollar signs as $$.
|
|
# On the positive side, it means that shell programs can output macros
|
|
# that are then evaluated as they are traditionally evaluated.. and that
|
|
# you can use traditional macro evaluation semantics to implement !=.
|
|
|
|
run_make_test('
|
|
XYZZY = fiddle-dee-dee
|
|
dollar = $$
|
|
VAR3 != printf \'%s\' \'$(dollar)(XYZZY)\'
|
|
|
|
all: ; @echo "<$(VAR3)>"
|
|
',
|
|
'', "<fiddle-dee-dee>\n");
|
|
|
|
|
|
# TEST 3: Overrides invoke shell anyway; they just don't store the result
|
|
# in a way that is visible.
|
|
|
|
run_make_test('
|
|
|
|
override != echo abc > ,abc ; cat ,abc
|
|
|
|
all: ; @echo "<$(override)>" ; cat ,abc
|
|
',
|
|
'override=xyz', "<xyz>\nabc\n");
|
|
|
|
unlink(',abc');
|
|
|
|
|
|
1;
|