#
#     Makefile for W-MAIL Local Mail Agent (UNIX)
#
#	Makefile @(#)2.0		08/05/90
#
# Define UMAILER if your remote mailer understands the
# "-i datafile" option. Otherwise "< datafile" will be used.
#
# Define V7MAIL if you do not want the "To:"-line to be
# included in the message header.
#
LIB	= /usr/lib
BIN	= /usr/bin

CC	= cc
CFLAGS	= -D_UNIX -DUMAILER -D_POSIX_SOURCE -Wc,"-2 -j -osal -w3 -zc"
LDFLAGS = -M -N6k

# Add any libraries you need here. Str86 is the 8086 string library.
LIBS	= -ltermcap

OBJS	=	wmmain.o wmread.o wmcreate.o wmcmd.o wmsend.o \
		wmalias.o wmmailrc.o wmtime.o mktemp.o
SRCS	=	wmmain.c wmread.c wmcreate.c wmcmd.c wmsend.c \
		wmalias.c wmmailrc.c wmtime.c
OTHERS	=	README TODO wmail.1 dotmailrc syswmailrc Makefile* wmail.h

wmail:		$(OBJS)
		$(CC) $(LDFLAGS) -o wmail $(OBJS) $(LIBS)

alias:		wmalias.c wmmailrc.o
		$(CC) $(LFLAGS) -o alias $(CFLAGS) -DSELFMAIN \
			wmalias.c wmmailrc.o

install:
		@echo 'Copying files...'
		@rm -f $(BIN)/wmail $(BIN)/lmail $(BIN)/Mail \
			$(BIN)/mailx $(BIN)/mail
		@cp wmail $(BIN)
		@cp syswmailrc $(LIB)/wmailrc
		@echo 'Setting up links...'
		@ln $(BIN)/wmail $(BIN)/lmail
		@ln $(BIN)/wmail $(BIN)/mail
		@ln $(BIN)/wmail $(BIN)/Mail
		@ln $(BIN)/wmail $(BIN)/mailx
		@echo 'Setting up permissions...'
		@chown root.sys $(BIN)/wmail $(LIB)/wmailrc
		@chmod 4555 $(BIN)/wmail
		@chmod 600 $(LIB)/wmailrc
		@echo Don't forget to install the documentation and the \
user configuration files!

shar:
		@rm -f wmail.shar
		@crc $(OTHERS) $(SRCS) >Crcs
		@bshar -Cuvo wmail.shar $(OTHERS) Crcs $(SRCS)

tar:
		@rm -f wmail.tar
		@crc $(OTHERS) $(SRCS) >Crcs
		@tar cfv wmail.tar $(OTHERS) Crcs $(SRCS)

$(OBJS):	wmail.h
