#
# Makefile for Hypermail
# Kevin Hughes, 8/1/94
#
# Additional makefile additions for the Amiga platform by
# Joop van de Wege, Joop.vandeWege@medew.ento.wau.nl
# 06/17/95
#
# Usage:
# Comment/uncomment depending on the compiler you have (Aztec/GCC)
# If you use GCC uncomment the proper OBJS and CLFAGS if you want LibNix
# Prepped for GCC, LibnixV0.8 and AMITCP/AWS setup
#
# TODO
# - make it possible to compile 'mail' and 'cgilib' under Aztec.
# - NOT possible yet to use anything below the '$(OBJS):' line !!!!
#

BINDIR= AMITCP:bin
#BINDIR= /usr/local/bin
# This is where you want hypermail to be installed

MANDIR= AMITCP:doc
#MANDIR= /usr/local/man/man1
# This is where the man page goes

HTMLDIR= AMITCP:html
#HTMLDIR= /usr/local/www/software/hypermail
# This is where the HTML documentation goes

CGIDIR= aws:cgi-bin
#CGIDIR= /usr/local/httpd/cgi-bin
# This is where your CGI programs live

#Manx Aztec 5.2
#CC= cc

#GCC
CC= gcc

#GCC
#CFLAGS= -v -O2 -DAMIGA
CFLAGS= -v -O2 -m68040 -DAMIGA -noixemul
LFLAGS= -s -lm

#Aztec compile for mc68020 remove '-c2' if mc68000 wanted, leave the rest
#CFLAGS= -DAMIGA -pl -so -c2  -me -sb -wo
#LFLAGS= -lm -lc

#Aztec
# Two additional files needed: getopt.c (unknown source)
# and strcasecmp.c from ixemul.library (41.00) source
#OBJS=		file.o mem.o string.o print.o parse.o struct.o \
			date.o hypermail.o strcasecmp.o getopt.o 

#GCC
#OBJS=		file.o mem.o string.o print.o parse.o struct.o date.o hypermail.o 

#GCC -noixemul
# One additional file needed: getopt.c (unknown source)
OBJS=		getopt.o file.o mem.o string.o print.o parse.o struct.o \
			date.o hypermail.o

MAILOBJS=	mail.o libcgi/libcgi.a

.c.o:
#Aztec
#		$(CC) $(CFLAGS)  $*.c
#GCC
		$(CC) -c $(CFLAGS)  $<

all:		hypermail
			
hypermail:	$(OBJS)
#GCC
		$(CC) -o hypermail $(CFLAGS) $(OBJS) $(LFLAGS)
		chmod 0755 hypermail
		chmod 0644 hypermail.1
		chmod 0644 hypermail.html
		chmod 0644 hypermail.gif
#Aztec
#		ln -o hypermail $(OBJS) $(LFLAGS) $(LFLAGS)

libcgi/libcgi.a:
		cd libcgi; make all CC="$(CC)" CFLAGS="$(CFLAGS)"

mail:		$(MAILOBJS)
		$(CC) -o mail $(CFLAGS) $(MAILOBJS)

$(OBJS):	Makefile hypermail.h config.h

install:
		install -cs -m 0755 hypermail $(BINDIR)
		install -c -m 0644 hypermail.1 $(MANDIR)

html.install:
		install -c -m 0644 hypermail.html $(HTMLDIR)
		install -c -m 0644 hypermail.gif $(HTMLDIR)

mail.install:
		install -c -m 0755 mail $(CGIDIR)

install.alpha:
		install -c $(BINDIR) -s -m 0755 hypermail
		install -c $(MANDIR) -m 0644 hypermail.1

html.install.alpha:
		install -c $(HTMLDIR) -m 0644 hypermail.html
		install -c $(HTMLDIR) -m 0644 hypermail.gif

mail.install.alpha:
		install -c $(CGIDIR) -m 0755 mail

pure:
	 	make CFLAGS="-g" $(OBJS)
		purify $(CC) -o hypermail -g $(CFLAGS) $(OBJS)

quant:
	 	make CFLAGS="-g" $(OBJS)
		quantify $(CC) -o hypermail -g $(CFLAGS) $(OBJS)

clean:
		rm -f ./hypermail ./mail *.o .pure hypermail.pure* *qx *qv
		rm -fr ./archive
		cd libcgi; make clean
