To make it easier to compile and build, link-edit, and bind a Metal
C check, IBM® Health Checker
for z/OS® provides a sample
makefile, hzssmake.mk, for use with the z/OS UNIX System
Services make utility. This makefile compiles and builds the sample
files shipped in z/OS UNIX file system directory /usr/lpp/bcp/samples,
where the makefile itself is shipped also.
Before you use the makefile, make sure you update the HCHECK_LOADLIB
variable in the makefile. This variable names the dataset where the
makefile will store the final load modules. This should be an APF authorized dataset in the link list, suitable
for your installation.
To create all sample load modules, change to the directory where
the hzssmake.mk file is stored and invoke the make utility like this:
make -f hzssmake.mk
Check out the other make rules in the
makefile,
in particular the cleanup rules. You can invoke cleanup, for example,
using the following command:
make -f hzssmake.mk clean
This
command will clean up all intermediate files, but will keep the generated
load modules.
Once built, your Metal C load modules are
ready to be registered with IBM Health
Checker for z/OS as you would
any other check. See:
For a Metal C sample HZSADDCHECK exit routine r, look for hzscadd.c
in
/usr/lpp/bcp/samples .
For more information about the make utility and the other utilities
used in the makefile, see Shell command
descriptions in z/OS UNIX System Services Command Reference.
################################################################
# Name: HZSSMAKE #
# #
# Description: Makefile for building Metal C sample #
# local and remote health checks and #
# a sample HZSADDCHECK exit routine. #
# #
# COMPONENT: IBM Health Checker for z/OS (SCHZS) #
# #
# PROPRIETARY STATEMENT: #
# #
# Licensed Materials - Property of IBM #
# 5650-ZOS #
# Copyright IBM Corp. 2009 #
# #
# US Government Users Restricted Rights - Use, duplication #
# or disclosure restricted by GSA ADP Schedule Contract with#
# IBM Corp. #
# #
# END OF PROPRIETARY STATEMENT #
# #
# STATUS = HBB7770 #
# #
# Change Activity: #
# #
# $L0=METALC HBB7770 20081202 PDGIO: Initial version #
# $L1=METALC HBB7770 20090513 RDUT: Updated options,targets#
# #
################################################################
# The load modules created via this makefile will be put into this PDSE
# dataset. Change this to an APF authorized dataset in the link list,
# suitable for your installation.
# The linker/binder will create the PDSE, if it does not exist yet.
HCHECK_LOADLIB =HLQ.LOADLIB
# Location of Health Checker header filesHC_INCLUDES = "//'SYS1.SIEAHDR.H'"
# (Metal-) C compiler utility
CC = c99
# (Metal-) C compiler flags
# nosearch - avoids using the non-Metal C header files
# I - specifies our include paths, since nosearch disabled most
# metal + S - makes it Metal C instead of "regular" C/C++
# longname - optional, but allows for longer than 8 character names
CFLAGS = -S -Wc,metal,longname,nosearch \
-I /usr/include/metal,$(HC_INCLUDES)
# Assembler utility
AS = as
# Assembler flags
# rent - requests reentrant code; required for health checks
# goff - optional, but allows for longer than 8 character names
ASFLAGS = -mrent -mgoff
# Linker/binder utility
LD = ld
# Linker/binder flags
# ac=1 - assigns authorization code; required for health checks
# rent - requests reentrant code; required for health checks
# -S - resolves system services (PAUSE token handling by remote
# health checks) via SYSLIB CCSLIB
LDFLAGS = -bac=1 -brent
LDFLAGSR = -S "//'SYS1.CSSLIB'"
# The four sample health checks and the one sample exit routine
HCHECK_TGTS = hzscchkp hzscchkr hzscrchc hzscrchk hzscadd
# Default rule
all: $(HCHECK_TGTS)
# *Uncomment* this rule, if you would like to keep the intermediate
# output files, in particular the generated .s assembler source,
# instead of letting 'make' delete them automatically.
#.SECONDARY:
# Rule for cleaning up intermediate output
clean:
rm -f *.o *.s
# Rule for cleaning up all output
cleanall:
rm -f *.o *.s
- tso -t "DELETE '${HCHECK_LOADLIB}(hzscchkp)'"
- tso -t "DELETE '${HCHECK_LOADLIB}(hzscchkr)'"
- tso -t "DELETE '${HCHECK_LOADLIB}(hzscrchc)'"
- tso -t "DELETE '${HCHECK_LOADLIB}(hzscrchk)'"
- tso -t "DELETE '${HCHECK_LOADLIB}(hzscadd)'"
# Rule for compiling a Metal C file into assembly language
%.s: %.c
$(CC) $(CFLAGS) $<
# Rule for creating object code from assembly language
%.o: %.s
$(AS) $(ASFLAGS) -o $@ $<
# Rules for creating LOAD modules (executable) from the object code
hzscchkp: hzscchkp.o
$(LD) $(LDFLAGS) -o "//'${HCHECK_LOADLIB}($@)'" $<
hzscchkr: hzscchkr.o
$(LD) $(LDFLAGS) -o "//'${HCHECK_LOADLIB}($@)'" $<
hzscadd: hzscadd.o
$(LD) $(LDFLAGS) -o "//'${HCHECK_LOADLIB}($@)'" $<
hzscrchc: hzscrchc.o
$(LD) $(LDFLAGS) $(LDFLAGSR) -o "//'${HCHECK_LOADLIB}($@)'" $<
hzscrchk: hzscrchk.o
$(LD) $(LDFLAGS) $(LDFLAGSR) -o "//'${HCHECK_LOADLIB}($@)'" $<