SHELL=/bin/csh
#
FLNM= mksrc
SUBDIR=timegcm
USER= foster
USERUC= FOSTER
NEWLIB= $(FLNM).a
CFT=	cft77
#FFLAGS= -Wf"-ezo -o off" 
FFLAGS=
LDR=	segldr
LDFLAGS= -D dupentry=ignore -i ~/segdir -L/lib,/usr/lib,/usr/local/lib -lfitpack
LIBS= igrf.a msis90.a
COMMAND=$(FLNM).ymp
PROFLIB=
MSSRCPATH=/$(USERUC)/src
TARFILE=$(FLNM).tar
TDIR=/d/$(USER)/$(SUBDIR)/$(FLNM)
LIST = $(FLNM).list
#
# All fortran source code files for this job:
FSRCS= \
	mksrc.f settime.f setgrid.f assgn.f \
	blktime.f getinp.f lnblnk.f lnblnk2.f getglbm.f \
	wrhist.f disptp.f openhist.f hdrsum.f opendatv.f \
	wrdatv.f mkdatv.f efield.f acd2d.f contour.f \
	cpsetup.f labrect.f lenstr.f wrlab.f setag.f \
	tail.f pltacd.f pltlb.f mkproj.f cira.f \
	mapeod.f getcira.f lbtgcm.f det3.f getforbes.f
#
# Object code for this job (like SRCS but with .o suffix)
OBJS= \
	mksrc.o settime.o setgrid.o assgn.o \
	blktime.o getinp.o lnblnk.o lnblnk2.o getglbm.o \
	wrhist.o disptp.o openhist.o hdrsum.o opendatv.o \
	wrdatv.o mkdatv.o efield.o acd2d.o contour.o \
	cpsetup.o labrect.o lenstr.o wrlab.o setag.o \
	tail.o pltacd.o pltlb.o mkproj.o cira.o \
	mapeod.o getcira.o lbtgcm.o det3.o getforbes.o
#
# Header files not in cwd (for listing target)
INCH = \
	/home/sting/foster/proclib/tgcmhdr.h \
	/home/sting/foster/plt/cpwrk.h
#
# Source files not in cwd (for listing target)
INCF = \
	/home/sting/foster/proclib/lnblnk.f \
	/home/sting/foster/proclib/lnblnk2.f \
	/home/sting/foster/proclib/efield.f \
	/home/sting/foster/proclib/lenstr.f \
	/home/sting/foster/proclib/tail.f \
	/home/sting/foster/plt/setag.f \
	/home/sting/foster/cira/cira.f \
	/home/sting/foster/getgcm/assgn.f \
	/home/sting/foster/timegcm/contour.f \
	/home/sting/foster/timegcm/cpsetup.f \
	/home/sting/foster/libplt/mkproj.f \
	/home/sting/foster/empsrc/disptp.f
#
# Make shavano executable (made from cjob):
#
$(COMMAND):	$(OBJS)
	$(LDR) $(LDFLAGS) -o $(COMMAND) $(OBJS) $(LIBS)
#
# flint is fortran source code analyzer on shavano:
#
lint:
	flint -fg $(FSRCS) 
#
# Make shavano object library (made from clib):
#
$(NEWLIB):  $(OBJS)
	bld -r $(NEWLIB) $(OBJS)
#
# Make backup of source code on the mass store:
# (make this target from the sun)
#
msbackup:
	/home/sting/foster/bin/mktar \
-v -f $(TDIR)/$(TARFILE) -r -i $(INCF) $(INCH)
	toms -ft $(TDIR)/$(TARFILE) $(MSSRCPATH)/$(TARFILE)
#
# Make master listing of header and source files:
# (make this target from the sun)
#
listing:
	cat *.h $(INCH) *.f $(INCF) > $(LIST)
#
# remove executable from shavano:
rmymp:
	rsh shavano 'rm /usr/tmp/$(USER)/$(SUBDIR)/$(FLNM)/$(COMMAND)'
#
# clean shavano:
cleanymp:
	rsh shavano 'cd /usr/tmp/$(USER)/$(SUBDIR)/$(FLNM); \
rm gmeta *.ymp M* *.f *.c *.h *.tar *.inp *.out fort.* *.nqs cjob core jafile '

clean:
	rm M* *.f *.h *.c *.tar *.inp *.out *.o *.ymp
