# Makefile for OASIS Decode routine
# Author:   Bob Herlien
# Project:  OASIS Moorings
# Created:  11/24/91
#

## rules

.s.o :
	@rm -f $@
	$(AS) -o $<

.c.o :
	@rm -f $@
	$(CC) $(CFLAGS) $<


## files and directories

MAKEFILE	= Makefile
ARCHIVE		= decode.tar

INCLUDES	= decode.h

SOURCES		= decode.c extract.c file.c range.c atlas.c ctd.c spec.c port.c

OBJECTS		= $(SOURCES:.c=.o)

ALLFILES	= $(MAKEFILE) $(INCLUDES) $(SOURCES)

## tools
CC		= cc
LD		= cc
RM		= rm -f
PRINT		= pr

## flags

INCLUDEFLAGS	= -I. -I/usr/include
DEBUGFLAG	= 
CFLAGS		= -c -Aa $(DEBUGFLAG) $(INCLUDEFLAGS) -D_HPUX_SOURCE
LDFLAGS		=
FFLAGS		= +E1 $(DEBUGFLAG)
LIBS		= -lM


## actions

default : decode

print	: 
	  $(PRINT) $(ALLFILES) | remsh hp850 lp -opr

$(ARCHIVE).Z: $(ALLFILES)
	  $(RM) $(ARCHIVE) $(ARCHIVE).Z
	  tar crvf $(ARCHIVE) $(ALLFILES)
	  compress $(ARCHIVE)

tar	: $(ARCHIVE).Z

rel1:
	  ci -q -u$(REV) $(MAKEFILE) $(INCLUDES) $(SOURCES:decode.c=)

release :
	  rcs -l $(ALLFILES)
	  ci -f -u$(REV) decode.c
	  @echo "Ignore ci warnings that unchanged file checkins are aborted"
	  make rel1 REV=`rlog decode.c | awk '$$1 == "head:" {print $$2}'`
	  rcs -u $(ALLFILES)
	 
clean	:
	  $(RM) *.o


## dependencies

$(OBJECTS): $(INCLUDES)

extract : extract.o file.o range.o atlas.o ctd.o no3.o spec.o
	 $(RM) extract
	 $(LD) -o extract $(LDFLAGS) extract.o file.o range.o atlas.o ctd.o \
		no3.o spec.o $(LIBS)

decode : decode.o file.o atlas.o ctd.o spec.o
	 $(RM) decode
	 $(LD) -o decode $(LDFLAGS) decode.o file.o atlas.o ctd.o spec.o $(LIBS)

decodeb : decodeb.o
	 $(RM) decodeb
	 $(LD) -o decodeb $(LDFLAGS) decodeb.o

hexdecode : hexdecode.o
	 $(RM) hexdecode
	 $(LD) -o hexdecode $(LDFLAGS) hexdecode.o

m1 :	m1.o
	$(RM) m1
	$(LD) -o m1 $(LDFLAGS) m1.o $(LIBS)

m2 :	m2.o
	$(RM) m2
	$(LD) -o m2 $(LDFLAGS) m2.o $(LIBS)

drifter : drifter.o
	$(RM) drifter
	$(LD) -o drifter $(LDFLAGS) drifter.o $(LIBS)

getoasis : getoasis.o port.o range.o
	$(LD) -o getoasis $(LDFLAGS) getoasis.o port.o range.o $(LIBS)

getctd : getctd.o ctd.o
	 $(RM) getctd
	 $(LD) -o getctd $(LDFLAGS) getctd.o ctd.o $(LIBS)

calsh6 : calsh6.f
	 f77 -o$(PROGRAM) $(FFLAGS) $@

chktmp  : chktmp.c
	  cc -o chktmp $(CFLAGS) chktmp.c $(LIBS)

foo :   foo.o port.o range.o
	$(LD) -o foo $(LDFLAGS) foo.o port.o range.o $(LIBS)

