1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
13 use File
::Temp qw
/ tempfile tempdir /;
14 use Env
qw(ACE_ROOT TAO_ROOT DDS_ROOT);
16 # Configuration and default values
18 if (!defined $TAO_ROOT) {
19 $TAO_ROOT = "$ACE_ROOT/TAO";
24 $exclude_tao = !-r
"$TAO_ROOT/VERSION.txt";
26 $perl_path = '/usr/bin/perl';
27 $html_output_dir = '.';
31 if (defined $DDS_ROOT && -r
"$DDS_ROOT/VERSION.txt") {
32 $dds_path = Cwd
::abs_path
($DDS_ROOT);
33 $cwd_path = Cwd
::abs_path
(getcwd
());
34 if ($dds_path eq $cwd_path) {
35 $dds = $exclude_ace = $exclude_tao = 1;
50 ,'tao_rtportableserver'
52 ,'tao_transportcurrent'
55 ,'tao_dynamicinterface'
62 ,'tao_cosnotification'
76 # Modify defaults using the command line arguments
80 if (!-r
"$ACE_ROOT/ace/config.h") {
81 open(CONFIG_H
, ">$ACE_ROOT/ace/config.h")
82 || die "Cannot create config file\n";
83 print CONFIG_H
"#include \"ace/config-doxygen.h\"\n";
88 &generate_doxy_files
('ACE', " $ACE_ROOT", " $ACE_ROOT/VERSION.txt", @ACE_DOCS) if (!$exclude_ace);
89 &generate_doxy_files
('TAO', " $TAO_ROOT", " $TAO_ROOT/VERSION.txt", @TAO_DOCS) if (!$exclude_tao);
90 &generate_doxy_files
('DDS', "$DDS_ROOT", " $DDS_ROOT/VERSION.txt", @DDS_DOCS) if $dds;
92 unlink "$ACE_ROOT/ace/config.h" if $wrote_configh;
99 if (!($ARGV[0] =~ m/^-/)) {
100 push @ARGS, $ARGV[0];
101 } elsif ($ARGV[0] eq "-is_release") {
103 } elsif ($ARGV[0] eq "-exclude_ace") {
105 } elsif ($ARGV[0] eq "-exclude_tao") {
107 } elsif ($ARGV[0] eq "-include_dds") {
109 } elsif ($ARGV[0] eq "-verbose") {
111 } elsif ($ARGV[0] eq "-perl_path" && $#ARGV >= 1) {
112 $perl_path = $ARGV[1];
114 } elsif ($ARGV[0] eq "-footer" && $#ARGV >= 1) {
117 } elsif ($ARGV[0] eq "-html_output" && $#ARGV >= 1) {
118 $html_output_dir = $ARGV[1];
121 print "Ignoring option $ARGV[0]\n";
128 #is $arg1 the same path as "$arg2/$arg3"?
131 my $rhs_base = shift;
133 my $rhs = File
::Spec
->catdir($rhs_base, $rhs_dir);
134 return File
::Spec
->canonpath($lhs) eq File
::Spec
->canonpath($rhs);
137 sub generate_doxy_files
{
140 my $ROOT_DIR = shift;
141 my $VERSION_FILE= shift;
144 my $VERSION = 'Snapshot ('.
145 POSIX
::strftime
("%Y/%m/%d-%H:%M", localtime)
149 my $translate_paths =
150 ($KIT eq 'TAO' && !same_dir
($TAO_ROOT, $ACE_ROOT, 'TAO'));
152 foreach my $i (@DOCS) {
154 my ($major, $minor, $beta) = &get_versions
($KIT, $VERSION_FILE);
155 $VERSION = $major.'.'.$minor.'.'.$beta;
158 my $input = "$ROOT_DIR/etc/".$i.".doxygen";
159 ($fh, $output) = tempfile
(TEMPLATE
=> 'XXXXXXXX', SUFFIX
=> '.doxygen', TMPDIR
=> 1, DESTROY
=> 1);
161 open(DOXYINPUT
, $input)
162 || die "Cannot open doxygen input file $input\n";
163 open(DOXYOUTPUT
, ">$output")
164 || die "Cannot open doxygen output file $output\n";
166 my $generate_man = 0;
167 my $generate_html = 0;
168 my @output_dirs = ();
169 while (<DOXYINPUT
>) {
171 if (/^PROJECT_NUMBER/) {
172 print DOXYOUTPUT
"PROJECT_NUMBER = ", $VERSION, "\n";
174 } elsif (/^PERL_PATH /) {
175 print DOXYOUTPUT
"PERL_PATH = $perl_path\n";
177 } elsif (/^QUIET / && $verbose) {
178 print DOXYOUTPUT
"QUIET = NO\n";
180 } elsif (/^INLINE_SOURCES/ && $is_release) {
181 print DOXYOUTPUT
"INLINE_SOURCES = NO\n";
183 } elsif (/^SOURCE_BROWSER/ && $is_release) {
184 print DOXYOUTPUT
"SOURCE_BROWSER = NO\n";
186 } elsif (/^VERBATIM_HEADERS/ && $is_release) {
187 print DOXYOUTPUT
"VERBATIM_HEADERS = NO\n";
189 } elsif (/^GENERATE_MAN/ && /= YES/) {
191 } elsif (/^GENERATE_HTML/ && /= YES/) {
193 } elsif ($generate_html && /^HTML_OUTPUT/) {
194 my @field = split(' = ');
196 my $html_out_dir = "$html_output_dir/$field[1]";
197 push @output_dirs, $html_out_dir;
198 print DOXYOUTPUT
"HTML_OUTPUT = $html_out_dir\n";
201 } elsif ($generate_html && /^GENERATE_TAGFILE/) {
202 my @field = split(' = ');
204 my $html_out_dir = "$html_output_dir/$field[1]";
205 print DOXYOUTPUT
"GENERATE_TAGFILE = $html_out_dir\n";
208 } elsif ($generate_html && /^TAGFILES\s*=\s*(.*)$/) {
210 while ($value =~ /\\$/) {
211 chop $value; #removes trailing \
212 my $line = <DOXYINPUT
>;
214 $value .= ' ' . $line;
216 my @values = split(' ', $value);
217 print DOXYOUTPUT
"HTML_FOOTER = $footer\n";
218 map {$_ = $html_output_dir . '/' . $_; } @values;
219 print DOXYOUTPUT
'TAGFILES = ' . join(' ', @values) . "\n";
221 } elsif ($generate_man && /^MAN_OUTPUT/) {
222 my @field = split(' = ');
224 push @output_dirs, $field[1];
226 } elsif ($translate_paths && /^(INPUT|INCLUDE_PATH)\s*=\s*(.*)$/) {
229 while ($value =~ /\\$/) {
230 chop $value; #removes trailing \
231 my $line = <DOXYINPUT
>;
233 $value .= ' ' . $line;
235 $value =~ s/$KIT_path/${"${KIT}_ROOT"}/g;
236 print DOXYOUTPUT
"$keyword = $value\n";
240 print DOXYOUTPUT
$_, "\n";
245 foreach my $i (@output_dirs) {
246 File
::Path
::mkpath
($i, 0, 0755);
255 open(FIND
, "find man -type f -print |") or die "Can't run find\n";
258 my $name_with_whitespace = $_;
259 next unless ($name_with_whitespace =~ /\s/);
260 my $name_without_whitespace = $name_with_whitespace;
261 $name_without_whitespace =~ s/\s+//g;
262 rename $name_with_whitespace, $name_without_whitespace;
270 open(DOX
,"doxygen $config 2>&1 |")
271 || die "cannot start ACE doxygen process\n";
276 || die "error while running doxygen on $config\n";
280 ######## Retrieve version information from VERSION file(s).
282 sub get_versions
() {
284 my $VERSION_FILE = shift;
285 my ($major_version, $minor_version, $micro_version);
287 open (VERSION
, '<'.$VERSION_FILE) ||
288 die "$0: unable to open $VERSION_FILE\n";
291 if (/$KIT version (\d+)\.(\d+)\.(\d+)/) {
296 } elsif (/$KIT version (\d+)\.(\d+)[^\.]/) {
297 #### Previous release was a minor.
300 $micro_version = '0';
302 } elsif (/$KIT version (\d+)[^\.]/) {
303 #### Previous release was a major.
305 $minor_version = '0';
306 $micro_version = '0';
312 return ($major_version, $minor_version, $micro_version);