2 # Generate make dependency rules for asn1 files
3 # Jelmer Vernooij <jelmer@samba.org> 2005
11 my $options = join(' ', @ARGV);
19 $basename = basename($file);
20 if (not defined $options) {
24 my $header = "$dirname/$prefix.h";
26 print "$header: $file bin/asn1_compile\n";
27 print "\t\@echo \"Compiling ASN1 file $file\"\n";
28 print "\t\@startdir=`pwd` && cd $dirname && " . ' $$startdir/bin/asn1_compile ' . " $options " . '$$startdir/' . "$file $prefix\n\n";
30 open(IN,$file) or die("Can't open $file: $!");
32 if (/^([\w]+[\w\-]+)(\s+OBJECT IDENTIFIER)?\s*::=/) {
35 $c_file = "$dirname/asn1_$output.c";
36 $x_file = "$dirname/asn1_$output.x";
37 $o_file = "$dirname/asn1_$output.o";
38 print "$x_file: $header\n";
39 print "$c_file: $dirname/asn1_$output.x\n";
40 print "\t\@cp $x_file $c_file\n\n";
41 push @x_files, $x_file;
42 push @c_files, $c_file;
43 push @o_files, $o_file;
48 print '[SUBSYSTEM::HEIMDAL_'.uc($prefix).']'."\n";
49 print "CFLAGS = -Iheimdal_build -I$dirname\n";
51 foreach $o_file (@o_files) {
52 print "\\\n\t$o_file ";
54 print "\nPRIVATE_DEPENDENCIES = HEIMDAL_ASN1\n\n";
57 print "\t\@echo \"Deleting ASN1 output files generated from $file\"";
58 print "\n\t\@rm -f $header";
59 foreach $c_file (@c_files) {
60 print "\n\t\@rm -f $c_file";
62 foreach $x_file (@x_files) {
63 print "\n\t\@rm -f $x_file";
65 print "\n\t\@rm -f $dirname/$prefix\_files";
66 print "\n\t\@rm -f $dirname/$prefix\.h";