/[papo]/papo/neb/neb.pl
ViewVC logotype

Diff of /papo/neb/neb.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by jlenton, Wed Apr 30 21:24:42 2003 UTC revision 1.10 by jlenton, Wed Apr 30 22:27:58 2003 UTC
# Line 6  use English; Line 6  use English;
6  use Carp qw(cluck confess);  use Carp qw(cluck confess);
7  use Data::Dumper;  use Data::Dumper;
8  use Getopt::Long;  use Getopt::Long;
9    use neb::Misc qw'find_file';
10  use neb;  use neb;
11    
12  BEGIN { our $DEBUG = 0; }  BEGIN { our $DEBUG = 0; }
# Line 17  Options: Line 18  Options:
18    -E                    alias for --noexec --code    -E                    alias for --noexec --code
19    -M                    alias for --noexec --deps    -M                    alias for --noexec --deps
20    -MM                   alias for --noexec --deps --nosysdeps    -MM                   alias for --noexec --deps --nosysdeps
21      --output=file         use file for output (defaults to stdout)
22    --deps                output a rule suitable for make for the neb    --deps                output a rule suitable for make for the neb
23    --nosysdeps           don't include stuff that starts with /usr/ in --deps    --nosysdeps           don't include stuff that starts with /usr/ in --deps
24    --tree                dump the XML before nebulizing    --tree                dump the XML before nebulizing
# Line 36  my $tree = 0; Line 38  my $tree = 0;
38  my $code = 0;  my $code = 0;
39  my $deps = 0;  my $deps = 0;
40  my $sysdeps = 1;  my $sysdeps = 1;
41    my $fd;
42    my $old_fd;
43    my $output = '';
44  our $DEBUG = 0;  our $DEBUG = 0;
45    
46  our @SUBS = ();  our @SUBS = ();
# Line 45  GetOptions('exec!' => \$exec, Line 50  GetOptions('exec!' => \$exec,
50             'E' => sub { $exec = 0; $code = 1 },             'E' => sub { $exec = 0; $code = 1 },
51             'M' => sub { $exec = 0; $deps = 1 },             'M' => sub { $exec = 0; $deps = 1 },
52             'MM' => sub { $exec = 0; $deps = 1; $sysdeps = 0; },             'MM' => sub { $exec = 0; $deps = 1; $sysdeps = 0; },
53               'output=s' => \$output,
54             'tree' => \$tree,             'tree' => \$tree,
55             'sysdeps' => \$sysdeps,             'sysdeps' => \$sysdeps,
56             'deps' => \$deps,             'deps' => \$deps,
57             'code' => \$code,             'code' => \$code,
58             'debug+' => \$DEBUG,             'debug+' => \$DEBUG,
59             'include-path=s' => \$include_path             'include-path=s' => \$include_path
60            ) and @ARGV or die $usage;            ) or die $usage;
61    
62  $ENV{'NEB_PATH'} = $include_path if defined($include_path);  $ENV{'NEB_PATH'} = $include_path if defined($include_path);
63    
64  foreach my $file (@ARGV)  if ($output)
65  {  {
66      my $neb = neb->new($file);      $output = find_file($output);
67        open($fd, "> $output") || die($!);
68        $old_fd = select $fd;
69    }
70    
71    undef $INPUT_RECORD_SEPARATOR;
72    foreach (<>)
73    {
74        my $neb = neb->new;
75        $neb->root($ARGV);
76        $neb->parse($_);
77    
78        $output ||= $ARGV;
79    
80      if ($tree)      if ($tree)
81      {      {
# Line 93  foreach my $file (@ARGV) Line 111  foreach my $file (@ARGV)
111    
112          @h = grep !/^\/usr/, @h          @h = grep !/^\/usr/, @h
113              unless $sysdeps;              unless $sysdeps;
114            
115          print join(" \\\n", ("$file:", @SUBS, $0, @h)), "\n";          select $old_fd;
116            print join(" \\\n", ("$output:", @SUBS, $0, @h)), "\n";
117      }      }
118  }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26