# make file for the IP/TCP/POP3 server for VAX/UNIX 4.3BSD (now Linux)

# Set the installation directory for the binary
BINDIR = /usr/sbin

# Where should the man page live?
MANDIR = /usr/man/man1

# Set the executable name.  This must matche whatever is in /etc/inetd.conf
EXENAME= in.pop3d

# -DTACACS_AUTH for that form of authentication.
# -DSHADOWPWD   for shadow authentication
# -DLINUX       for Linux (not tested anywhere else lately?)
# -DVIRTUAL	for VIRTUAL hosting (new, not functional yet).
# -DQMAIL	for ~/Mailbox QMAIL machines
# -DSTANDALONE	for standalone, non-inetd server
#CFLAGS= -O3 -m486 -fomit-frame-pointer -DSHADOWPWD -DLINUX 
CFLAGS= -O3 -m486 -fomit-frame-pointer -DSHADOWPWD -DLINUX -DSTANDALONE

# Set the POP temporary work directory.  This must match the value
# in pop3d.h  Comment out if using -DQMAIL
POPWORK= /usr/tmp/.pop

OBJS  = server.o main.o folder.o util.o md5.o apop.o tacacs_auth.o virtual.o md5/md5.o

# LIBS = -lshadow for shadow authentication
LIBS  = -lshadow

all: $(EXENAME)

install: all
	install -c -m 700 $(EXENAME) $(BINDIR)/$(EXENAME)
	install -c -m 644 pop3d.1 $(MANDIR)
ifdef POPWORK
	install -d -m 1775 $(POPWORK)
endif

clean:
	rm -f *.o */*.o *~ core $(EXENAME)


$(EXENAME): $(OBJS)
	cc -o $(EXENAME) $(OBJS) $(LIBS)

server.o: server.c
main.o:	main.c pop3.h
folder.o: folder.c pop3.h
util.o: util.c pop3.h
md5/md5.o: md5/md5.c md5/md5.h
md5.o: md5.c md5/md5.h pop3.h
apop.o: apop.c pop3.h
tacacs_auth.o: tacacs_auth.c tacacs.h
virtual.o: virtual.c pop3.h
