Documented the %! (get environment) preprocessor directive.
[platform/upstream/nasm.git] / doc / genpsdriver.pl
1 #!/usr/bin/perl
2 #
3 # Runs the equivalent of the following command line:
4 #
5 #       $(PERL) $(srcdir)/genps.pl -subtitle "version `cat ../version`" \
6 #                nasmdoc.dip
7 #
8 # This is implemented as a Perl script since `cat ...` doesn't
9 # necessarily work on non-Unix systems.
10 #
11
12 use File::Spec;
13 use Fcntl;
14
15 $perl   = $ENV{'PERL'}   || 'perl';
16 $srcdir = $ENV{'srcdir'} || '.';
17
18 $versionfile = File::Spec->catfile(File::Spec->updir($srcdir), 'version');
19 $genps = File::Spec->catfile($srcdir, 'genps.pl');
20
21 sysopen(VERSION, $versionfile, O_RDONLY)
22     or die "$0: cannot open $versionfile\n";
23 $version = <VERSION>;
24 chomp $version;
25 close(VERSION);
26
27 # \240 = no-break space, see @NASMEncoding in genps.pl.
28 # If we use a normal space, it breaks on 'doze platforms...
29 system($perl, $genps, '-subtitle', "version\240".$version,
30        @ARGV, 'nasmdoc.dip');