summaryrefslogtreecommitdiff
path: root/source4/heimdal_build/asn1_deps.pl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-04-22 11:28:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:22 -0500
commit71761dbae81f741e35bb553dfe3149e926f80455 (patch)
tree13bec90bf1064c16c3e335fab79d3174ae01b9af /source4/heimdal_build/asn1_deps.pl
parent3b39a0df0aa941c88a872f24279584cd86558b6c (diff)
downloadsamba-71761dbae81f741e35bb553dfe3149e926f80455.tar.gz
samba-71761dbae81f741e35bb553dfe3149e926f80455.tar.bz2
samba-71761dbae81f741e35bb553dfe3149e926f80455.zip
r22454: - let asn1_deps.pl calculate the dependencies depending on the IMPORT line in the asn1 file
- fix some heimdal dependencies metze (This used to be commit 4e7d2ecfc0f37de8c66d0ad93f07d00c992b4642)
Diffstat (limited to 'source4/heimdal_build/asn1_deps.pl')
-rwxr-xr-xsource4/heimdal_build/asn1_deps.pl47
1 files changed, 43 insertions, 4 deletions
diff --git a/source4/heimdal_build/asn1_deps.pl b/source4/heimdal_build/asn1_deps.pl
index b45a90d416..fe9791c0d7 100755
--- a/source4/heimdal_build/asn1_deps.pl
+++ b/source4/heimdal_build/asn1_deps.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl
# Generate make dependency rules for asn1 files
# Jelmer Vernooij <jelmer@samba.org> 2005
+# Stefan Metzmacher <metze@samba.org> 2007
# GPL
use File::Basename;
@@ -15,6 +16,10 @@ my $c_file;
my @c_files = ();
my $o_file;
my @o_files = ();
+my $import;
+my @imports = ();
+my $dep;
+my @deps = ();
$basename = basename($file);
if (not defined $options) {
@@ -28,8 +33,10 @@ print "\t\@echo \"Compiling ASN1 file $file\"\n";
print "\t\@\$(builddir)/heimdal_build/asn1_compile_wrapper.sh \$(srcdir) \$(builddir) $dirname bin/asn1_compile $file $prefix $options\n\n";
open(IN,$file) or die("Can't open $file: $!");
-foreach(<IN>) {
- if (/^([\w]+[\w\-]+)(\s+OBJECT IDENTIFIER)?\s*::=/) {
+my @lines = <IN>;
+close(IN);
+foreach my $line (@lines) {
+ if ($line =~ /^([\w]+[\w\-]+)(\s+OBJECT IDENTIFIER)?\s*::=/) {
my $output = $1;
$output =~ s/-/_/g;
$c_file = "$dirname/asn1_$output.c";
@@ -41,9 +48,41 @@ foreach(<IN>) {
push @x_files, $x_file;
push @c_files, $c_file;
push @o_files, $o_file;
+ } elsif ($line =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/) {
+ $import = $line;
+ chomp $import;
+ push @imports, $import;
+ $import = undef;
+ } elsif ($line =~ /^(\s*IMPORT).*/) {
+ $import = $line;
+ chomp $import;
+ } elsif (defined($import) and ($line =~ /;/)) {
+ $import .= $line;
+ chomp $import;
+ push @imports, $import;
+ $import = undef;
+ } elsif (defined($import)) {
+ $import .= $line;
+ chomp $import;
}
}
-close(IN);
+
+foreach $import (@imports) {
+ next unless ($import =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/);
+
+ my @froms = split (/\s+FROM\s+/, $import);
+ foreach my $from (@froms) {
+ next if ($from =~ /^(\s*IMPORT).*/);
+ if ($from =~ /^(\w+)/) {
+ my $f = $1;
+ $dep = 'HEIMDAL_'.uc($f).'_ASN1';
+ push @deps, $dep;
+ }
+ }
+}
+
+unshift @deps, "HEIMDAL_HEIM_ASN1" unless grep /HEIMDAL_HEIM_ASN1/, @deps;
+my $depstr = join(' ', @deps);
print '[SUBSYSTEM::HEIMDAL_'.uc($prefix).']'."\n";
print "CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -I$dirname\n";
@@ -51,7 +90,7 @@ print "OBJ_FILES = ";
foreach $o_file (@o_files) {
print "\\\n\t$o_file";
}
-print "\nPRIVATE_DEPENDENCIES = HEIMDAL_ASN1\n\n";
+print "\nPUBLIC_DEPENDENCIES = $depstr\n\n";
print "clean:: \n";
print "\t\@echo \"Deleting ASN1 output files generated from $file\"\n";