#
# 	makefile for AMIGA GCC 
#
#
#

# where to install help file gnuplot.gih
HELPDEST=\"GNUPLOT:docs/gnuplot.gih\"
# Where to send email about bugs and comments (locally)
EMAIL=\"bug-gnuplot@dartmouth.edu\"

# based on
# Manx Aztec C v5.2 makefile
#
# PROTOTYPE__P __P is already defined
# STRNCASECMP  gnu should have it
# MY_TERMINALS lets see something
# PIPES maybe it will work ?
#

############################################################
# Explanations of CFLAGS definitions.
#  These should not need to be changed by you.
# They are set correctly for each machine below. If your machine
# doesn't fit the one of the patterns, override on the make command
# line or make a new target for it and a new _FLAGS definition.
#  -DBZERO if you need to use bzero() instead of memset()
#  -DBCOPY if your memcpy() is called bcopy()
#  -DNOCOPY if you don't have a memcpy() by any name
#  -DSTRNICMP if you have strnicmp()
#  -DSTRNCASECMP if you have strncasecmp() (GNU Libc, bsd)
#  -DGAMMA=foo if your gamma function is called foo(). Apollos and
#    Linux have lgamma(3m). The default is -DGAMMA=gamma.
#  -DGETCWD if your unix uses getcwd() instead of getwd()
#    this is needed by HP-UX and Cray Unicos systems.
#  -DULTRIX_KLUDGE if you run X windows on Ultrix and experience the
#    "every other plot" problem.
#  -DCRIPPLED_SELECT if "select errors" are encountered with X. This
#    option is needed on SVR3 platforms with incomplete support for
#    the BSD select() system call
#  -DXPG3_LOCALE if your system uses the 'setlocale' function to
#    support foreign charactersets (currently only ISO8859-1).
#  -Dunix is required to explicitly define "unix" for SCO and IBM
#          RS/6000 running AIX 3.2
#  -DNO_STDLIB_H if you are missing the stdlib.h header (old bsd systems)
#  -DNO_SYS_TYPES_H if you don't have sys/types.h
#  -DNO_STRCHR if you have index instead of strchr
#  -DNO_STRIN_H if you have strings.h instead of string.h
#  -DHAVE_UNISTD_H if you have unistd.h
#  -DHAVE_LIBC_H if you have libc.h (NeXT)
#  -DNO_ERRNO_H if you don't have errno.h
#  -fswitch if you are compiling on a Sun3 (or even -f68881)
#    (but -fswitch is buggy on some systems, so watch out)
#  -DRETSIGTYPE=int if the argument to signal is an int function
#  -DSIGFUNC_NO_INT_ARG if the signal function may not have an int argument
#  -DHAVE_STRERROR if your library includes strerror


##
## amiga gcc provides a unistd.h so it should work -DHAVE_UNISTD_H but
## there are collisions with the os-includes so avoid it
##

CC     = gcc
#CFLAGS = -c -m68030 -m68881  -DNOGAMMA -DPROTOTYPE__P  -DMY_TERMINALS -DOLD_TERMINALS
#CFLAGS = -c -m68030 -m68881  -DNOGAMMA -DPROTOTYPE__P  -DAMIGA 
DEFS = -DNOGAMMA -DPROTOTYPE__P  -DRETSIGTYPE=void -DSTRNCASECMP
#DEFS = -DPROTOTYPE__P -DREADLINE -DNOCWDRC -DX11 -DOLD_SELECT -DNO_STRING_H -DNO_STDLIB_H -DNO_SYS_TYPES_H -DNO_LIMITS_H -DNO_ERRNO_H  -DEXTERN_ERRNO -DRETSIGTYPE=void -DGAMMA=gamma -DBCOPY -DBZERO -DNO_STRCHR -Dunix -DAUTOCONF  
CFLAGS = -c -m68030 -m68881  -DAMIGA $(DEFS)

#
# here are the linker options
#
LD   = gcc
LDFLAGS = -s
#LIBS = -lm

#### this is only for the beta release

