# Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984, 1985.
#
# bootstrap Mark 1 implementation of B.

# Filled in by ./Setup:
# for public installation, e.g. outside the B root directory (make install):
# public place for 'b' command
BDIR=
# public place for 'b.1' manual
MAN1DIR=
# public place for 'bterminal.5' manual
MAN5DIR=
# public place for auxiliary files needed by 'b'
LIBDIR=
# BINT determines B interpreter used
BINT=

default:	all

# put everything in ./bin and ./lib:
all:
	cd src/b; make install
	cd src/bed; make install
	cd src/$(BINT); make install
	cd src/libbed; make install
	@ch_all "$(BINT)"

examples: bin/b
	@cd ex; make examples
	@echo ""
	@echo "If all went well, try the B editor in ./ex/try."

# install everything in public places:
install: $(BDIR) $(MAN1DIR) $(MAN5DIR) $(LIBDIR)
	cd src/b; make BDEST=$(BDIR) LDEST=$(LIBDIR) install
	cd src/bed; make DEST=$(LIBDIR) install
	cd src/$(BINT); make DEST=$(LIBDIR) install
	cd src/libbed; make DEST=$(LIBDIR) install
	cd man; make DEST1=$(MAN1DIR) DEST5=$(MAN5DIR) install
	@ch_install "$(BINT)" "$(BDIR)" "$(MAN1DIR)" "$(MAN5DIR)" "$(LIBDIR)" 


clean:
	cd src/b; make clean
	cd src/bed; make clean
	cd src/$(BINT); make clean
	cd src/libtermcap; make clean
	cd ex; make clean
	@ch_clean "$(BDIR)"

cleanall:
	cd bin; rm -f *
	cd lib; rm -f * .Bed*

print:
	@echo "To print the source; see ./src"
	@echo "To print the manual pages; see ./man"
	@echo "To print the documents; see ./doc"
