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:
c89 -c -W c,"CSECT(myprog)" unit0.c
c89 -c -W c,"CSECT(myprog)" unit1.c
c89 -c -W c,"CSECT(myprog)" unit2.c
_______________________________________________________________
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.
_______________________________________________________________
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.
This method is simple, and is consistent with existing methods of building applications, such as makefiles.