cc -c subr1.c
f77 -c subr2.f
f77 -o test mainprog.f subr1.o subr2.o
First, compile subr1.c with the C compiler, cc, without linking. This will produce an object file, subr1.o. Next, compile subr2.f with the Fortran compiler, f77, without linking. This will produce an object file, subr2.o. Finally, compile mainprog.f, with the Fortran compiler, f77, linking the libraries as well as subr1.o and subr2.o. The executable code produced will be written into test. This is useful when a program calls subroutines in both C and Fortran. If changes are only made to one subroutine, compiling subroutines separately and then compiling the main program with the object files can save time.