# Boost.GIL (Generic Image Library) - documentation
#
# Copyright (c) 2018 Stefan Seefeld
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

import doxygen ;
import os ;
import path ;

.doxygen = [ doxygen.name ] ;
.doxygen ?= doxygen ;

#doxygen/gil_standalone/gil_boost.doxygen
make reference : doxyfile
     : @make_doxygen
     : <location>html
       <dependency>$(headers)
     ;

rule make_doxygen ( targets * : sources * : properties * )
{
    LIB_DIR on $(targets) =
        [ path.native [ path.parent [ path.root
        [ on $(sources[1]) return $(SEARCH) ] [ path.pwd ] ] ] ] ;
}

if [ os.name ] = NT
{
    actions make_doxygen
    {
        SET LIB_DIR=$(LIB_DIR)
        chdir "$(>:D)" && "$(.doxygen)" $(>:D=)
    }
}
else
{
    actions make_doxygen
    {
        export LIB_DIR=$(LIB_DIR)
        cd $(>:D) && "$(.doxygen)" $(>:D=)
    }
}

make html
     : index.rst
     : @sphinx-build
     : <location>.
       <dependency>reference
     ;

if [ os.name ] = NT
{
  actions sphinx-build { chdir "$(>:D)" && make clean && make html}
}
else
{
  actions sphinx-build { make -C "$(>:D)" clean html}
}

###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html ;
explicit boostrelease ;