#
# $Id: Jamfile 2504 2009-02-23 13:16:02Z karijes $
#
# Part of edelib.
# Copyright (c) 2005-2007 EDE Authors.
#
# This program is licenced under terms of the 
# GNU General Public Licence version 2 or newer.
# See COPYING for details.

SubDir TOP doc ;

rule MakeApiDocumentation 
{
	if $(DOXYGEN) {
		LocalDepends docs : $(<) ;
		LocalDepends $(<) : $(>) ;
		LocalDepends all : docs ;

		NotFile docs ;
		Always  docs ;

		MakeApiDocumentation1 $(<) : $(>) ;
		Cleandir clean : $(<) ;
	}

	# just return if doxygen is not found
	# so we can build the rest
	if ! $(DOXYGEN) {
		Echo "doxygen is missing; skiping..." ;
		return ;
	}
}

# Strip directory path from (example: 'doc/Doxyfile') and
# go into it so DOXYGEN command can work
actions piecemeal MakeApiDocumentation1
{
	cd $(>:D)
	$(DOXYGEN) $(>:B) ;
}

MakeApiDocumentation [ FDirName $(SUBDIR) html ] : [ FFileName $(SUBDIR) Doxyfile ] ;

InstallDocumentation [ FDirName $(docdir) $(EDELIB_DOCDIR) ] : [ FFileName $(TOP) README ] ;
InstallDocumentation [ FDirName $(docdir) $(EDELIB_DOCDIR) ] : [ FFileName $(TOP) INSTALL ] ;
InstallDocumentation [ FDirName $(docdir) $(EDELIB_DOCDIR) ] : [ FFileName $(TOP) COPYING ] ;
InstallDirectory     [ FDirName $(docdir) $(EDELIB_DOCDIR) ] : [ FDirName $(SUBDIR) html ] ;

LocalClean distclean : Doxyfile ;
