#
#	Makefile for draw
#	Copyright (C) 1988, 1989 by Juha Takala
#	jta@sah.vtt.fi

# 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.

# 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
# the file "License" for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Send bug reports and suggestions to:
#	jta@sah.vtt.fi
#
# $Id: Makefile,v 2.7 89/12/11 09:24:39 jta Exp $
#

SRCS	= dr_lib.h dr_lib.c draw.c
DOCS	= README draw.1 License
MAKES	= Makefile makefile.dos
OTHERS	= koe koe.dat vttlogo kiero.c 
GETOPTSRC = getopt.c getopt.l3
KIT	= $(DOCS) $(SRCS) $(MAKES) $(OTHERS) $(GETOPTSRC)

########## BEGINning of configuration section #############

CC = cc

# Choose one.  UNIX (SysV) and MSDOS are tested, BSD should be easy, and VMS
# has also been done a long time and many versions ago
OS = -DUNIX
#OS = -DMSDOS
#OS = -DVMS

# SYSV shared libraries work in my system!  Take it or leave it.
LIBSH	= -lc_s

# Choose of these; gcc allows both:
#DEBUG = -g
DEBUG = -O

# Do define this if you want *NIX plot(3) interface calls
PLOT = -DPLOT

# Do define this if you want LIBGL.  It is a library that will handle ega
# etc.  Look for its docs.  
GL_LIB = -DGL_LIB

# Where to find gl_plot() funtions.  If you didn't define GL_LIB,
# you don't need this, either
LIBGL	= ../gl_plot/gl.a

# Standard *NIX plot(3) library spec.  This might also be -l4014 for
# direct tek4014 output.  See plot(3).
LIBPLOT = -lplot

# If you don't have getopt library, use this.  This is the one that has been
# posted into netland long ago.  I guess MS-DOSsers need this.
# GETOPT = getopt.o

CI = ci
CO = co
SHAR = makekit -s10k
TAR = gtar -zcf draw.zar

################## END of configuration section ###################

CFLAGS	= $(DEBUG) $(GL_LIB) $(OS) $(PLOT)

# Collection of libraries to give ld
LIBS	= $(LIBGL) $(LIBPLOT) $(LIBSH) -lm

OBJS	= draw.o dr_lib.o $(GETOPT)

draw:	$(OBJS) $(LIBGL)
	cc $(CFLAGS) -o $@ $(OBJS) $(LIBS)

$(OBJS): dr_lib.h

demo:	kiero draw
#	kiero | ./draw -tplot | tplot -T4014
# maybe it is better to leave the fun to be done by hand...

# the name is finnish and means 'screwed'
kiero:	kiero.c
	cc -o kiero kiero.c -lm $(LIBSH)

ci:	;		for i in $(KIT); do $(CI) $$i </dev/null; done
co:	;		for i in $(KIT); do $(CO) $$i; done

kit:	$(KIT);		$(SHAR) $(KIT)
zar:	$(KIT);		$(TAR) $(KIT)
lint:	;		lint $(CFLAGS) $(SRCS)
