2
# Generate make dependency rules for asn1 files
3
# Jelmer Vernooij <jelmer@samba.org> 2005
4
# Andrew Bartlett <abartlet@samba.org> 2006
5
# Stefan Metzmacher <metze@samba.org> 2007
13
my $options = join(' ', @ARGV);
25
$basename = basename($file);
26
if (not defined $options) {
30
my $header = "$dirname/$prefix.h";
32
print "basics:: $header\n";
33
print "$header: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
34
print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
35
print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(call abspath,\$(heimdalsrcdir)/$file) $prefix $options\n\n";
37
open(IN,"heimdal/$file") or die("Can't open heimdal/$file: $!");
40
foreach my $line (@lines) {
41
if ($line =~ /^([\w]+[\w\-]+)(\s+OBJECT IDENTIFIER)?\s*::=/) {
44
$c_file = "$dirname/asn1_$output.c";
45
$x_file = "$dirname/asn1_$output.x";
46
$o_file = "$dirname/asn1_$output.o";
47
print "$x_file: $header\n";
48
print "$c_file: $dirname/asn1_$output.x\n";
49
print "\t\@echo \"#include \\\"config.h\\\"\" > $c_file && cat $x_file >> $c_file\n\n";
50
push @x_files, $x_file;
51
push @c_files, $c_file;
52
push @o_files, $o_file;
53
} elsif ($line =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/) {
56
push @imports, $import;
58
} elsif ($line =~ /^(\s*IMPORT).*/) {
61
} elsif (defined($import) and ($line =~ /;/)) {
64
push @imports, $import;
66
} elsif (defined($import)) {
72
foreach $import (@imports) {
73
next unless ($import =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/);
75
my @froms = split (/\s+FROM\s+/, $import);
76
foreach my $from (@froms) {
77
next if ($from =~ /^(\s*IMPORT).*/);
78
if ($from =~ /^(\w+)/) {
80
$dep = 'HEIMDAL_'.uc($f).'_ASN1';
86
unshift @deps, "HEIMDAL_HEIM_ASN1" unless grep /HEIMDAL_HEIM_ASN1/, @deps;
87
my $depstr = join(' ', @deps);
89
print '[SUBSYSTEM::HEIMDAL_'.uc($prefix).']'."\n";
90
print "CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -I$dirname\n";
91
print "PUBLIC_DEPENDENCIES = $depstr\n\n";
93
print "HEIMDAL_".uc($prefix)."_OBJ_FILES = ";
94
foreach $o_file (@o_files) {
95
print "\\\n\t$o_file";
101
print "\t\@echo \"Deleting ASN1 output files generated from $file\"\n";
102
print "\t\@rm -f $header\n";
103
foreach $c_file (@c_files) {
104
print "\t\@rm -f $c_file\n";
106
foreach $x_file (@x_files) {
107
print "\t\@rm -f $x_file\n";
109
print "\t\@rm -f $dirname/$prefix\_files\n";
110
print "\t\@rm -f $dirname/$prefix\.h\n";