# Generated automatically from Makefile.in by configure.
#
# $Id: Makefile.in,v 1.9 1994/08/04 23:27:02 sls Exp $
#
# This software is copyright (C) 1994 by the Lawrence Berkeley Laboratory.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
# 

DESTDIR		= /home/ux5/ux5g/icsd/sls/sw/narray.sun4.sos5
BINDIR		= /home/ux5/ux5g/icsd/sls/sw/narray.sun4.sos5/bin
LIBDIR		= /home/ux5/ux5g/icsd/sls/sw/narray.sun4.sos5/lib

TCL_INCLUDE	= -I/vol/pub/tcl-7.3/include
TCL_LIBS	= -L/vol/pub/tcl-7.3/lib -ltcl

TK_INCLUDE	= -I/vol/pub/tk-3.6p1/include
TK_LIBS		= -L/vol/pub/tk-3.6p1/lib -ltk

X11_INCLUDE	= -I/vol/packages/X11R5.pl25/include
X11_LIBS	= -L/vol/packages/X11R5.pl25/lib -lX11

NETCDF_INCLUDE	= -I/home/ux5/ux5g/icsd/sls/sw/netcdf.sun4.sos5/include
NETCDF_LIBS	= -L/home/ux5/ux5g/icsd/sls/sw/netcdf.sun4.sos5/lib -lnetcdf

DEFS		=  -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDARG_H=1 -DWITH_NETCDF=1 -DLIBRARY_DIR=\"/home/ux5/ux5g/icsd/sls/sw/narray.sun4.sos5/lib\"

COPTS		= -O
CFLAGS		= $(COPTS) $(DEFS) $(TCL_INCLUDE) $(TK_INCLUDE)  \
		  $(NETCDF_INCLUDE) $(X11_INCLUDE)

EXTRA_LIBS 	=  -lsocket -lnsl -lm

RANLIB		= :

TCL_SRC		= $(wildcard *.tcl)

SRC		= narray.c natclsh.c code.c functions.c parse.y scan.c \
		  narray.h narrayInt.h

CC		= gcc -fwritable-strings -Wall

YACC		= yacc -v -t -l

all: natclsh nawish libnarray.a

libnarray.a: narray.o code.o functions.o parse.o scan.o
	ar rv libnarray.a narray.o code.o functions.o parse.o scan.o
	$(RANLIB) libnarray.a

nawish: nawish.o libnarray.a
	$(CC) -o $@ nawish.o libnarray.a \
	$(TK_LIBS) $(TCL_LIBS) $(NETCDF_LIBS) $(X11_LIBS) $(EXTRA_LIBS)

natclsh: natclsh.o libnarray.a
	$(CC) -o $@ natclsh.o libnarray.a \
	$(TCL_LIBS) $(NETCDF_LIBS) $(EXTRA_LIBS)

clean:
	rm -f *.o *~ parse.c parse.h natclsh nawish y.output libnarray.a
	cd www-demo; make clean

metrics:
	@echo "### C code in `echo $(SRC) | wc -w` files"
	@wc $(SRC)

parse.c: parse.y
	$(YACC) -d $<
	rm -f parse.c parse.h
	mv y.tab.c parse.c
	mv y.tab.h parse.h

install: all
	@echo "### Making directories"
	@-mkdir $(DESTDIR)
	@-mkdir $(DESTDIR)/include
	@-mkdir $(DESTDIR)/man
	@-mkdir $(DESTDIR)/man/mann
	@-mkdir $(BINDIR)
	@-mkdir $(LIBDIR)
	@-chmod 0755 $(DESTDIR) $(DESTDIR)/include $(DESTDIR)/man \
		$(DESTDIR)/man/mann $(BINDIR) $(LIBDIR)
	@echo "### Copying files"
	rm -f $(LIBDIR)/libnarray.a
	cp libnarray.a $(LIBDIR)
	chmod 0644 $(LIBDIR)/libnarray.a
	$(RANLIB) $(LIBDIR)/libnarray.a
	rm -f $(BINDIR)/natclsh
	cp natclsh $(BINDIR)
	chmod 0555 $(BINDIR)/natclsh
	rm -f $(BINDIR)/nawish
	cp nawish $(BINDIR)
	chmod 0555 $(BINDIR)/nawish
	rm -f $(DESTDIR)/include/narray.h
	cp narray.h $(DESTDIR)/include
	chmod 0444 $(DESTDIR)/include/narray.h
	rm -f $(DESTDIR)/man/mann/narray.n
	cp narray.man $(DESTDIR)/man/mann/narray.n
	chmod 0444 $(DESTDIR)/man/mann/narray.n
	rm -f $(LIBDIR)/narray.tcl
	cp narray.tcl $(LIBDIR)
	chmod 0444 $(LIBDIR)/narray.tcl
	rm -f $(LIBDIR)/tclIndex
	./natclsh mkindex.tcl $(LIBDIR)

narray.o: narray.c narray.h narrayInt.h
natclsh.o: natclsh.c narray.h
nawish.o: nawish.c narray.h
parse.o: parse.c narray.h narrayInt.h
code.o: code.c narray.h narrayInt.h
scan.o: scan.c narray.h narrayInt.h
functions.o: functions.c narray.h narrayInt.h
