# ----------------------------------------------------------------------------
# - Makefile                                                                 -
# - standard acme top level makefile                                         -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - 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. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2000 amaury darsch                                    -
# ----------------------------------------------------------------------------

TOPDIR          = .
BASEFILE	= cnf/mak/base.mak
include		$(BASEFILE)

# rule: all
# this rule is the default rule which call the build rule

all   : build
.PHONY: all

# rule: configure
# this rule configure the distribution tree by detecting the platform and
# generating the appropriate top level site and rule make file

configure:
	@${MAKE} --no-print-directory -C cnf configure
.PHONY: configure

# rules: mkcnf
# run the configure rule by default if not set

mkcnf:
	@test -f cnf/rule.mak && test -f cnf/site.mak \
	  || ${MAKE} --no-print-directory configure
.PHONY: mkcnf

# rule: build
# this rule build the complete source tree

build: mkcnf
	@${MAKE} -C src all
.PHONY: build

# rule: testers
# build only the test suites

testers: build
	@${MAKE} -C tst testers
.PHONY: testers

# rule: test
# build and run all test suites

test: testers
	@${MAKE} --no-print-directory -C tst all
.PHONY: test

# rule: install
# install according to the prefix variable

install: build
	@${MAKE} -C src install
	@${MAKE} -C doc install
	@${MAKE} -C etc install
.PHONY: install

# rule: doc
# build the documentation - but do not install it

doc:
	@${MAKE} --no-print-directory -C tex all
.PHONY: doc

# rule: distri
# build the distribution

distri: mkcnf
	@${MAKE} --no-print-directory -C tex distri
.PHONY: distri

# rule: tag
# install a relese tag to the cvs server

tag:
	@$(TEST) -d CVS
	cvs rtag -d $(REVTAG) aleph
	cvs rtag    $(REVTAG) aleph
.PHONY: tag

# rule: clean
# This rule cleans the distribution. the configuration makefile is not 
# removed. Use the cleanall method to do so

clean: mkcnf
	@${MAKE} -C src clean
	@${MAKE} -C tst clean
	@${MAKE} -C tex clean
	@${MAKE} -C etc clean
	@$(RMDIR) rel
	@$(RM)    *~ core 
.PHONY: clean

# rule: cleanall
# This rule clean everything, including the configuration makefiles

distclean: clean
	@${MAKE} --no-print-directory -C cnf clean
.PHONY: distclean

# rule: cvsclean
# this  rule clean everything including the precompiled doc

cvsclean: clean
	@$(TEST) -d CVS
	@${MAKE} --no-print-directory -C doc clean
	@${MAKE} --no-print-directory -C cnf clean
.PHONY: cvsclean
