diff options
| author | skurtz97 <skurtz97@users.noreply.github.com> | 2026-11-25 16:03:29 -0600 |
|---|---|---|
| committer | skurtz97 <skurtz97@users.noreply.github.com> | 2026-11-25 16:03:29 -0600 |
| commit | 1708975b46be7ff06ac1a7bb2a6576114d6d89f4 (patch) | |
| tree | ffbe56c19eafd1ee98f406a190c1b24abd61dadf | |
| parent | 2f8f5c9e648a5a4db03270f8d4a8833a8f20b172 (diff) | |
| download | ztop-1708975b46be7ff06ac1a7bb2a6576114d6d89f4.tar.gz | |
Makefile: POSIX make, the one z/OS ships
| -rw-r--r-- | Makefile | 59 |
1 files changed, 36 insertions, 23 deletions
@@ -1,33 +1,53 @@ -# ztop -- storage areas on z/OS, at a glance. +# shellcheck disable=SC2283,SC2046,SC2068,SC1089 +# ^ our linter reads this as shell: `NAME = value` and `$(CFLAGS)` are make. +.POSIX: +.SUFFIXES: +.SUFFIXES: .c .s .o + +# ztop - what VSM has allocated, by subpool. +# +# make build ./ztop +# make apf build it and give the executable the APF bit +# make check run it against each area +# make clean remove what the targets above write +# +# z/OS only: VSMLIST and the PSA do not exist elsewhere, so `make` on +# another host says so and stops. This tree is kept on Linux as a backup. # -# z/OS only. This tree is kept on Linux as a backup copy, which is why -# `make` there stops with a word about it instead of failing obscurely. -# Use gmake on z/OS: /bin/make is not GNU make and cannot read this file. +# The build is POSIX make, the make z/OS ships: no :=, no ?=, no ifeq, +# no $(shell), no pattern rules. gmake is not installed everywhere and +# /bin/make is not GNU make. -# CC is predefined by make, so ?= would keep /bin/cc. -CC := ibm-clang -AS ?= as -CFLAGS ?= -std=c23 -O2 -m32 -Wall -Wextra -Wshadow -Wpedantic -LDFLAGS ?= -Wl,-bAC(1) # AC(1): the other half of APF, with extattr +a +CC = ibm-clang +AS = as +CFLAGS = -std=c23 -O2 -m32 -Wall -Wextra -Wshadow -Wpedantic +# AC(1) is half of what makes an executable APF-authorized, the other +# half being the APF bit on the file (make apf). Quoted: the z/OS shell +# reads `(` in an unquoted word as a syntax error. +LDFLAGS = -Wl,'-bAC(1)' OBJ = src/zvslist.o -all: ztop +all: + @uname -s | grep OS/390 >/dev/null || \ + { echo "ztop builds only on z/OS; this tree is a backup copy"; exit 1; } + @exec $(MAKE) ztop ztop: src/ztop.c $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ src/ztop.c $(OBJ) # The assembler reads HFS source through the file's coded character set # tag; a git checkout arrives tagged UTF-8 and HLASM then reads the file -# as if it were EBCDIC ("SYNAD ... WRONG LEN RECRD"). Tag it as ASCII. -src/zvslist.o: src/zvslist.s - chtag -t -c ISO8859-1 src/zvslist.s - @awk 'length > 71 { print FILENAME ":" NR ": longer than column 71"; bad = 1 } \ +# as if it were EBCDIC ("SYNAD ... WRONG LEN RECRD"). Tag it as ASCII, +# and keep every statement inside column 71: column 72 is the +# continuation mark, and a long comment turns the next line into one. +.s.o: + chtag -t -c ISO8859-1 $< + @awk 'length > 71 { print FILENAME ":" NR ": past column 71"; bad = 1 } \ END { exit bad }' $< $(AS) -o $@ $< -# extattr +a on the executable plus the AC(1) above is what makes -# ztop APF-authorized; a relink drops the bit, so re-run this. +# A relink drops the APF bit, so run this after every build. apf: ztop extattr +a ztop ls -E ztop @@ -39,10 +59,3 @@ check: ztop clean: rm -f ztop $(OBJ) - -# Linux is a backup, not a build: VSMLIST and the PSA do not exist there. -ifeq ($(shell uname -s),Linux) -$(error ztop builds only on z/OS; on Linux this tree is a backup copy) -endif - -.PHONY: all apf check clean |
