OLD | NEW |
1 #!/usr/local/bin/perl -w | 1 #!/usr/local/bin/perl -w |
2 # Clean the dependency list in a makefile of standard includes... | 2 # Clean the dependency list in a makefile of standard includes... |
3 # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | 3 # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 |
4 | 4 |
5 use strict; | 5 use strict; |
6 | 6 |
7 while(<STDIN>) { | 7 while(<STDIN>) { |
8 print; | 8 print; |
9 last if /^# DO NOT DELETE THIS LINE/; | 9 last if /^# DO NOT DELETE THIS LINE/; |
10 } | 10 } |
(...skipping 24 matching lines...) Expand all Loading... |
35 my $origfile=$file; | 35 my $origfile=$file; |
36 $origfile=~s/\.o$/.c/; | 36 $origfile=~s/\.o$/.c/; |
37 $file=~s/^\.\///; | 37 $file=~s/^\.\///; |
38 push @{$files{$file}},$origfile; | 38 push @{$files{$file}},$origfile; |
39 my $prevdep=""; | 39 my $prevdep=""; |
40 | 40 |
41 # Remove leading ./ before sorting | 41 # Remove leading ./ before sorting |
42 my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; | 42 my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; |
43 | 43 |
44 foreach $dep (sort @deps) { | 44 foreach $dep (sort @deps) { |
| 45 $dep=~s/^\.\///; |
45 next if $prevdep eq $dep; # to exterminate duplicates... | 46 next if $prevdep eq $dep; # to exterminate duplicates... |
46 $prevdep = $dep; | 47 $prevdep = $dep; |
47 $len=0 if $len+length($dep)+1 >= 80; | 48 $len=0 if $len+length($dep)+1 >= 80; |
48 if($len == 0) { | 49 if($len == 0) { |
49 print "\n$file:"; | 50 print "\n$file:"; |
50 $len=length($file)+1; | 51 $len=length($file)+1; |
51 } | 52 } |
52 print " $dep"; | 53 print " $dep"; |
53 $len+=length($dep)+1; | 54 $len+=length($dep)+1; |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 print "\n"; | 58 print "\n"; |
OLD | NEW |