# This Makefile is in -*- text -*- mode.
#
# Makefile for GNU From, a replacement of UCB From.
#
#    Copyright (C) 1990 Free Software Foundation
#
#    Authored by Brian Fox (bfox@ai.mit.edu)
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 1, or (at your option)
#    any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

CC = cc
CFLAGS = -g -DSPOOLDIR=\"$(SPOOLDIR)\" -D_REGEX_RE_COMP

# Where "make install" puts the binaries.
BINDIR = /usr/local/bin

# Where "make man" puts the man pages.
MANDIR = /usr/local/man/man1

# The directory where the system spools incoming mail.
SPOOLDIR = /com/mail

# Programs required to install or create tarfile.
RM = rm -f
CP = cp
TAR = tar
COMPRESS = compress

# Files used to make this program.
FROM_O = from.o unixmail.o regex.o
XFROM_O= xfrom.o unixmail.o regex.o
FROM_H = general.h unixmail.h

SOURCES = from.c xfrom.c unixmail.c general.h unixmail.h

EXECUTABLES = from xfrom

DOCS = from.1
SUPPORT = COPYING Makefile ChangeLog messages-from messages-about $(DOCS)

THINGS_TO_TAR = $(SOURCES) $(SUPPORT)

all: $(EXECUTABLES)

from: $(FROM_O)
	$(CC) $(CFLAGS) $(FROM_O) -o from

xfrom: $(XFROM_O)
	$(CC) $(CFLAGS) $(XFROM_O) -o xfrom -lX11

from.o: from.c general.h unixmail.h
xfrom.o: xfrom.c general.h unixmail.h
unixmail.o: unixmail.c general.h unixmail.h

install: $(EXECUTABLES)
	cp $(EXECUTABLES) $(BINDIR)

dist: from.tar.Z

from.tar.Z: from.tar
	$(COMPRESS) >from.tar.Z <from.tar
	$(RM) from.tar

from.tar:  $(THINGS_TO_TAR)
	$(RM) -rf dist-from
	mkdir dist-from
	for i in $(THINGS_TO_TAR); do (cd dist-from; ln -s ../$$i .); done
	$(TAR) -chf from.tar dist-from
	$(RM) -rf dist-from

ChangeLog:
	touch ChangeLog

clean:
	$(RM) *.o $(EXECUTABLES)
	$(RM) -rf dist-from

