#
#     ##################################################################
#     ##################################################################
#     ######                                                      ######
#     ######      Advanced Regional Prediction System (ARPS)      ######
#     ######                   Version 5.0                        ######
#     ######                                                      ######
#     ######                     Developed by                     ######
#     ######     Center for Analysis and Prediction of Storms     ######
#     ######                University of Oklahoma                ######
#     ######                                                      ######
#     ##################################################################
#     ##################################################################
#
#=======================================================================
#
#  PURPOSE: This makefile generates the WTRETCOL executable
#
#  AUTHOR:  Yuhe Liu
#           7/22/1997
#
#  Modification history:
#
#
#  OTHER INFORMATION:
#       See the makearps command.
#
#=======================================================================

#-----------------------------------------------------------------------
#
# Default shell
#
#-----------------------------------------------------------------------

# SHELL=/bin/csh

#-----------------------------------------------------------------------
#
# Default names of the loader and tar, can be replaced on the command
# line for other system
#
#-----------------------------------------------------------------------

FTN = f90
LDR = f90
CC  = cc

ARPS_LD = $(LDR)

TAR = tar
AWK = awk
RM  = rm
LN  = ln

TOPDIR = 
BINDIR = $(TOPDIR)
INCLDIR = $(TOPDIR)/include
LIBDIR = $(TOPDIR)/lib

#-----------------------------------------------------------------------
#
# Compiler Flag of Options. The default is for AIX Fortran xlf.
#
#-----------------------------------------------------------------------

FFLAGS =
CFLAGS =
LDFLAGS =

FIXFLAGS  =
FREEFLAGS =

#-----------------------------------------------------------------------
#
# Dependencies
#
#-----------------------------------------------------------------------

.SUFFIXES: $(SUFFIXES) .f90

.f.o:
	$(FTN) $(FFLAGS) $(FIXFLAGS) -c $<
.f90.o:
	$(FTN) $(FFLAGS) $(FREEFLAGS) -c $<
.c.o:
	$(CC)  $(CFLAGS) -c $<

#-----------------------------------------------------------------------
#
# Executable to be generated by this make file:
#
# WTRETCOLEXE = wtretcol     WTRETCOL executable
#
#-----------------------------------------------------------------------

WTRETCOLEXE = wtretcol

#-----------------------------------------------------------------------
#
# Shared library to be linked
#
# LIBARPS = libarps      ARPS shared library
#
#-----------------------------------------------------------------------

LIBARPS = libarps

#-----------------------------------------------------------------------
#
# List of machine-dependent object codes
#
#-----------------------------------------------------------------------

WTRETCOLOBJ = wtretcol.o

#-----------------------------------------------------------------------
#
# Set Default
#
#-----------------------------------------------------------------------

default: $(WTRETCOLEXE)

#-----------------------------------------------------------------------
#
# Compile and link ARPS model executable, arps
#
#-----------------------------------------------------------------------

#$(WTRETCOLEXE): $(WTRETCOLOBJ) $(LIBDIR)/$(LIBARPS).a
#	$(ARPS_LD) $(LDFLAGS) -o $(BINDIR)/$@ $(WTRETCOLOBJ) \
#                               $(LIBDIR)/$(LIBARPS).a

$(WTRETCOLEXE): $(BINDIR)/$(WTRETCOLEXE)
	ls -l $(BINDIR)/$(WTRETCOLEXE)

$(BINDIR)/$(WTRETCOLEXE): $(WTRETCOLOBJ) $(LIBDIR)/$(LIBARPS).a
	$(ARPS_LD) $(LDFLAGS) -o $@ $(WTRETCOLOBJ) \
                               $(LIBDIR)/$(LIBARPS).a $(LIBS)

#-----------------------------------------------------------------------
#
# Remove the object code for individual programs
#
#-----------------------------------------------------------------------

clean.wtretcol:
	-$(RM) -f $(BINDIR)/$(WTRETCOLEXE) $(WTRETCOLOBJ)

#-----------------------------------------------------------------------
#
# Object code dependency list:
#
#-----------------------------------------------------------------------

wtretcol.o : wtretcol.f90     $(INCLDIR)/globcst.inc \
                              $(INCLDIR)/grid.inc \
                              $(INCLDIR)/indtflg.inc
