Information about makefiles


 

If you need information about makefiles and the make command. Try man make or ask your local Unix guru.

A sample makefile which compiles and links a C program calling Fortran routines.

# linker
LD      = c89
# Fortran compiler
FC      = f77
# C compiler
CC      = c89
# Our ancient Fortran library no one wants to rewrite
oldlib  = -lold
# C compiler options
CFLAGS  =
# Fortran compiler options
FFLAGS  =
# linker options, defines where to look for run-time libraries
ldflags = -L/usr/lib/cmplrs/fort -L/usr/local/lib
# Fortran run-time libraries, must be defined since we use c89
# to call the linker. We could of course use the f77 compiler to
# call the linker, but then we must specify the C run-time libraries
# instead.
FCLB    =  -lUfor -lfor -lFutil -lm -lots

jarobjects = jarlist.o

srobjects = sr.o srhdr.o srmnplt.o srnt.o srprnls.o srvntls.o srwrt.o \
            srxc.o

sr: $(srobjects) $(jarobjects)
        $(LD) $(ldflags) -o sr $(srobjects) $(jarobjects) $(oldlib) $(FCLB)

# dependencies
jarlist.o:	jarlist.f
sr.o:		sr.c srdfns.h
srhdr.o:	srhdr.c srdfns.h
srmnplt.o:	srmnplt.c srdfns.h
srnt.o:		srnt.c srdfns.h
srprnls.o:	srprnls.c srdfns.h
srvntls.o:	srvntls.c srdfns.h
srwrt.o:	srwrt.c srdfns.h
srxc.o:		srxc.c srdfns.h