########################################################################
##                                                                    ##
##               M  a  k  e  f  i  l  e                               ##
##                                                                    ##
##   Makefile for C implementation of tree part of LPJ                ##
##   creates library ../../lib/libtree.a                              ##
##                                                                    ##
##   written by Werner von Bloh                                       ##
##   Potsdam Institute for Climate Impact Research                    ##
##   P.O. Box 60 12 03                                                ##
##   14412 Potsdam/Germany                                            ##
##                                                                    ##
##   Last change: $Date:: 2017-01-25 11:38:36 +0100 (Wed, 25 Jan 20#$ ##
##   By         : $Author:: cmueller                        $         ##
##                                                                    ##
########################################################################

include ../../Makefile.inc

OBJS	= lai_tree.$O turnover_tree.$O npp_tree.$O phenology_tree.$O\
          mortality_tree.$O init_tree.$O firemortality_tree.$O\
          allocation_tree.$O isneg_tree.$O light_tree.$O fpar_tree.$O\
          litter_update_tree.$O fpc_tree.$O allometry_tree.$O\
          new_tree.$O fwrite_tree.$O fscanpft_tree.$O  fprint_tree.$O \
          fread_tree.$O establishment_tree.$O fire_tree.$O free_tree.$O\
          veg_sum_tree.$O adjust_tree.$O mix_veg_tree.$O fprintpar_tree.$O\
          alphaa_tree.$O livefuel_consum_tree.$O reduce_tree.$O\
          annual_tree.$O coppice_tree.$O turnover_monthly_tree.$O\
          albedo_tree.$O nuptake_tree.$O ndemand_tree.$O  vmaxlimit_tree.$O\
          nitrogen_allocation_tree.$O turnover_daily_tree.$O

INC     = ../../include
LIBDIR	= ../../lib
LIB	= libtree.$A

HDRS    = $(INC)/buffer.h $(INC)/coord.h $(INC)/lpj.h $(INC)/pftlist.h\
          $(INC)/soil.h $(INC)/climate.h $(INC)/date.h $(INC)/pft.h\
          $(INC)/pftpar.h $(INC)/types.h $(INC)/tree.h\
          $(INC)/errmsg.h $(INC)/numeric.h $(INC)/param.h\
          $(INC)/conf.h $(INC)/swap.h $(INC)/soilpar.h $(INC)/stand.h\
          $(INC)/list.h $(INC)/cell.h  $(INC)/units.h $(INC)/agriculture.h\
          $(INC)/config.h $(INC)/landuse.h $(INC)/spitfire.h\
          $(INC)/climbuf.h $(INC)/discharge.h $(INC)/biomass_tree.h\
          $(INC)/reservoir.h

$(LIBDIR)/$(LIB): $(OBJS)
	$(AR) $(ARFLAGS)$(LIBDIR)/$(LIB) $(OBJS)

$(OBJS): $(HDRS)

.c.$O: 
	$(CC) $(CFLAGS) -I$(INC) -c $*.c
clean:
	$(RM) $(RMFLAGS) $(OBJS) 
	(cd $(LIBDIR) && $(RM) $(RMFLAGS) $(LIB))
