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
Andrew Bartlett eda59a6ca0 r9217: Add 'make clean' hooks to the ans1 depedency generator.
To be used by the impending Heimdal resync, which has files starting
with asn1_ that are not generated.

Andrew Bartlett
(This used to be commit 15b7af1c39)
2007-10-10 13:31:32 -05:00

48 lines
1.2 KiB
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;
my $x_file, @x_files;
my $c_file, @c_files;
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;
$c_file = "$dirname/asn1_$output.c";
$x_file = "$dirname/asn1_$output.x";
print "$x_file: $header\n";
print "$c_file: $dirname/asn1_$output.x\n";
print "\t\@cp $x_file $c_file\n\n";
push @x_files, $x_file;
push @c_files, $c_file;
}
}
close(IN);
print $prefix."_clean: \n";
print "\t\@echo \"Deleting ASN1 ouput files generated from $file\"";
print "\n\t\@rm -f $header";
foreach $c_file (@c_files) {
print "\n\t\@rm -f $c_file";
}
foreach $x_file (@x_files) {
print "\n\t\@rm -f $x_file";
}
print "\n\n";