#   Makefile - Initial makefile for the GNU Send package.
#    Copyright (C) 1988 Free Software Foundation, Inc.
#
# This file is part of GNU Send.
#
# GNU Send is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY.  No author or distributor
# accepts responsibility to anyone for the consequences of using it
# or for whether it serves any particular purpose or works at all,
# unless he says so in writing.  Refer to the GNU Send General Public
# License for full details.
#
# Everyone is granted permission to copy, modify and redistribute
# GNU Send, but only under the conditions described in the
# GNU Send General Public License.   A copy of this license is
# supposed to have been given to you along with GNU Send so you
# can know your rights and responsibilities.  It should be in a
# file named COPYING.  Among other things, the copyright notice
# and this notice must be preserved on all copies.  */
#
#
# Author:	Keith Gabryelski	(ag@wheaties.ai.mit.edu)
#

#
# This is the initial Makefile for GNU Send.
#
# Make sure BINDIR, CPP, and MAKE are valid for you system.
# Then select a system file (s-*.h) and include it in config.h.
# make
# make install
#

#
# BINDIR - Directory for binaries to be kept.
#

BINDIR=$(ROOT)/usr/public/bin

#
# CPP - Your `C' Pre-Processor.
# An alternative is CPP = /lib/cpp
#

CPP = cc -E

#
# MAKE - The make utility.
# BSD doesn't have MAKE as a default.
#

MAKE = make

SHELL=/bin/sh

STRIP=strip

CPSET=./cpset

all: xmakefile doall

doall:
	$(MAKE) $(MAKEOVERRIDES) -f xmakefile ${MFLAGS} all

send: xmakefile

# If you have a problem with cc -E here, changing
# the definition of CPP above may fix it.
xmakefile: ymakefile config.h
	rm -f xmakefile
	cp ymakefile junk.c
	$(CPP) junk.c | sed -e 's/^#.*//' -e 's/^[ \f\t][ \f\t]*$$//' -e 's/^ /	/' | \
	sed -n -e '/^..*$$/p' > xmakefile
	rm -f junk.c

install: all send
	$(CPSET) send $(BINDIR) 4755 root bin
	$(CPSET) prsends $(BINDIR) 755 bin bin
	$(STRIP) $(BINDIR)/send
	$(STRIP) $(BINDIR)/prsends
	-rm -f $(BINDIR)/reply $(BINDIR)/shout
	ln -f $(BINDIR)/send $(BINDIR)/reply
	ln -f $(BINDIR)/send $(BINDIR)/shout

clean:
	rm -f core *.o send prsends mesg messaged.c xmakefile

clobber: clean

spotless:	clean
	rm -f *~ reply shout luser

shar:
	shar	BUGS COPYING INSTALL Makefile SYSTEMS config.h \
		error.c gets.c memory.c mesg.c message.c \
		prsends.c rots.c			    > send.shar.1
	shar	s-bsd.h s-template.h s-usg.h send.c send.h \
		cpset ymakefile doc/send.texinfo  > send.shar.2
