summaryrefslogtreecommitdiff
path: root/source3/script/expand-includes.pl
blob: da643630810a2143fa42f106929b856e4904b822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
# Expand the include lines in a Makefile
# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPLv3 or later

sub process($)
{
	my ($f) = @_;
	open(IN, $f) or die("Unable to open $f: $!");
	foreach (<IN>) {
		my $l = $_;
		if ($l =~ /^include (.*)$/) {
			process($1);
		} else {
			print $l;
		}
	}
}

my $path = shift;
unless ($path) {
	print STDERR "Usage: $0 Makefile.in > Makefile-noincludes.in\n";
	exit(1);
}
process($path);