2 # Generate make dependency rules for asn1 files
3 # Jelmer Vernooij <jelmer@samba.org> 2005
4 # Andrew Bartlett <abartlet@samba.org> 2006-2009
5 # Stefan Metzmacher <metze@samba.org> 2007
13 my $options = join(' ', @ARGV);
19 $basename = basename
($file);
20 if (not defined $options) {
24 my $header = "$dirname/$prefix.h";
25 my $headerx = "$dirname/$prefix.hx";
26 my $headerpriv = "$dirname/$prefix-priv.h";
27 my $headerprivx = "$dirname/$prefix-priv.hx";
28 my $o_file = "$dirname/asn1_$prefix.o";
29 my $c_file = "$dirname/asn1_$prefix.c";
30 my $x_file = "$dirname/asn1_$prefix.x";
31 my $output_file = "$dirname/" . $prefix . "_asn1_files";
33 print "basics:: $header\n";
34 print "$output_file: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
35 print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
36 print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(call abspath,\$(heimdalsrcdir)/$file) $prefix $options --one-code-file && touch $output_file\n";
37 print "$headerx: $output_file\n";
38 print "$header: $headerx\n";
39 print "\t\@cp $headerx $header\n";
40 print "$headerpriv: $headerprivx\n";
41 print "\t\@cp $headerprivx $headerpriv\n";
42 print "$x_file: $header $headerpriv\n";
43 print "$c_file: $x_file\n";
44 print "\t\@echo \"#include \\\"config.h\\\"\" > $c_file && cat $x_file >> $c_file\n\n";
46 open(IN
,"heimdal/$file") or die("Can't open heimdal/$file: $!");
49 foreach my $line (@lines) {
50 if ($line =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/) {
53 push @imports, $import;
55 } elsif ($line =~ /^(\s*IMPORT).*/) {
58 } elsif (defined($import) and ($line =~ /;/)) {
61 push @imports, $import;
63 } elsif (defined($import)) {
69 foreach $import (@imports) {
70 next unless ($import =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/);
72 my @froms = split (/\s+FROM\s+/, $import);
73 foreach my $from (@froms) {
74 next if ($from =~ /^(\s*IMPORT).*/);
75 if ($from =~ /^(\w+)/) {
77 $dep = 'HEIMDAL_'.uc($f).'_ASN1';
83 unshift @deps, "HEIMDAL_HEIM_ASN1" unless grep /HEIMDAL_HEIM_ASN1/, @deps;
84 my $depstr = join(' ', @deps);
86 print '[SUBSYSTEM::HEIMDAL_'.uc($prefix).']'."\n";
87 print "CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -I$dirname\n";
88 print "PUBLIC_DEPENDENCIES = $depstr\n\n";
90 print "HEIMDAL_".uc($prefix)."_OBJ_FILES = ";
91 print "\\\n\t$o_file";
96 print "\t\@echo \"Deleting ASN1 output files generated from $file\"\n";
97 print "\t\@rm -f $output_file\n";
98 print "\t\@rm -f $header\n";
99 print "\t\@rm -f $c_file\n";
100 print "\t\@rm -f $x_file\n";
101 print "\t\@rm -f $dirname/$prefix\_files\n";
102 print "\t\@rm -f $dirname/$prefix\.h\n";