Steps for single final bind using c89

Before you begin: Compile each source file and then perform a single final bind.

Perform the following steps to perform a single final bind using c89:

  1. Compile each source file to generate the object modules unit0.o, unit1.o, and unit2.o as follows:
    c89 -c -W c,"CSECT(myprog)"  unit0.c
    c89 -c -W c,"CSECT(myprog)"  unit1.c
    c89 -c -W c,"CSECT(myprog)"  unit2.c

    _______________________________________________________________

  2. Perform a final single bind to produce the executable program myprog. Use the c89 utility as follows:
    c89 -o myprog unit0.o unit1.o unit2.o

    The -o option of the c89 command specifies the name of the output executable. The c89 utility recognizes from the file extension .o that unit0.o, unit1.o and unit2.o are not to be compiled but are to be included in the bind step.

    _______________________________________________________________

Example: An example of a makefile to perform a similar build:
PGM = myprog
SRCS = unit0.c unit1.c unit2.c
OBJS = $(SRCS:b:+".o")
COPTS = -W c,"CSECT(myprog)"
$(PGM) : ($OBJS)
        c89 -o $(PGM) $(OBJS)
%.o : %.c
        c89 -c -o $@ $(COPTS) $<

For more information about makefiles, see z/OS UNIX System Services Programming Tools.

Advantage

This method is simple, and is consistent with existing methods of building applications, such as makefiles.