| Last change
 on this file since 622 was             414, checked in by Herwig Bauernfeind, 16 years ago | 
        
          | 
Samba 3.5.0: Initial import
 | 
        
          | File size:
            559 bytes | 
      
      
| Line |  | 
|---|
| 1 | #!/usr/bin/perl | 
|---|
| 2 | # Expand the include lines in a Makefile | 
|---|
| 3 | # Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org> | 
|---|
| 4 | # Published under the GNU GPLv3 or later | 
|---|
| 5 |  | 
|---|
| 6 | my $depth = 0; | 
|---|
| 7 |  | 
|---|
| 8 | sub process($) | 
|---|
| 9 | { | 
|---|
| 10 | my ($f) = @_; | 
|---|
| 11 | $depth++; | 
|---|
| 12 | die("Recursion in $f?") if ($depth > 100); | 
|---|
| 13 | open(IN, $f) or die("Unable to open $f: $!"); | 
|---|
| 14 | foreach (<IN>) { | 
|---|
| 15 | my $l = $_; | 
|---|
| 16 | if ($l =~ /^include (.*)$/) { | 
|---|
| 17 | process($1); | 
|---|
| 18 | } else { | 
|---|
| 19 | print $l; | 
|---|
| 20 | } | 
|---|
| 21 | } | 
|---|
| 22 | $depth--; | 
|---|
| 23 | } | 
|---|
| 24 |  | 
|---|
| 25 | my $path = shift; | 
|---|
| 26 | unless ($path) { | 
|---|
| 27 | print STDERR "Usage: $0 Makefile.in > Makefile-noincludes.in\n"; | 
|---|
| 28 | exit(1); | 
|---|
| 29 | } | 
|---|
| 30 | process($path); | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.