# $Id: Makefile,v 1.7 1997/11/17 16:31:44 russ Exp $
#
#	Development Makefile for netcdf c++ interface
#

include ../macros.make

INCLUDES	= -I../libsrc

PACKING_LIST	= Makefile README depend example.c example.cc \
		  nctst.cc ncvalues.cc ncvalues.hh netcdf.cc netcdf.hh \
		  expected cxxdoc.tex cxxdoc.ps texinfo.tex

LIBRARY		= libnetcdf_c++.a
lib_netcdf	= ../libsrc/libnetcdf.a
ld_netcdf	= -L../libsrc -lnetcdf

HEADER1		= netcdf.hh
HEADER2		= ncvalues.hh

libs		=  $(LIBRARY) $(ld_netcdf) $(LIBS)

purify		= purify

LIB_OBJS	= netcdf.o ncvalues.o

# a test program that uses some of the draft C++ interface
prog		= nctst

prog_objs 	= nctst.o
GARBAGE		= $(prog) test.out example.nc \
		  *.cps *.dvi *.fns \
		  *.log *~ *.gs *.aux *.cp *.fn *.ky *.pg *.toc *.tp *.vr

all:		$(LIBRARY) $(prog)

test:	 $(prog) FORCE
	./$(prog) > test.out
	@cmp expected test.out && \
	    echo "*** C++ test successful ***" ;

install:	$(LIBDIR)/$(LIBRARY) $(INCDIR)/$(HEADER1) $(INCDIR)/$(HEADER2)

$(prog) : $(prog_objs) $(LIBRARY) $(lib_netcdf)
	$(CXX) -o $@ $(CXXCPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(prog_objs) $(libs)

nctst_src: nctst.cc netcdf.cc ncvalues.cc
	#load -I../libsrc $(nctst_src)
	#load -L../../lib ../../lib/libnetcdf.a
	#link

# dvips is part of the TeX package
dvips		= dvips
# texi2dvi and makeinfo are part of the texinfo package
texi2dvi	= texi2dvi
makeinfo	= makeinfo
# texi2html is available from http://wwwcn.cern.ch/dci/texi2html/
texi2html	= texi2html

print: nctst.cc netcdf.hh netcdf.cc ncvalues.hh ncvalues.cc
	vgrind -s11 -lC++ -t nctst.cc netcdf.hh netcdf.cc ncvalues.hh \
				ncvalues.cc | lpr
ps: cxxdoc.ps

info: cxxdoc.info

html: cxxdoc.html

cxxdoc.ps:	cxxdoc.tex
	$(texi2dvi) cxxdoc.tex
	$(dvips) -D 300 -o cxxdoc.ps cxxdoc.dvi

cxxdoc.info: cxxdoc.tex
	$(makeinfo) cxxdoc.tex

cxxdoc.html:	cxxdoc.tex
	$(texi2html) cxxdoc.tex

nctst.pure:	$(prog_objs)
	$(purify) $(LINK.cc) $(prog_objs) $(libs) -o $@

include ../rules.make

netcdf.o: netcdf.hh ../libsrc/netcdf.h netcdf.cc
ncvalues.o: ncvalues.hh ncvalues.cc
nctst.o: netcdf.hh nctst.cc

include depend

