SubDir TOP ;

SubInclude TOP core ;
SubInclude TOP abnf ;
SubInclude TOP deliver ;
SubInclude TOP doc ;
SubInclude TOP encodings ;
SubInclude TOP ocd ;
SubInclude TOP logd ;
SubInclude TOP aox ;
SubInclude TOP server ;
SubInclude TOP db ;
SubInclude TOP recorder ;
SubInclude TOP sasl ;
SubInclude TOP schema ;
SubInclude TOP scripts ;
SubInclude TOP tlsproxy ;
SubInclude TOP installer ;
SubInclude TOP extractors ;
SubInclude TOP archiveopteryx ;
SubInclude TOP aoximport ;

if ( $(BUILDDOC) ) {
    SubInclude TOP udoc ;
}

Doc oryxdoc : core database schema encodings imap logd mailbox message ocd sasl
    server smtp tls user http pop sieve extractors abnf ;

if ( $(BUILDDOC) ) {
    Depends install : doc ;
    Depends all : doc ;
    Depends doc : exe ;
}

MkDir $(BINDIR) ;
MkDir $(MANDIR) ;
MkDir $(LIBDIR) ;
MkDir $(PIDFILEDIR) ;
MkDir $(JAILDIR) ;
MkDir $(MESSAGEDIR) ;
MkDir $(CONFIGDIR) ;
MkDir $(LOGFILE:D) ;

Depends install :
    $(PIDFILEDIR) $(JAILDIR) $(MESSAGEDIR) $(CONFIGDIR) $(LOGFILE:D) ;

# if we make JAILDIR, we should chmod it so noone can read it:
MODE on $(JAILDIR) = 700 ;
Chmod $(JAILDIR) ;

# if we make MESSAGEDIR, we should chmod it similarly. AOXUSER needs to
# be able to write to it, but we can't chown here, because the user may
# not exist yet.
MODE on $(MESSAGEDIR) = 700 ;
Chmod $(MESSAGEDIR) ;


actions Message {
fmt <<EOM | sed 's/^/  /'
To set up the database and generate a configuration file, run
$(LIBDIR)/installer as root. The new configuration file will be in
$(CONFIGDIR)/archiveopteryx.conf.

$(LIBDIR)/installer -n shows what it would do, without making any
changes. (If you are just upgrading from an older version, 
$(BINDIR)/aox upgrade schema may be enough.
$(BINDIR)/aox upgrade schema -n shows what it would do, without making
any changes.)

The logfile is $(LOGFILE) by default and man pages are in $(MANDIR).

If you have any problems, the FAQ is at
http://www.archiveopteryx.org/faq/ and you can always ask
info@oryx.com for help.

EOM
}

Message install ;


if $(BUILDDOC) {
    local s u ;
    local exceptions = canonical msgdump munger renderer logdmain tests
    addressparser whip cram subscribe deliver ocdmain aox recorder
    cryptlib installer archiveopteryx aoximport dbtest ;
    for s in $(sets) {
        if ! $(s) in $(documented-sets) && ! $(s) in $(u) &&
           ! $(s) in $(exceptions)
        {
            u += $(s) ;
        }
    }
    if $(u) {
        echo Built but not documented: $(u) ;
    }
}
