# beps.make
# make file to compile beps program

# first name a variable objects for all object files
objects = beps.o doxx.o penmon.o readb_init.o readlai.o rs.o \
	   carbon.o inter.o ra.o readbm.o readlc.o rsoil.o \
	   display.o melt.o readawc.o readclim.o readlonlat.o soilresp.o \
	   doflux.o model.o readb.o readconf.o readsnow.o zcomp.o

# name a variable sources for all source files
sources = beps.c doxx.c penmon.c readb_init.c readlai.c rs.c \
	   carbon.c inter.c ra.c readbm.c readlc.c rsoil.c \
	   display.c melt.c readawc.c readclim.c readlonlat.c soilresp.c \
	   doflux.c model.c readb.c readconf.c readsnow.c zcomp.c 

# now give target as makebeps with objects as variable dependencies + command line

beps: $(objects) 
	gcc -O3 -o runbeps -lm $(objects)

# list the dependencies for object files - those header files which help build objects

beps.o : beps.h 
doxx.o : beps.h 
penmon.o : beps.h 
readb_init.o : beps.h 
readlai.o : beps.h 
rs.o : beps.h 
carbon.o : beps.h 
inter.o : beps.h 
ra.o : beps.h 
readbm.o : beps.h 
readlc.o : beps.h 
rsoil.o : beps.h
display.o : beps.h 
melt.o : beps.h 
readawc.o : beps.h 
readclim.o : beps.h 
readlonlat.o : beps.h 
soilresp.o : beps.h 
doflux.o : beps.h 
model.o : beps.h 
readb.o : beps.h 
readconf.o : beps.h 
readsnow.o : beps.h 
zcomp.o : beps.h

# how to build all object files from all dependent source files

$(objects): $(sources)
	gcc -O3 -c $(sources)

clean:
	rm $(objects) runbeps

