# Makefile for HDF 3.2 / 4.0
#
# $Header: /hdf/hdf/v3.2/test/RCS/Makefile,v 1.2 1992/02/26 23:13:42 dilg beta $
# $Log: Makefile,v $
# Revision 1.2  1992/02/26  23:13:42  dilg
# Added dfstubs.c to library and tdfstubs.c to tests.
#
# Revision 1.1  1992/02/10  21:56:04  chouck
# Initial revision
#
#

BDIR=../backup
ARCHIVE=hdf.shar

#####################################################################
CC=cc
AR=ar
SHAR=shar
RM=/bin/rm
LINT=lint

#####################################################################
CFLAGS=-g -DSUN
ARFLAGS=r
RMFLAGS=-f
LINTFLAGS=-DIMB6000=1

#####################################################################

HDRS=hfile.h hdf.h herr.h dfrig.h dfgr.h hproto.h df.h dfi.h
SRCS=hfile.c herr.c hblocks.c hextelt.c \
	dfr8.c dfcomp.c dfimcomp.c dfp.c dfgroup.c dfgr.c df24.c dfstubs.c
OBJS=hfile.o herr.o hblocks.o hextelt.o \
	dfr8.o dfcomp.o dfimcomp.o dfp.o dfgroup.o dfgr.o df24.o dfstubs.o

TESTS=thfile thfile1 thblocks thextelt tdfp tlinkage tdfr8 tdf24 \
	terr tdfstubs
TSRCS=thfile.c thfile1.c thblocks.c thextelt.c tdfp.c tlinkage.c \
	tdfr8.c tdf24.c terr.c tdfstubs.c
TOBJS=thfile.o thfile1.o thblocks.o thextelt.o tdfp.o tlinkage.o \
	tdfr8.o tdf24.o terr.o tdfstubs.o

UTILS=tvers
USRCS=tvers.c
UOBJS=tvers.o

UTILS=tvers
LIBS=libhdf.a

#####################################################################

.c.o:	
	$(RM) $(RMFLAGS) $@
	$(CC) $(CFLAGS) -c $<

all: libhdf.a test util

#####################################################################
lib: $(LIBS)

libhdf.a: $(OBJS)
	$(AR) $(ARFLAGS) libhdf.a $(OBJS)
	ranlib libhdf.a

#####################################################################
util: $(UTILS)

tvers:	libhdf.a tvers.o
	$(CC) tvers.o libhdf.a -o tvers

#####################################################################
test: $(TESTS) 

thfile: libhdf.a thfile.o
	$(CC) thfile.o libhdf.a -o thfile

thfile1: libhdf.a thfile1.o
	$(CC) thfile1.o libhdf.a -o thfile1

thblocks: libhdf.a thblocks.o
	$(CC) thblocks.o libhdf.a -o thblocks

thextelt: libhdf.a thextelt.o
	$(CC) thextelt.o libhdf.a -o thextelt

tdfp: libhdf.a tdfp.o
	$(CC) tdfp.o libhdf.a -o tdfp

tdfr8: libhdf.a tdfr8.o
	$(CC) tdfr8.o libhdf.a -o tdfr8

tdf24: libhdf.a tdf24.o
	$(CC) tdf24.o libhdf.a -o tdf24

tlinkage: libhdf.a tlinkage.o
	$(CC) tlinkage.o libhdf.a -o tlinkage

terr: libhdf.a terr.o
	$(CC) terr.o libhdf.a -o terr

tdfstubs: libhdf.a tdfstubs.o
	$(CC) tdfstubs.o libhdf.a -o tdfstubs

#####################################################################

clean:
	$(RM) $(RMFLAGS) $(OBJS) libhdf.a $(TESTS) $(TOBJS) \
		$(UTILS) $(UOBJS) $(ARCHIVE) *~

lint: lint1 lint2

lint1:	$(SRCS)
	$(LINT) $(LINTFLAGS) $(SRCS)

lint2:	$(URCS)
	$(LINT) $(LINTFLAGS) $(USRCS)

TAGS: $(SRCS) $(HDRS)
	etags $(SRCS) $(HDRS)

$(ARCHIVE): ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS)
	$(RM) $(RMFLAGS) $(ARCHIVE)
	$(SHAR) $(ARCHIVE) ChangeLog Makefile $(SRCS) $(HDRS) \
		$(TSRCS) $(USRCS)

archive: $(ARCHIVE)

backup: ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS)
	cp ChangeLog Makefile $(SRCS) $(HDRS) $(TSRCS) $(USRCS) $(BDIR)

#####################################################################


hfile.o   : hdf.h hproto.h herr.h  hfile.h 
hextelt.o : hdf.h hproto.h herr.h  hfile.h 
hblocks.o : hdf.h hproto.h herr.h  hfile.h 

dfr8.o	  : hdf.h hproto.h herr.h  dfgr.h
dfcomp.o  : hdf.h hproto.h herr.h  dfgr.h
dfgroup.o : hdf.h hproto.h herr.h  dfgr.h
dfimcomp.o: hdf.h hproto.h herr.h  dfgr.h
df24.o	  : hdf.h hproto.h herr.h  dfgr.h
dfgr.o	  : hdf.h hproto.h herr.h  dfgr.h 




