[SV 62654] Support GNU Make on z/OS

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.
This commit is contained in:
Paul Smith
2023-01-07 21:50:59 -05:00
parent 0de7a0d3bf
commit 11444fb001
21 changed files with 201 additions and 43 deletions

View File

@@ -212,7 +212,7 @@ if ($osname eq 'VMS') {
# Check long names for archive members.
# See Savannah bug #54395
if ($osname ne 'VMS') {
if ($osname ne 'VMS' && $osname ne 'os390') {
my $pre = '1234567890123456';
my $lib = 'libxx.a';
my $cr = $created;
@@ -238,6 +238,9 @@ $pre%: ; touch \$\@
# SV 61436 : Allow redefining archive rules to propagate timestamps
# These don't work right on z/OS for some reason: archives not fully supported?
if ($osname ne 'os390') {
# Find the output when creating an archive from multiple files
utouch(-10, 'a.o', 'b.o');
@@ -246,6 +249,9 @@ touch('b.o');
my $add2 = `$ar $arflags mylib.a b.o $redir`;
unlink('a.o', 'b.o', 'mylib.a');
# Some systems complain when compiling empty files
create_file('a.c', 'int i;');
create_file('b.c', 'int j;');
utouch(-20, 'a.c', 'b.c');
run_make_test(q!
@@ -267,6 +273,7 @@ run_make_test(undef, $arvar, "Compile b.c\n$ar $arflags mylib.a b.o\n${add2}rm b
run_make_test(undef, $arvar, "#MAKE#: 'mylib.a' is up to date.");
unlink('a.c', 'b.c', 'a.o', 'b.o', 'mylib.a');
}
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -360,8 +360,8 @@ use POSIX ();
# file.
run_make_test(q!
pid:=$(shell echo $$PPID)
all:; @#HELPER# term $(pid) sleep 10
!, '-O -j2', '/#MAKE#: \*\*\* \[#MAKEFILE#:3: all] Terminated/', POSIX::SIGTERM);
all:; @#HELPER# -q term $(pid) sleep 10
!, '-O -j2', '#MAKE#: *** [#MAKEFILE#:3: all] Terminated', POSIX::SIGTERM);
}
unlink($fout);

View File

@@ -19,10 +19,14 @@ 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 \'\043\'
hash != printf \'' . $hashOctal . '\'
foo2!= echo "bar$(hash)baz"
all: ; @echo "<$(foo1)> <$(hash)> <$(foo2)>"

View File

@@ -67,13 +67,15 @@ use POSIX ();
&utouch(-600, 'bye.mk');
close(STDIN);
open(STDIN, "<", 'input.mk') || die "$0: cannot open input.mk for reading: $!";
run_make_test(q!
include bye.mk
pid:=$(shell echo $$PPID)
pid := $(shell echo $$PPID)
all:;
bye.mk: force; @#HELPER# term $(pid) sleep 10
bye.mk: force; @#HELPER# -q term $(pid) sleep 10
force:
!, '-f-', '/#MAKE#: \*\*\* \[#MAKEFILE#:5: bye.mk] Terminated/', POSIX::SIGTERM);
!,
'-f-', '#MAKE#: *** [#MAKEFILE#:5: bye.mk] Terminated', POSIX::SIGTERM);
}
unlink($fout);