aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/generate-targets-meson.pl
blob: d127429c981816a5a02da481f27ddaf2965588dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
#
# Generate the targets-meson.sgml file from targets-meson.txt
# Copyright (c) 2000-2025, PostgreSQL Global Development Group

use strict;
use warnings FATAL => 'all';

my $targets_meson_file = $ARGV[0];
open my $targets_meson, '<', $targets_meson_file or die;

print
  "<!-- autogenerated from doc/src/sgml/targets-meson.txt, do not edit -->\n";

# Find the start of each group of targets
while (<$targets_meson>)
{
	next if /^#/;

	if (/^(.*) Targets:$/)
	{
		my $targets = $1;
		my $targets_id = lc $targets;

		print qq(
<sect3 id="targets-meson-$targets_id">
 <title>$targets Targets</title>

 <variablelist>
);

		# Each target in the group
		while (<$targets_meson>)
		{
			next if /^#/;
			last if !/^\s+([^ ]+)\s+(.+)/;

			my $target = $1;
			my $desc = $2;
			my $target_id = $1;

			$target_id =~ s/\//-/g;

			print qq(
  <varlistentry id="meson-target-${target_id}">
    <term><option>${target}</option></term>
    <listitem>
     <para>
      ${desc}
     </para>
    </listitem>
  </varlistentry>
);
		}

		print qq(
 </variablelist>
</sect3>
);
	}
}

close $targets_meson;