# Makefile for Mandelbrot computation program(s).
#
# There are two standard modules, "mancomp.c" and "manscreen.c".
# The third module, which contains the routine "process", is the
# one that does the computation, and there are several versions
# of this, optimised for different circumstances.
#

# The redefinition of strchr() and strrchr() is needed for
# Ultrix-32, Unix 4.2 bsd (and maybe some other Unices).
#
BSDDEFINES = -Dstrchr=index -Dstrrchr=rindex

# On certain systems, such as Unix System III, you may need to define
# $(LINTFLAGS) in the make command line to set system-specific lint flags.
#
CFLAGS = $(BSDDEFINES)

all:	mancomp_vax mancomp_dcw mancomp_int mancomp_dbl

MANCOMP_SRCS	=	mancomp.c manscreen.c
MANCOMP_OBJS	=	mancomp.o manscreen.o

# VAX assembler version, using floats in registers r6-r11.
# this was hacked by cmd from the assembler produced by cc.

mancomp_vax:	$(MANCOMP_OBJS) procvax.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procvax.o -o mancomp_vax

# David Wood's VAX assembler version, using doubles in all the registers.
# this was written from scratch in assembler.

mancomp_dcw:	$(MANCOMP_OBJS) procdcw.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procdcw.o -o mancomp_dcw

# integer (fixed-point) version in C by Martin Guy.
# this has the advantage that it is portable.

mancomp_int:	$(MANCOMP_OBJS) procint.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procint.o -o mancomp_int

# original C version; uses doubles. slow.

mancomp_dbl:	$(MANCOMP_OBJS) procdbl.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procdbl.o -o mancomp_dbl

mancomp_dist:	$(MANCOMP_OBJS) procdist.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procdist.o -o mancomp_dist -ltsb

mancomp_dist1:	$(MANCOMP_OBJS) procdist1.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procdist1.o -o mancomp_dist1 -ltsb

mansrv: mansrv.c
	$(CC) $(CFLAGS) -O -O2 -o mansrv mansrv.c -ltsb

MANDISP_SRCS	=	mandisp.c manscreen.c manregis.c
MANDISP_OBJS	=	mandisp.o manregis.o
mandisp:	$(MANDISP_OBJS)
		$(CC) $(CFLAGS) $(MANDISP_OBJS) -o mandisp

# dcw's cube-root-of-minus-one thing

mancomp_nr: $(MANCOMP_OBJS) procnr.o
		$(CC) $(CFLAGS) $(MANCOMP_OBJS) procnr.o -o mancomp_nr

#
# ** Lint the code
#
lint:	$(MANCOMP_SRCS) $(MANDISPP_SRCS)
	lint $(LINTFLAGS) $(DEFINES) $(MANCOMP_SRCS)
	lint $(LINTFLAGS) $(DEFINES) $(MANDISP_SRCS)

mancomp.o	:	mancomp.c

mandisp.o	:	mandisp.c

manscreen.o	:	manscreen.c

manregis.o	:	manregis.c
