Steps for binding each compile unit using c89

Before you begin: Compile each source file and also bind it.

Perform the following steps to complete a final bind of all the partially bound units:

  1. Compile each source file to its object module (.tmp). Bind each object module into a partially bound program object (.o), which may have unresolved references. In this example, references to f1() and f4() in unit0.o are unresolved. When the partially bound programs are created, remove the object modules as they are no longer needed. Use c89 to compile each source file, as follows:
    c89 -c -W c,"CSECT(myprog)" -o unit0.tmp unit0.c
    c89 -r -o unit0.o unit0.tmp
    rm unit0.tmp
    
    c89 -c -W c,"CSECT(myprog)" -o unit1.tmp unit1.c
    c89 -r -o unit1.o unit1.tmp
    rm unit1.tmp
    
    c89 -c -W c,"CSECT(myprog)" -o unit2.tmp unit2.c
    c89 -r -o unit2.o unit2.tmp
    rm unit2.tmp

    The -r option supports rebindability by disabling autocall processing.

    _______________________________________________________________

  2. Perform the final single bind to produce the executable program myprog by using c89:
    c89 -o myprog unit0.o unit1.o unit2.o

    _______________________________________________________________

Example: An example of a makefile for performing a similar build:
_C89_EXTRA_ARGS=1
.EXPORT : _C89_EXTRA_ARGS       1 
PGM = myprog                           2 
SRCS = unit0.c unit1.c unit2.c         3 
OBJS = $(SRCS:b:+".o")                 4 
COPTS = -W c,"CSECT(myprog)"
$(PGM) : $(OBJS)                       5 
         c89 -o $(PGM) $(OBJS)
%.tmp : %.c         6 
         c89 -c -o $@ $(COPTS) $<
%.o : %.tmp                            7 
         c89 -r -o $@ $<
 1 
Export the environment variable _C89_EXTRA_ARGS so c89 will process files with non-standard extensions. Otherwise c89 will not recognize unit0.tmp, and the makefile will fail
 2 
name of executable
 3 
list of source files
 4 
list of partly bound parts
 5 
executable depends on parts
 6 
make .tmp file from .c
 7 
make .o from .tmp

In this example, make automatically removes the intermediate .tmp files after the makefile completes, since they are not marked as PRECIOUS. For more information on makefiles, see z/OS UNIX System Services Programming Tools.

Advantage

Binding a set of partially bound program objects into a fully bound program object is faster than binding object modules into a fully bound program object for NOGOFF objects. For example, a central build group can create the partially bound program objects. Developers can then use these program objects and their changed object modules to create a development program object.