#dis
#dis    Open Source License/Disclaimer, Forecast Systems Laboratory
#dis    NOAA/OAR/FSL, 325 Broadway Boulder, CO 80305
#dis
#dis    This software is distributed under the Open Source Definition,
#dis    which may be found at http://www.opensource.org/osd.html.
#dis
#dis    In particular, redistribution and use in source and binary forms,
#dis    with or without modification, are permitted provided that the
#dis    following conditions are met:
#dis
#dis    - Redistributions of source code must retain this notice, this
#dis    list of conditions and the following disclaimer.
#dis
#dis    - Redistributions in binary form must provide access to this
#dis    notice, this list of conditions and the following disclaimer, and
#dis    the underlying source code.
#dis
#dis    - All modifications to this software must be clearly documented,
#dis    and are solely the responsibility of the agent making the
#dis    modifications.
#dis
#dis    - If significant modifications or enhancements are made to this
#dis    software, the FSL Software Policy Manager
#dis    (softwaremgr@fsl.noaa.gov) should be notified.
#dis
#dis    THIS SOFTWARE AND ITS DOCUMENTATION ARE IN THE PUBLIC DOMAIN
#dis    AND ARE FURNISHED "AS IS."  THE AUTHORS, THE UNITED STATES
#dis    GOVERNMENT, ITS INSTRUMENTALITIES, OFFICERS, EMPLOYEES, AND
#dis    AGENTS MAKE NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE USEFULNESS
#dis    OF THE SOFTWARE AND DOCUMENTATION FOR ANY PURPOSE.  THEY ASSUME
#dis    NO RESPONSIBILITY (1) FOR THE USE OF THE SOFTWARE AND
#dis    DOCUMENTATION; OR (2) TO PROVIDE TECHNICAL SUPPORT TO USERS.
#dis

SRCROOT=../../..

include $(SRCROOT)/src/include/makefile.inc

RM=rm -f

.SUFFIXES:              .f .o .c

LIB	= libw3.a
DEBUGLIB= libdebugw3.a
ARCHIVE = ar rv

# OPTIONS FOR IBM-SP 
#F77	= xlf
#FFLAGS	= -qnosave -qrealsize=8 -qnolm
#FFLAGS = -qnosave -qnolm
#CFLAGS	= -DIBM4 -qnolm
#CFLAGS = -O3 -qarch=auto
#CC	= cc
##CC     = xlc

# OPTIONS FOR LINUX LAHEY
#F77	= lf95
#FFLAGS	= -X9 -Ad -Am -fw
#CFLAGS	= -O -DLINUX
#CC	= cc

# OPTIONS FOR LINUX LAHEY
#F77	= f90
#FFLAGS	= -O
#CFLAGS	= -O -DLINUXF90
#CC	= cc

# OPTIONS FOR JET 
#F77     = fort
#FFLAGS  = -O4  
#CFLAGS  = -O 
#CC      = cc

# OPTIONS FOR VPP5000
#F77     = frt
#FFLAGS  = -X9 -Ad -Sw -Am -Of -Wv,-Of
#CFLAGS  = -O -K4 -DVPP5000
#CC      = vcc
#
# *****************************************************************
#
.f.o:
			$(RM) $@
			$(FC) -c $(FFLAGS) $(INC) $*.f
			$(ARCHIVE) $(LIB) $(<:.f=.o)

.c.o:
			$(RM) $@
			$(CC) -c $(CFLAGS) $(INC) $*.c
			$(ARCHIVE) $(LIB) $(<:.c=.o)

MSRC =  bacio_module.f
FSRC    = \
getgb.f     getgbmh.f   putgbex.f   w3fi73.f     baciof.f \
getgb1r.f   getgbmp.f   putgbn.f    w3fi74.f \
getgb1re.f  getgbp.f    r63w72.f    w3fi75.f \
getgb1s.f   getgi.f     sbyte.f     w3fi76.f \
getgbe.f    getgir.f    sbytes.f    w3fi82.f \
getgbeh.f   idsdef.f    skgb.f      w3fi83.f \
getgbem.f   iw3jdn.f    w3difdat.f  w3fs26.f \
getgbemh.f  ixgb.f      w3doxdat.f  w3log.f \
getgbemp.f  lengds.f    w3fi01.f    w3movdat.f \
getgbens.f  pdsens.f    w3fi58.f    w3reddat.f \
getgbep.f   pdseup.f    w3fi59.f    w3tagb.f \
errmsg.f    mova2i.f    getgbex.f   putgb.f     w3fi63.f    \
gbytes.f    r63w72.f    getgbexm.f  putgbe.f    w3fi68.f    \
gbytes_char.f           getgbh.f    putgben.f   w3fi71.f \
getbit.f                getgbm.f    putgbens.f  w3fi72.f \
errexit.f fparsei.f fparser.f instrument.f start.f summary.f w3utcdat.f \
w3fs21.f w3locdat.f xmovex.f w3fb06.f w3fb11.f w3fa09.f

CSRC= bacio.v1.3.c

FOBJS=$(FSRC:.f=.o)
MOBJS=$(MSRC:.f=.o)
COBJS=$(CSRC:.c=.o)

all:			lib

lib:			$(LIB)

$(LIB):			$(FOBJS) $(COBJS) $(MOBJS)
			$(RANLIB) $(LIB)
			$(RM) $(FOBJS) $(MOBJS) $(COBJS)

debug:			clean
			$(MAKE) lib LIB='$(DEBUGLIB)' \
			CFLAGS='$(DBCFLAGS)' FFLAGS='$(DBFLAGS)'

clean:
			$(RM) $(FOBJS) $(MOBJS) $(COBJS) core *.a
