#
# $Header: /pita/work/HDF/dev/RCS/src/MAKE.IRIS4,v 1.5 1991/10/30 21:44:06 dilg beta $
#
# $Log: MAKE.IRIS4,v $
# Revision 1.5  1991/10/30  21:44:06  dilg
# Changed automated machine type setting to use awk rather than sed.
# (thanks to pwebb)
#
# Revision 1.4  1991/10/28  21:35:25  mfolk
# Deleted DEFAULT line and Saber line (mfolk)
#
# Revision 1.3  1991/10/24  20:06:15  dilg
# Removed hdfslice as a utility.
#
# Revision 1.2  1991/10/24  18:32:19  dilg
# Automated machine type setting in dfi.h
#
# Revision 1.1  1991/10/22  17:56:10  dilg
# Initial revision
#
#
#*****************************************************************************
#
#   All NCSA HDF source code and documentation are in the public domain.
#   See notice at the top of ../README.FIRST file for further conditions.
#
#*****************************************************************************

# Makefile for an IRIS4.

# This makefile is for compiling HDF routines, and installing the files
# produced.

MACHINE=IRIS4

# SRCDIR, INCDIR, LIBDIR and BINDIR must be set to the desired values
# then, make build will compile source files make install will move
# files to include, bin and lib directories make cleanup will delete
# the .o files produced A make dist is also defined.  This will move
# source files to SRCDIR However, it is expected that make will
# usually be run from SRCDIR Hence, install is provided separately
# directories to install source files, include files, libraries and
# utilities in Modify this line as appropriate for your system

SRCDIR=.
INCDIR=../include
LIBDIR=../lib
BINDIR=../bin

# graphics display library for hdfseq (if any), compile flags.
# Modify -I option if .h files elsewhere
# for non-SUNS :
#GLIBS=
GLIBS	= -lgl
LIBS	= libdf.a

CC	= cc
FC	= f77
AR	= ar
RM	= /bin/rm -f
RANLIB	= ranlib
DEFS	= -D${MACHINE}
CFLAGS	= -O ${DEFS}
FFLAGS	= -O
ARFLAGS = r
LDFLAGS = 

HFILES= df.h dfi.h df24.h dfcomp.h dfgroup.h dfkit.h dfp.h dfr8.h \
        dfufp2im.h dfutil.h dfsd.h dfan.h dfgr.h dfconvrt.h dfimcomp.h \
        dfrig.h dfversio.h
CFILES= df.c dfr8.c dfgroup.c dfcomp.c dfimcomp.c \
        dfsd.c dfF.c dfr8F.c dfsdF.c dfkit.c dfp.c dfan.c \
        dfgr.c df24.c df24F.c dfpF.c dfanF.c dfufp2im.c \
        dfutil.c dfutilF.c dfversio.c
FFILES= dfFf.f dfr8Ff.f dfsdFf.f dfanFf.f df24Ff.f dfpFf.f \
        dfufp2imFf.f
UFILES= hdfcomp.c hdftotek.c tektohdf.c hdftor8.c \
        r8tohdf.c hdfls.c hdfrseq.c hdftopal.c paltohdf.c r24hdf8.c \
        hdf24to8.c showr24.c showr8.c hdfpack.c ristosds.c
COBJS=  df.o dfr8.o dfsd.o dfgroup.o dfcomp.o dfimcomp.o dfkit.o \
        dfp.o dfan.o  dfgr.o df24.o dfufp2im.o dfutil.o dfversio.o
FOBJS=  dfF.o dfr8F.o dfsdF.o dfanF.o dfFf.o dfr8Ff.o dfsdFf.o dfanFf.o \
        df24F.o df24Ff.o dfpFf.o dfpF.o dfufp2imFf.o dfutilF.o
OBJS=   ${COBJS} ${FOBJS}

UTILS=  hdfls hdfrseq r8tohdf hdfcomp hdftotek tektohdf hdftor8 hdftopal \
        paltohdf r24hdf8 hdf24to8 showr24 showr8 hdfpack ristosds

all:	libdf.a utils install

allnostub: libnostub utils install

build:  libdf.a utils

buildnostub: libnostub utils

libdf.a: ${OBJS}
	-${RM} libdf.a libnostub
	${AR} ${ARFLAGS} libdf.a ${OBJS}

libnostub: ${COBJS}
	-${RM} libdf.a libnostub
	${AR} ${ARFLAGS} libdf.a ${COBJS}
	touch libnostub

utils: ${UTILS}

df.o: df.h dfkit.h dfi.h

dfF.o: df.h dfkit.h dfi.h

df24.o: df.h dfkit.h dfi.h dfgr.h df24.h

df24F.o: df.h dfkit.h dfi.h dfgr.h df24.h

dfan.o: df.h dfkit.h dfi.h dfan.h

dfanF.o: df.h dfkit.h dfi.h dfan.h

dfcomp.o: df.h dfkit.h dfi.h dfcomp.h dfimcomp.h

dfgr.o: df.h dfkit.h dfi.h dfgr.h dfgroup.h dfcomp.h

dfgroup.o: df.h dfkit.h dfi.h dfgroup.h

dfimcomp.o: df.h dfkit.h dfi.h dfimcomp.h

dfkit.o: df.h dfkit.h dfi.h dfconvrt.h

dfp.o: df.h dfkit.h dfi.h dfp.h

dfpF.o: df.h dfkit.h dfi.h dfp.h

dfr8.o: df.h dfkit.h dfi.h dfgroup.h dfcomp.h dfr8.h

dfr8F.o: df.h dfkit.h dfi.h dfr8.h

dfsd.o: df.h dfkit.h dfi.h dfgroup.h dfconvrt.h dfsd.h

dfsdF.o: df.h dfkit.h dfi.h dfsd.h

dfutil.o: df.h dfkit.h dfi.h dfutil.h

dfutilF.o: df.h dfkit.h dfi.h dfutil.h

dfversio.o: df.h dfkit.h dfi.h dfversio.h

# this default rule is in here because the original default rule
# places the c-filename behind the LDFLAGS causing the brain-damaged
# ld to chock
# REVISION MADE BY P.J. 9.1.1992: dfproto.h removed !
#$(UTILS)::  df.h dfi.h dfproto.h
$(UTILS)::  df.h dfi.h
	${CC} ${CFLAGS} $@.c ${LDFLAGS} ${LIBS} ${GLIBS} -o $@

# dist will move files from current directory to source directory
# install will move files from current dir to bin, lib and include directories
# It is expected that make will usually run in srcdir, so only install and
# cleanup will be necessary

dist: $(HFILES) $(CFILES) $(FFILES) Makefile
	cp $(HFILES) $(CFILES) $(FFILES) $(UFILES) Makefile $(SRCDIR)

install:
	-awk '/\/\* &&& Replace this line with \#define MachineType &&& \*\// { print "#define IRIS4"; next} {print $0}' < dfi.h > dfitemp.h
	-mv dfitemp.h dfi.h
	-mkdir $(INCDIR)
	cp $(HFILES) $(INCDIR)
	-mkdir $(LIBDIR)
	cp $(LIBS) $(LIBDIR)
	-mkdir $(BINDIR)
	cp $(UTILS) $(BINDIR)

clean:
	-${RM} *.o

cleanup:
	-${RM} $(OFILES) $(LIBS) $(UTILS)

lint:
	lint -u -D$(MACHINE) $(CFILES)


libsrc: $(HFILES) $(CFILES) $(FFILES)

src: libsrc $(UFILES)
