#
#       Makefile for ncdflib
#

# suffix rules

.SUFFIXES : .o .f

.f.o :
	$(FC) $(FFLAGS) -c $<

# macro definitions

FC		= frt
FFLAGS		= -O
LD		= ld
LDFLAGS		= 
LDLIBS		= 
AR		= ar
ARFLAGS		= vru
RANLIB		= ranlib
#RANLIB		= touch

LIBFILE		= libnx.a

LIBNAME		= ncdflib
LIBFSRCS	= nxopen.f nxdefm.f nxclos.f nxfilm.f nxddef.f nxdqsz.f \
		  nxvdef.f nxvp1x.f nxvg1x.f nxvp1c.f nxvg1c.f nxvpnx.f \
		  nxvgnx.f nxvpnc.f nxvgnc.f nxvpax.f nxvgax.f nxvpac.f \
		  nxvgac.f nxaptx.f nxagtx.f nxaptc.f nxagtc.f 
LIBDSRCS	= lenc.f   indxcf.f indxmf.f nindxc.f lchreq.f \
		  msgdmp.f mszdmp.f
#LIBSRCS	= $(LIBFSRCS) $(LIBDSRCS)
LIBFOBJS	= nxopen.o nxdefm.o nxclos.o nxfilm.o nxddef.o nxdqsz.o \
		  nxvdef.o nxvp1x.o nxvg1x.o nxvp1c.o nxvg1c.o nxvpnx.o \
		  nxvgnx.o nxvpnc.o nxvgnc.o nxvpax.o nxvgax.o nxvpac.o \
		  nxvgac.o nxaptx.o nxagtx.o nxaptc.o nxagtc.o 
LIBDOBJS	= lenc.o   indxcf.o indxmf.o nindxc.o lchreq.o \
		  msgdmp.o mszdmp.o
LIBOBJS		= $(LIBFOBJS) $(LIBDOBJS)


nxpack: $(LIBFOBJS)

dcllib: $(LIBDOBJS)

all: nxpack dcllib

install: archive ranlib

archive:
	@$(AR) $(ARFLAGS) $(LIBFILE) *.o

ranlib:
	$(RANLIB) $(LIBFILE)

pack: $(LIBNAME).all

$(LIBNAME).all: $(LIBSRCS) LIBLIST HEADER
	@./libpack $(LIBNAME).all

clean:
	$(RM) *.o *~ $(LIBNAME).all $(LIBFILE)
