# make all: compiles the configured packages with ocamlc
# make opt: compiles the configured packages with ocamlopt
# make install: installs the configured packages
# make clean: cleans everything up
#----------------------------------------------------------------------

# Inclusion of Makefile.conf may fail when cleaning up:
-include Makefile.conf

NAME=rpc
TOP_DIR=.

.PHONY: all
all:
	for pkg in $(PKGLIST); do $(MAKE) -C src/$$pkg all || exit; done

.PHONY: opt
opt:
	for pkg in $(PKGLIST); do $(MAKE) -C src/$$pkg opt || exit; done

.PHONY: install
install:
	for pkg in $(PKGLIST); do $(MAKE) -C src/$$pkg install || exit; done

.PHONY: uninstall
uninstall:
	$(MAKE) -C src uninstall


.PHONY: clean
clean:
	$(MAKE) -C src CLEAN
	$(MAKE) -C examples CLEAN

.PHONY: CLEAN
CLEAN: clean

.PHONY: distclean
distclean: clean
	rm -f Makefile.conf

.PHONY: RELEASE
RELEASE:
	./configure -version >RELEASE

.PHONY: dist
dist: RELEASE
	./release

.PHONY: tag-release
tag-release: RELEASE
	@echo Checking whether everything is checked in...
	! cvs -n update 2>&1 | grep '^[MACPU] '
	r=`head -1 RELEASE | sed -e s/\\\./-/g`; cd ..; cvs tag -F $(NAME)-$$r $(NAME)

.PHONY: release
release: distclean
	$(MAKE) tag-release
	$(MAKE) dist
