#!/usr/bin/perl -w

#Iterate through ipp src dir to find Doxygen configuration files
#Run Doxygen and copy the html files produced to alala web server
#Called daily by cron
#Bill Giebink 12/08

use strict;
use warnings;
use File::Find;
use File::Copy;

my $srcDir = "/data/ipp003.0/ippTests/src/ipp";
my $destDir = "/data/alala.0/ippDocs";
system `rm -rf $destDir/*`;

finddepth(\&wanted, $srcDir);

sub wanted {
  #don't want the archive or DB src
  return if ($File::Find::name =~ /archive$/); 
  return if ($File::Find::name =~ /ippdb\.src/); 

  if ($File::Find::name =~ /Doxyfile\.in$/) {
    my $file = $File::Find::name;
    my $subDir = $1 if ($file =~ /\/([^\/]+)\/Doxyfile/);
    my $currDir = $File::Find::dir;
    system ("$currDir/autogen.sh");
    system ("doxygen");
    system ("mkdir $destDir/$subDir");
    system ("cp $currDir/docs/html/* $destDir/$subDir");
  }
}



