# Makefile for VIS-5D utilities for IBM RS/6000

# vis5d program for visualizing five dimensional gridded data sets
# Copyright (C) 1990, 1991, 1992  Bill Hibbard, Brian Paul, Dave Santek,
# and Andre Battaiola.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.



CFLAGS = -c -O -w -Dibm
FFLAGS = -c -O -w
CC = cc
F77 = xlf


PROGRAMS = ../comp5d ../igg3d ../igu3d ../gg3d ../help ../compinfo


default: $(PROGRAMS)




### comp5d - for compressing McIDAS files to VIS-5D format

../comp5d: comp5d.o get5d.o compal.o libmain.a
	$(F77) comp5d.o get5d.o compal.o -lm libmain.a -o $@

comp5d.o: comp5d.F vis5d.h
	mv comp5d.F comp5d.f ; $(F77) $(FFLAGS) comp5d.f ; mv comp5d.f comp5d.F

get5d.o: get5d.f vis5d.h
	$(F77) $(FFLAGS) get5d.f

compal.o: compal.c
	$(CC) $(CFLAGS) compal.c



### igg3d - for getting McIDAS grid file statistics

../igg3d: igg3d.o libmain.a
	$(F77) igg3d.o -lm libmain.a -o $@

igg3d.o: igg3d.F
	mv igg3d.F igg3d.f ; $(F77) $(FFLAGS) igg3d.f ; mv igg3d.f igg3d.F



### igu3d - for getting McIDAS grid file listings

../igu3d: igu3d.o libmain.a
	$(F77) igu3d.o -lm libmain.a -o $@

igu3d.o: igu3d.F
	mv igu3d.F igu3d.f ; $(F77) $(FFLAGS) igu3d.f ; mv igu3d.f igu3d.F



### gg3d - for resampling McIDAS grid files

../gg3d: gg3d.o libmain.a
	$(F77) gg3d.o -lm libmain.a -o $@

gg3d.o: gg3d.F
	mv gg3d.F gg3d.f ; $(F77) $(FFLAGS) gg3d.f ; mv gg3d.f gg3d.F



### help - program to print help comments in .F files

../help: help.c
	$(CC) help.c -o $@




### compinfo - print information about a compressed grid file

../compinfo: compinfo.o fileio.o
	$(CC) compinfo.o fileio.o -o $@

compinfo.o: compinfo.c fileio.h
	$(CC) $(CFLAGS) compinfo.c -o $@

fileio.o: fileio.c
	$(CC) $(CFLAGS) fileio.c -o $@



### libmain - McIDAS stub library

LIB = libmain.a

libmain.a: $(LIB)(main.o) $(LIB)(sdest.o) $(LIB)(topo.o) \
	   $(LIB)(igmk3d.o) $(LIB)(doubt.o) $(LIB)(kludge.o)
	@echo libmain.a up-to-date
