s3: Remove header==NULL code from db_ctdb_marshall_record
[kai/samba.git] / source3 / script / expand-includes.pl
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);