#
# Top-level makefile for req
#
# $Id: Makefile,v 2.5 1994/10/23 20:12:27 remy Exp remy $
#
# remy@ccs.neu.edu
# 27 June 1994
#
# Copyright (C) 1994 by Remy Evard
#
# 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
# any later version.
#
# A copy of the license may be found in docs/license of the source
# distribution.
#

help:
	@echo "make options you're probably interested in: (in order)"
	@echo " 1. all"
	@echo " 2. directories       (requires privs)"
	@echo " 3. install           (requires privs)"
	@echo " 4. install-man       (may require privs)"
	@echo
	@echo "If this is the _first_ time you've installed req:"
	@echo " 5. numbers           (requires privs)"
	@echo 
	@echo "If you're doing a mail-system specific build:"
	@echo " 1. mail-all"
	@echo " 2. mail-directories  (requires privs)"
	@echo " 3. mail-install      (requires privs)"
	@echo 
	@echo "Others:"
	@echo "  extract    - build the extract script"
	@echo "  Makefiles  - lower-level Makefiles"
	@echo "	 clean"     - clean up"
	@echo 
	@echo "Edit the defs file first. See docs/install for more information."

extract: configure
	/bin/sh ./configure

Makefiles: extract defs
	./extract < build/Makefile.def > build/Makefile
	./extract -DBUILD_FOR_MAIL < build/Makefile.def  | \
	sed 's/\-d \.\.\/defs/\-d \.\.\/defs \-DBUILD_FOR_MAIL/' \
	> mail/Makefile


all:	Makefiles
	(cd build; make all)

install:
	(cd build; make install)

install-man:
	(cd build; make install-man)

directories:
	(cd build; make directories)

numbers:
	(cd build; make numbers)


mail-all: Makefiles
	(cd mail; make all);	

mail-directories:
	(cd mail; make directories)

mail-install:
	(cd mail; make install)


tidy:
	rm -f *~ \#*\#

clean:	tidy
	(cd build; make clean)
	(cd mail; make clean)

dist:	/dev/null
	/bin/rm -rf dist/old
	if [ -d dist/new ]; then  mv dist/new dist/old ; fi
	if [ ! -d dist/new ]; then mkdir dist/new ; fi
	find . \( -name RCS -o -name testing -o -name old -o -name '*~' -o -name dist -o -name interfaces \) -prune -o -print | cpio -pvd dist/new
	mv dist/new/defs.req dist/new/defs.ccs
	rm -f dist/new/defs dist/new/defs.test dist/new/defs.old dist/new/defs.save
	rm -f dist/new/extract
	rm -rf dist/new/interfaces
	mkdir dist/new/interfaces
	chmod -R +w dist/new
