merge from gcc
[deliverable/binutils-gdb.git] / libiberty / maint-tool
1 #!/usr/bin/perl
2 # -*- perl -*-
3
4 # Copyright (C) 2001
5 # Free Software Foundation
6 #
7 # This file is part of the libiberty library.
8 # Libiberty is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either
11 # version 2 of the License, or (at your option) any later version.
12 #
13 # Libiberty is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Library General Public License for more details.
17 #
18 # You should have received a copy of the GNU Library General Public
19 # License along with libiberty; see the file COPYING.LIB. If not,
20 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA.
22 #
23 # Originally written by DJ Delorie <dj@redhat.com>
24
25
26 # This is a trivial script which checks the lists of C and O files in
27 # the Makefile for consistency.
28
29 $mode = shift;
30 $srcdir = ".";
31
32 if ($mode eq "-s") {
33 $srcdir = shift;
34 $mode = shift;
35 }
36
37 &missing() if $mode eq "missing";
38
39 exit 0;
40
41 ######################################################################
42
43 sub missing {
44
45 opendir(S, $srcdir);
46 while ($f = readdir S) {
47 $have{$f} = 1;
48 }
49 closedir(S);
50 opendir(S, ".");
51 while ($f = readdir S) {
52 $have{$f} = 1;
53 }
54 closedir(S);
55
56 for $a (@ARGV) {
57 $listed{$a} = 1;
58 $have{$a} = 0;
59 }
60
61 for $f (sort keys %have) {
62 next unless $have{$f};
63 if ($f =~ /\.c$/) {
64 print "S $f\n";
65 }
66 }
67 for $f (sort keys %listed) {
68 if ($f =~ /(.*)\.c$/) {
69 $base = $1;
70 if (! $listed{"$base.o"}) {
71 print "O $f\n";
72 }
73 }
74 }
75 }
This page took 0.040609 seconds and 5 git commands to generate.