summaryrefslogtreecommitdiff
path: root/source4/heimdal_build/asn1_deps.pl
blob: 4cff3e2fae41a1d67b91cbfdfc87beb658e31498 (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
26
27
28
29
30
31
#!/usr/bin/perl
# Generate make dependency rules for asn1 files
# Jelmer Vernooij <jelmer@samba.org> 2005
# GPL

use File::Basename;

my $file = shift;
my $prefix = shift;

if (not defined ($prefix)) { $prefix = "asn1"; }

$dirname = dirname($file);
$basename = basename($file);

my $header = "$dirname/$prefix.h";

print "$header: $file bin/asn1_compile\n";
print "\t\@echo \"Compiling ASN1 file $file\"\n";
print "\t\@cd $dirname && ../../../bin/asn1_compile $basename $prefix\n\n";

open(IN,$file) or die("Can't open $file: $!");
foreach(<IN>) {
	if (/^([A-Za-z0-9_-]+)[ \t]*::= /) {
		my $output = $1;
		$output =~ s/-/_/g;
		print "$dirname/asn1_$output.c: $header\n";
		print "\t\@mv $dirname/asn1_$output.x $dirname/asn1_$output.c\n\n";
	}
}
close(IN);