#
# "VIEW", a data viewing program, version 1.14
#   Copyright (C) 1987, 1990 California Institute of Technology.
#   Original authors: Dave Gillespie, port by Rick Koshi
#   Unix Port Maintainer: John Lazzaro
#   Maintainers's address: lazzaro@cs.berkeley.edu
#
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation (Version 1, Feb 1989).
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; see the file COPYING.  If not, write to
#the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
#
#

## comment blocks in this Makefile point to possible changes that need
## to be made for different systems. Its a good idea to look over each
## block and make necessary changes before doing a "make install"

LOCINC = ../psys/include

##
## If X isn't in the include path (the case for many MachTen and Linux 
## installations) change XINCLUDEDIR to reflect this:
##
## XINCLUDEDIR = /usr/X11R6/include
##
## or maybe
##
## XINCLUDEDIR = /usr/X11/include
##
## or some other directory, depending on your installation.
##

XINCLUDEDIR = .

##
## If X isn't in the library path (the case for many MachTen and Linux 
## installations) change LIBX11 to reflect this:
##
## LIBX11 = -L/usr/X11/lib -lX11
##
## or maybe
##
##  LIBX11 = -lX11 -L/usr/X11R6/lib
##
## depending on your installation. 
##

LIBX11 = -lX11

LIBP2C = ../psys/src/libp2c.a

##
## (1) Library additions
## ---------------------
##
## on some systems, -ldl must be added to the following line
##
## on Sun Solaris 2.X, -lsocket -lnsl must be added to OTHERLIBS

OTHERLIBS= -lm  

##
## (2) IEEE library directory
## --------------------------
##
## If you are using view as an HPIB-based tool, with the IOTech Sun HPIB
## card, change IEEEDIR to point to
## the correct place. For example, this is how mine used to look back
## when I had a HPIB board ...
##
## IEEEDIR = ../iotech/sun4c/4.1c/ieeeio.o

IEEEDIR =

##
##  (3) Choosing your compiler
##  ---------------------------
##
## For Sun SPARC, HP series 300/400, Apple AU/X,  gcc is recommended, 
## most 2.XX and 1.XX work well.
##
## For DEC MIPS-based Ultrix, a "stable" gcc 2.X.X is recommended
##  
##
## For HP series 700/800 (extra-cost) ANSI cc is recommended (see below for
##  options). HP's non-ANSI cc will not work, and gcc presently has some
##  problems with <varargs.h>. For version 8.05 (and earlier) of HP ANSI cc
##  you will need a patch tape from HP to fix compiler bugs; alternatively,
##  you can get around the problem by compile the file math.c 
##  with the gcc 2.XX compiler. 
##
## For IBM RS/6000, xlc is recommended (see below for options)
##
## For Linux & FreeBSD, gcc 2.X.X is recommended (see below for options)
##
## For SGI machines, cc is recommended.
##
##
## For AmigaOS, ADE (Amiga Development Enviroment) with gcc is recommended.
##
  
  


CHIPMUNKCC = gcc -O3

CC = $(CHIPMUNKCC) 

##
## (4) Adding appropriate flags
## -----------------------------
##
## for HP series 800 (using cc), add these flags to CHIPMUNKFLAGS
##  -w -Aa -D_HPUX_SOURCE -DF_OK=0
##
## for IBM RS/6000 (using xlc) add these flags 
##  -DBSD=0
##
## for AU/X, add this flags 
##  -Daux
##
## for linux gcc 2.3.3 using xfree1.1 Xserver, add these flags 
## 
##
## -DBSD -Dlinux -DF_OK=0 
##
## also add the flag
##
## -m486 
##
## if you are running on a 486-compatable CPU. For maximum speed, try the
## flags -fomit-frame-pointer -O6; however, the former flag will make it
## difficult for you to track down any bugs that occur while using the
## tools, and the latter will expose you to possible optimizer bugs. However,
## our alpha-testers have reported no problems using these two flags.
##
##
## For freeBSD, add the following flags 
##
##  -DBSD -Dfreebsd -Dlinux -DF_OK=0 -m486 
##
## for SGI add these flags 
##
## CFLAGS =  -ansi 
##
##
## for AmigaOS using gcc, add these flags 
##
## -ansi -DBSD -DF_OK=0
##
## to increase speed, try to add -O3 and, based on your CPU, one of these
##
##   -m68020              : for 68020
##   -m68020 -m68881      : for 68020+6888x
##   -m68030              : for 68030
##   -m68030 -m68881      : for 68030+6888x
##   -m68040              : for 68040 and 68060
##
## if you are using X shared library with ADE, see notes below
## in view rule
##

CHIPMUNKFLAGS = 
  
CFLAGS= $(CHIPMUNKFLAGS) -I$(LOCINC) -I$(XINCLUDEDIR) -DF_OK=0

LDFLAGS= $(LIBP2C) $(LIBX11) $(OTHERLIBS) 
MYLDFLAGS= $(LIBP2C)  $(IEEEDIR) $(LIBX11)  $(OTHERLIBS)
BINDIR= ../bin

OBJS =			\
	viewfit.o	\
	viewfuncs.o	\
	viewmod.o	\
	rhkstuff.o	\
	viewcmds.o	\
	viewconf.o	\
	viewctrl.o	\
	viewcurves.o	\
	viewmain.o	\
	tool3.o		\
	tool4.o		\
	tool5.o		\
	tool6.o		\
	tool7.o		\
	tool8.o		\
	tool9.o		\
	tool10.o	\
	tool11.o	\
	tool12.o	\
	tool13.o	\
	tool14.o	\
	tool15.o	\
	tool16.o	\
	tool17.o	\
	tool18.o	\
	tool19.o	\
	tool20.o	

MYOBJS =			\
	mt/mytool1.o		\
	mt/mmmt.o		\
	mt/fcmt.o		\
	mt/fgmt.o		\
	mt/mt.o			\
	tek2430/mytool2.o	\
	tek2430/take2430.o	\
	tek2430/tek2430.o	

STDOBJS = tool1.o		\
	  tool2.o


view:   $(OBJS) $(STDOBJS)
	$(CC) $(CFLAGS) $(OBJS) $(STDOBJS) $(LDFLAGS)  -o view


# The following permits you to link properly with AmigaOS and 
# X shared libraries used in ADE
# 
#view:   $(OBJS) $(STDOBJS)
#	prelink $(LIBX11)
#	$(CC) -Tshared.x -Wa,-s $(CFLAGS) $(OBJS) $(STDOBJS) $(LDFLAGS)  -o view
#	postlink view
#	rm shared.x xlibs.c xlibs.o
  
clean:
	-rm -f *.o view

mtlink:   $(OBJS) 
	$(CC) $(CFLAGS) $(OBJS) $(MYOBJS) $(MYLDFLAGS) -o view

myview:	
	(chdir mt;	make; chdir ..; chdir tek2430; make; chdir ..; make mtlink)

install: view
	cp view $(BINDIR)/vc

myinstall: myview
	cp view ../bin/myview



## The following part of the Makefile is for making a tar file of the
## original parts of the view distribution. Most users have no need for it.

VERSION = 1.14

dist:
	rm -rf view
	mkdir view
	cp COPYING Makefile README view/
	cp *.c *.h view/
	sed -e "s;1.14;$(VERSION);" Makefile > view/Makefile
	sed -e "s;1.14;$(VERSION);" viewconf.h > view/viewconf.h
	cp -R lib man mt tek2430 view/

tardist:
	tar cvf view.tar view
	rm -f view.tar.gz
	gzip view.tar

create: dist tardist 



