#
# Makefile for Bermuda 1.20 on Unix
#

# First edit pandora.h and check that you have #defined UNIX 1

# flags are for a generic BSD system (NEWS-OS 68k)

# define MSTRDUP=1 if your libs don't have strdup
# define MSTRUPR=1 if your libs don't have strupr
# define RE_BSD if you want to use BSD's regular expressions re_exec/re_comp
COMFLG = -DMSTRDUP=1 -DMSTRUPR=1 -DRE_BSD

# add additional libraries (-lregexp may be needed)
LIBS = -lregexp

# C compiler should be ansi
CC=gcc
CFLAGS = -O $(COMFLG)

# where to put binaries
BIN = /usr/fido/bin

OBJS=import pack scan crunch
CFILES=crunch.c pack.c route.c utextra.c import.c patmat.c scan.c
HFILES=mail.h pandora.h
PROFILES=crunch.pro pack.pro route.pro utextra.pro import.pro patmat.pro scan.pro
PRJFILES=crunch.prj import.prj pack.prj scan.prj

all: $(OBJS)

import: import.o utextra.o pandora.h
	$(CC) -o import import.o utextra.o $(LIBS)

pack: pack.o route.o patmat.o utextra.o pandora.h
	$(CC) -o pack pack.o route.o patmat.o utextra.o $(LIBS)

scan: scan.o utextra.o pandora.h
	$(CC) -o scan scan.o utextra.o $(LIBS)

crunch: crunch.o utextra.o pandora.h
	$(CC) -o crunch crunch.o utextra.o $(LIBS)

DSRC=readme $(CFILES) $(HFILES) $(PROFILES) $(PRJFILES) Makefile bermuda.doc update.doc license makefile.nt
dist-shar: $(DSRC)
	shar -a -L 60 -n bermuda -s vincent@stell.gna.org -o bermuda.shar $(DSRC)

dist-src: $(DSRC)
	zip bermsrc $(DSRC)

# for Atari ST only
dist-bin:
	zip berm120 *.ttp bermuda.doc read.me bermuda.doc update.doc

diff:
	rcsdiff -rUsenet-PL1 -rUsenet-PL2 -c $(DSRC) >diff-file

install: all
	strip pack scan import crunch
	mv pack scan import crunch $(BIN)

clean:
	rm -f *.o $(OBJS)

# dependencies
crunch.o: pandora.h utextra.pro crunch.pro
pack.o: pandora.h mail.h pack.pro route.pro utextra.pro
scan.o: pandora.h mail.h scan.pro utextra.pro
import.o: pandora.h mail.h import.pro utextra.pro
route.o: patmat.pro route.pro utextra.pro