BETA = beta

#
# Terminal (device) support --- see term.h
#

TERMFLAGS = -Iterm -I. -DAMIGASCREEN -DMY_TERMINALS

#	maybe here is a error in the actec makefile somefiles are missing
#
# List of object files except term.o, version.o
#
# NOTE:	 the util3d.o hidden3d.o plot3d.o are missing 
# but	plot2d.c plot3d.c where found in objectlist 
#
#OBJS = binary.o bitmap.o command.o contour.o eval.o graphics.o \
#	   graph3d.o help.o internal.o misc.o parse.o plot.o plot2d.c plot3d.c scanner.o \
#	   set.o show.o specfun.o standard.o util.o interpol.o fit.o matrix.o \
#	   datafile.o alloc.o

OBJS = binary.o bitmap.o command.o contour.o eval.o graphics.o \
	   graph3d.o help.o internal.o misc.o parse.o plot.o plot2d.o plot3d.o scanner.o \
	   set.o show.o specfun.o standard.o util.o interpol.o fit.o matrix.o \
	   datafile.o alloc.o util3d.o hidden3d.o

#
# List of sources
#
CSOURCE1 = binary.c command.c setshow.c 

# added 
# util3d.c hidden3d.c here
CSOURCE2 = help.c graphics.c graph3d.c internal.c util3d.c hidden3d.c
CSOURCE3 = misc.c eval.c parse.c plot.c plot2d.c plot3d.c readline.c scanner.c standard.c 
CSOURCE4 = bitmap.c term.c util.c version.c fit.c matrix.c
CSOURCE5 = term/amiga.trm term/aed.trm term/cgi.trm term/dumb.trm term/dxf.trm \
	term/dxy.trm term/eepic.trm term/epson.trm term/fig.trm \
	term/hp26.trm term/hp2648.trm term/hpgl.trm term/hpljii.trm \
	term/apollo.trm term/gpr.trm
CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
	term/iris4d.trm term/kyo.trm term/latex.trm term/pbm.trm term/pc.trm 
CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
	term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
	term/v384.trm term/x11.trm term/bigfig.trm term/vws.trm gplt_x11.c
CSOURCE8 = contour.c specfun.c interpol.c

#
# Docs
#
DOCS1 = docs/Makefile docs/README docs/checkdoc.c docs/doc2gih.c \
	docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
	docs/gnuplot.1 docs/lasergnu.1 docs/toc_entry.sty \
	docs/titlepage.ms docs/titlepage.tex
DOCS2 = docs/gnuplot.doc
DOCS3 = docs/latextut/Makefile docs/latextut/eg1.plt \
	docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
	docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
	docs/latextut/header.tex docs/latextut/tutorial.tex \
	docs/latextut/linepoint.plt

#
# Targets
#

#default: gnuplot doc
default: gnuplot

gnuplot: $(OBJS) term.o version.o
	$(LD) $(LDFLAGS) $(OBJS) term.o version.o $(LIBS) -o gnuplot

#doc:
#	@cd ../docs
#	@make gih


#
# Dependencies
#
plot.o: plot.c
	$(CC) $(CFLAGS) plot.c

term.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
	$(CC) $(CFLAGS) $(TERMFLAGS) term.c

version.o:
	$(CC) $(CFLAGS) -DCONTACT=$(EMAIL) version.c

$(OBJS): plot.h
	$(CC) $(CFLAGS) $*.c

command.o:
	$(CC) $(CFLAGS) -c command.c -DHELPFILE=$(HELPDEST)

command.o help.o misc.o: help.h

command.o graphics.o graph3d.o misc.o plot.o set.o show.o term.o interpol.o: setshow.h

command.o fit.o matrix.o: fit.h

fit.o matrix.o: matrix.h

fit.o: fit.c fit.h matrix.h plot.h

matrix.o: matrix.c matrix.h fit.h

bitmap.o term.o: bitmap.h

#
# misc
#
clean:
	delete #?.o

veryclean: spotless

spotless:
	delete #?.o gnuplot

