1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/source4/heimdal_build/asn1_deps.pl
2007-10-10 13:31:08 -05:00

33 lines
822 B
Perl
Executable File

#!/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.x: $header\n";
print "$dirname/asn1_$output.c: $dirname/asn1_$output.x\n";
print "\t\@cp $dirname/asn1_$output.x $dirname/asn1_$output.c\n\n";
}
}
close(IN);