root/juggler/branches/2.0_alpha_4/Doozer++/scripts/genmkinfo.pl

Revision 14688, 2.4 kB (checked in by patrickh, 5 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/perl
2
3 # ************** <auto-copyright.pl BEGIN do not edit this line> **************
4 #
5 # Doozer++ is (C) Copyright 2000-2004 by Iowa State University
6 #
7 # Original Author:
8 #   Patrick Hartling
9 #
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Library General Public
12 # License as published by the Free Software Foundation; either
13 # version 2 of the License, or (at your option) any later version.
14 #
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 # Library General Public License for more details.
19 #
20 # You should have received a copy of the GNU Library General Public
21 # License along with this library; if not, write to the
22 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 # Boston, MA 02111-1307, USA.
24 #
25 # *************** <auto-copyright.pl END do not edit this line> ***************
26
27 # genmkinfo.pl,v 1.3 2004/01/29 04:27:50 patrickh Exp
28
29 require 5.004;
30
31 use strict 'vars';
32
33 use Text::Wrap;
34
35 die "ERROR: No files given\n" unless $#ARGV > -1;
36
37 $Text::Wrap::columns = 75;
38
39 my @TARGETS = ();
40 my %INFO    = ();
41
42 my $makefile;
43 foreach $makefile ( @ARGV )
44 {
45    if ( open(INPUT, "$makefile") )
46    {
47       my $contents;
48
49       my $in_info_block = 0;
50       my $cur_target    = '';
51
52       while ( <INPUT> )
53       {
54          chomp;
55
56          if ( /#\s+__DZR_INFO_BEGIN__/ )
57          {
58             $in_info_block = 1;
59             $cur_target    = '';
60             next;
61          }
62          elsif ( /#\s+__DZR_INFO_END__/ )
63          {
64             $in_info_block = 0;
65             $cur_target    = '';
66             next;
67          }
68
69          if ( $in_info_block )
70          {
71             if ( /#\s*T<(\S+)>\s+/ )
72             {
73                $cur_target          = "$1";
74                $INFO{"$cur_target"} = $';
75                $INFO{"$cur_target"} =~ s/\s+$//;  # Strip trailing whitespace
76                push(@TARGETS, "$cur_target");
77             }
78             elsif ( "$cur_target" ne "" && /#\s*(\S.*)\s*$/ )
79             {
80                $INFO{"$cur_target"} .= " $1";
81             }
82          }
83       }
84
85       close(INPUT);
86    }
87    else
88    {
89       warn "WARNING: Could not read from $makefile: $!\n";
90    }
91 }
92
93 foreach ( @TARGETS )
94 {
95    print "$_:\n";
96    print wrap("    ", "    ", $INFO{"$_"}), "\n";
97 }
98
99 exit(0);
100
Note: See TracBrowser for help on using the browser.