# 
# Copyright (C) 1993 Mark Boyns (boyns@sdsu.edu)
#
# This file is part of rplay.
#
# 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 2 of the License, 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.
#

include Makefile.config

TARGETS=	librplay rplayd rplay rptp include doc

all:
		@for i in $(TARGETS); \
		do \
			(echo making in $$i...; cd $$i; $(MAKE) $(MFLAGS) all); \
		done;

depend:
		@for i in $(TARGETS); \
		do \
			(echo make depend in $$i...; cd $$i; $(MAKE) $(MFLAGS) depend); \
		done;

install:
		@for i in $(TARGETS); \
		do \
			(echo installing in $$i...; cd $$i; $(MAKE) $(MFLAGS) install); \
		done;

clean:
		$(RM) a.out core *~ *.bak *.orig
		@for i in $(TARGETS); \
		do \
			(echo cleaning in $$i...; cd $$i; $(MAKE) $(MFLAGS) clean); \
		done;

world:		all install mail

mail:
		@echo; echo -n 'Do you want send a message to the author ($(MAIL_TO)) (y/n) [y]? '; \
		read answer; \
		if [ "$$answer" = "y" -o "$$answer" = "" ]; \
		then \
			echo; echo 'Enter your message terminated by Control-D:'; echo; \
			rm -f /tmp/rpm.$$$$; \
			cat > /tmp/rpm.$$$$; \
			echo; \
			$(MAILER) '$(MAIL_SUBJECT)' $(MAIL_TO) < /tmp/rpm.$$$$; \
			rm -f /tmp/rpm.$$$$; \
			echo 'The message has been sent.'; \
		fi; \
		echo; echo 'Thank you for using rplay.'; echo

tar:
		cd ..; rm -f rplay-3.1.0.tar.Z; gnutar Zcf rplay-3.1.0.tar.Z rplay-3.1.0

shar:
		cd ..; rm -f rplay.??; shar -L60 -a -c -s $(MAIL_TO) -n rplay-3.1.0 -o rplay rplay-3.1.0
