# Makefile for ncdump(1).
#
# $Id: Makefile,v 1.10 1997/08/05 19:55:42 russ Exp $

include ../macros.make

# Override the default definition for ncgen(1) in the master makefile.
#
NCGEN		= ../ncgen/ncgen

INCLUDES	= -I../libsrc

c_sources	= ncdump.c vardata.c dumplib.c
headers		= ncdump.h vardata.h dumplib.h

PROGRAM		= ncdump

PACKING_LIST	= $(c_sources) $(headers) depend \
		  test0.cdl ncdump.1 Makefile
MANUAL		= ncdump.1

lib_netcdf	= ../libsrc/libnetcdf.a
ld_netcdf	= -L../libsrc -lnetcdf
OBJS		=  ncdump.o vardata.o dumplib.o
GARBAGE		= $(PROGRAM) test0.nc test1.nc test1.cdl test2.cdl

all:		$(PROGRAM)

$(PROGRAM):	$(lib_netcdf) $(OBJS)
	$(LINK.c) $(OBJS) $(ld_netcdf) $(LIBS) 

test:		$(PROGRAM) FORCE
	$(NCGEN) -b test0.cdl
	./$(PROGRAM) -n test1 test0.nc > test1.cdl
	$(NCGEN) -b test1.cdl
	./$(PROGRAM) test1.nc > test2.cdl
	@cmp test1.cdl test2.cdl && \
	     echo "*** $(PROGRAM) test successful ***"

install:	$(BINDIR)/$(PROGRAM) $(MANDIR)/man1/$(MANUAL)

$(PROGRAM)_oc : $(c_sources)
	#setopt primary_language C
	#load -C $(CPPFLAGS) $(c_sources)
	#load -C $(LIBS)
	#setopt program_name $(PROGRAM)

TAGS:		FORCE
	etags `echo $(PACKING_LIST) | fmt -1 | egrep '\.c|\.h'

include ../rules.make
include depend
