r9025: fix the build when it was stoped and you don't run make clean before make all
[samba.git] / source / heimdal_build / asn1_deps.pl
1 #!/usr/bin/perl
2 # Generate make dependency rules for asn1 files
3 # Jelmer Vernooij <jelmer@samba.org> 2005
4 # GPL
5
6 use File::Basename;
7
8 my $file = shift;
9 my $prefix = shift;
10
11 if (not defined ($prefix)) { $prefix = "asn1"; }
12
13 $dirname = dirname($file);
14 $basename = basename($file);
15
16 my $header = "$dirname/$prefix.h";
17
18 print "$header: $file bin/asn1_compile\n";
19 print "\t\@echo \"Compiling ASN1 file $file\"\n";
20 print "\t\@cd $dirname && ../../../bin/asn1_compile $basename $prefix\n\n";
21
22 open(IN,$file) or die("Can't open $file: $!");
23 foreach(<IN>) {
24         if (/^([A-Za-z0-9_-]+)[ \t]*::= /) {
25                 my $output = $1;
26                 $output =~ s/-/_/g;
27                 print "$dirname/asn1_$output.x: $header\n";
28                 print "$dirname/asn1_$output.c: $dirname/asn1_$output.x\n";
29                 print "\t\@cp $dirname/asn1_$output.x $dirname/asn1_$output.c\n\n";
30         }
31 }
32 close(IN);