#
# Makefile for sort_xvgr for sunsort 3.03
#
##################################
DESTDIR = . 
VERS = 

# Location of libraries
#LIBS = -L/usr/local/X11R5/lib -lxview -lolgx -lX11 -lm
#SVR4
LIBS = -lmalloc -L/usr/openwin/lib -lxview -lolgx -lX11 -lm 

#
# xvgr now has context sensitive help, see the User's manual
# on using this feature. OpenWindows has a spot for this.
HELPDIR = /usr/local/help

#
# standard location for systems using OpenWindows rather than MIT X
INCLUDES = -I/usr/openwin/include -I../sunsort_src
# this is where we have them
#INCLUDES = -I/usr/include/xview
#INCLUDES = -I/usr/local/X11R5/include

#CC = /usr/ucb/cc
CC = cc

MY_OSVERSION = -DSVR4 -g
#MY_OSVERSION =

#################################

# Install a printer
#

# The default is PostScript landscape using "lpr -h" to spool
# if this is OK then skip this Steps 1 and 2

# Step 1.
#
# To install the default hardcopy device uncomment ONE of the
# following (HARDCOPYDEV lines), the hardcopy device can also 
# be set using environment variables, and on the command line:
#
# PostScript landscape [device number 1]
HARDCOPYDEV = -DHDEV=GR_PS_L 
#
# PostScript portrait [device number 2]
#HARDCOPYDEV = -DHDEV=GR_PS_P 
#

# Step 2.
#
# To install the printer for the hardcopy devices above
# set the following to the appropriate values for your site.
# These can also be set by environment variables. The current
# definitions of these variables are the same as the definitions
# in the drivers, ps.c (PostScript), and mif.c (Maker 
# Interchange format).
# 
# For Postscript
# 
#PS_PRSTR = -DPS_PRSTR='"lpr -h "'
PS_PRSTR = -DPS_PRSTR='"lp -o nobanner -c"'

###############################
# End installation parameters #
###############################

# experimenting with drag 'n drop
#DND = -DDND

CFLAGS = -DLOCAL -DXVIEW $(MY_OSVERSION) $(INCLUDES) \
$(HARDCOPYDEV) $(PS_PRSTR) -g

# pars.c is now built outside this Makefile
# YFLAGS = -yt

SRCS =  main.c\
	events.c\
	alerts.c\
	fileswin.c\
	printwin.c\
	compwin1.c\
	compwin2.c\
	plotone.c\
	files.c\
	utils.c\
	drawticks.c\
	io.c\
	graphutils.c\
	graphutils2.c\
	setutils.c\
	objutils.c\
	defaults.c\
	checkon.c\
	xvlib.c\
	draw.c\
	ps.c\
	worldwin.c\
	labelwin.c\
	tickwin.c\
	symwin.c\
	setwin1.c\
	graphwin1.c\
	chersh.c

OBJS =  main.o\
	events.o\
	alerts.o\
	fileswin.o\
	printwin.o\
	compwin1.o\
	compwin2.o\
	plotone.o\
	files.o\
	utils.o\
	drawticks.o\
	io.o\
	graphutils.o\
	graphutils2.o\
	setutils.o\
	objutils.o\
	defaults.o\
	checkon.o\
	xvlib.o\
	draw.o\
	ps.o\
	worldwin.o\
	labelwin.o\
	tickwin.o\
	symwin.o\
	sort_io.o\
	setwin1.o\
	graphwin1.o\
	chersh.o

D3DINCS = defs.h

# for printing and making a distribution
#
INCS = defines.h externs.h globals.h pars.h symdefs.h f2c.h patterns.h icon.h icon_mask.h patchlevel.h
HERSHINCS = hersh.h special.h
DISTDIR = sort_xvgr

sort_xvgr: $(OBJS)
	$(CC) $(OBJS) -o sort_xvgr -g $(LIBS) 

main.o: Makefile defines.h globals.h
xvgr.o: defines.h globals.h
pars.o: pars.c defines.h globals.h
calc.o: defines.h globals.h
compute.o: defines.h globals.h
fit.o: defines.h
files.o: defines.h globals.h
io.o: defines.h

params.o: defines.h globals.h 
getparams.o: defines.h globals.h 

plotone.o: defines.h globals.h symdefs.h
drawticks.o: defines.h globals.h 

utils.o: defines.h globals.h
setutils.o: defines.h globals.h
setprops.o: defines.h globals.h
regionutils.o: defines.h globals.h
graphutils.o: defines.h globals.h
graphutils2.o: defines.h globals.h
objutils.o: defines.h globals.h 
stubs.o: defines.h globals.h

checkon.o: defines.h globals.h 

#
# user interface
#
graphwin.o: defines.h globals.h
compwin.o: defines.h globals.h
nonlwin.o: defines.h globals.h
setwin.o: defines.h globals.h
framewin.o: defines.h globals.h
strwin.o: defines.h globals.h
worldwin.o: defines.h globals.h
symwin.o: defines.h globals.h
ptswin.o: defines.h globals.h
editpwin.o: defines.h globals.h
drawwin.o: defines.h globals.h
statuswin.o: defines.h globals.h patchlevel.h
printwin.o: defines.h globals.h
labelwin.o: defines.h globals.h
locatewin.o: defines.h globals.h
fileswin.o: defines.h globals.h
blockwin.o: defines.h globals.h
eblockwin.o: defines.h globals.h
parmsiowin.o: defines.h globals.h
comwin.o: defines.h globals.h

defaults.o: defines.h globals.h

#
# graphics drivers
#
chersh.o: hersh.h special.h
draw.o: symdefs.h
mif.o: externs.h
hp.o: externs.h
ps.o: externs.h
xvlib.o: externs.h
leaf.o: externs.h

#globals.h: pars.h

#pars.h:
#	bison -dyt pars.yacc
#	/bin/mv y.tab.h pars.h

sort_io.o:
	$(CC) $(CCFLAGS) -c -g ../sunsort_src/sort_io.c -o sort_io.o

lint:
	lint  $(INCLUDES) $(SRCS)

clean: 
	-/bin/rm -f $(OBJS) core *~ *%

tarfile:
	tar cvf $(DISTDIR).tar $(DISTDIR)
	compress $(DISTDIR).tar

install: sort_xvgr
	-rm -f ../sort_xvgr
	mv sort_xvgr ../sort_xvgr
	echo "install sort_xvgr completed ..."


