r22454: - let asn1_deps.pl calculate the dependencies depending on the IMPORT line...
authorStefan Metzmacher <metze@samba.org>
Sun, 22 Apr 2007 11:28:12 +0000 (11:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:51:22 +0000 (14:51 -0500)
- fix some heimdal dependencies

metze

source/heimdal_build/asn1_deps.pl
source/heimdal_build/config.mk

index b45a90d41694b9857c510a2280fbe49934c62318..fe9791c0d7ef0ff49fa0135d85b1386f66e303ee 100755 (executable)
@@ -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";
index 49d269e09d4d307d2b942f676bd30db1203eab23..39722d8cf2bfa93071206c6ab6efeb04c8299d81 100644 (file)
@@ -17,7 +17,8 @@ OBJ_FILES = \
        ../heimdal/kdc/windc.o \
        ../heimdal/kdc/kx509.o \
        ../heimdal/lib/asn1/asn1_KRB5SignedPath.o
-PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5 HEIMDAL_HDB HEIMDAL_ASN1 HEIMDAL_DES HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1 HEIMDAL_NTLM
+PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5 HEIMDAL_HDB HEIMDAL_HEIM_ASN1 HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1
+PUBLIC_DEPENDENCIES = HEIMDAL_NTLM HEIMDAL_DES
 # End SUBSYSTEM HEIMDAL_KDC
 #######################
 
@@ -47,14 +48,14 @@ OBJ_FILES = \
        ../heimdal/lib/hdb/mkey.o \
        ../heimdal/lib/hdb/ndbm.o \
        ../heimdal/lib/hdb/hdb_err.o
-PRIVATE_DEPENDENCIES = HDB_LDB HEIMDAL_HDB_KEYS HEIMDAL_ROKEN HEIMDAL_HDB_ASN1
+PRIVATE_DEPENDENCIES = HDB_LDB HEIMDAL_KRB5 HEIMDAL_HDB_KEYS HEIMDAL_ROKEN HEIMDAL_DES HEIMDAL_COM_ERR HEIMDAL_HDB_ASN1
 # End SUBSYSTEM HEIMDAL_HDB
 #######################
 
 #######################
 # Start SUBSYSTEM HEIMDAL_GSSAPI
 [SUBSYSTEM::HEIMDAL_GSSAPI]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/gssapi/gssapi -Iheimdal/lib/gssapi/spnego -Iheimdal/lib/gssapi/krb5 -Iheimdal/lib/gssapi/mech
+CFLAGS = -Iheimdal_build -Iheimdal/lib/gssapi -Iheimdal/lib/gssapi/gssapi -Iheimdal/lib/gssapi/spnego -Iheimdal/lib/gssapi/krb5 -Iheimdal/lib/gssapi/mech
 OBJ_FILES = \
        ../heimdal/lib/gssapi/mech/gss_krb5.o \
        ../heimdal/lib/gssapi/mech/gss_mech_switch.o \
@@ -163,7 +164,7 @@ OBJ_FILES = \
        ../heimdal/lib/gssapi/krb5/accept_sec_context.o \
        ../heimdal/lib/gssapi/krb5/set_sec_context_option.o \
        ../heimdal/lib/gssapi/krb5/process_context_token.o
-PRIVATE_DEPENDENCIES = HEIMDAL_DES HEIMDAL_ASN1 HEIMDAL_SPNEGO_ASN1
+PRIVATE_DEPENDENCIES = HEIMDAL_DES HEIMDAL_HEIM_ASN1 HEIMDAL_SPNEGO_ASN1
 PUBLIC_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5
 # End SUBSYSTEM HEIMDAL_GSSAPI
 #######################
@@ -172,8 +173,8 @@ PUBLIC_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5
 # Start SUBSYSTEM HEIMDAL_KRB5
 [SUBSYSTEM::HEIMDAL_KRB5]
 CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 
-PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_DES HEIMDAL_PKINIT_ASN1
-PUBLIC_DEPENDENCIES = HEIMDAL_KRB5_ASN1 HEIMDAL_GLUE HEIMDAL_HX509
+PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_PKINIT_ASN1
+PUBLIC_DEPENDENCIES = HEIMDAL_KRB5_ASN1 HEIMDAL_GLUE HEIMDAL_HX509 HEIMDAL_DES
 OBJ_FILES = \
        ../heimdal/lib/krb5/acache.o \
        ../heimdal/lib/krb5/add_et_list.o \
@@ -264,8 +265,8 @@ OBJ_FILES = \
 #######################
 
 #######################
-# Start SUBSYSTEM HEIMDAL_ASN1
-[SUBSYSTEM::HEIMDAL_ASN1]
+# Start SUBSYSTEM HEIMDAL_HEIM_ASN1
+[SUBSYSTEM::HEIMDAL_HEIM_ASN1]
 CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1
 OBJ_FILES = \
        ../heimdal/lib/asn1/der_get.o \
@@ -297,7 +298,7 @@ OBJ_FILES = \
 
 [SUBSYSTEM::HEIMDAL_DES]
 CFLAGS = -Iheimdal_build -Iheimdal/lib/des 
-PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_ASN1 HEIMDAL_DES_IMATH HEIMDAL_RFC2459_ASN1
+PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HEIM_ASN1 HEIMDAL_DES_IMATH HEIMDAL_RFC2459_ASN1
 OBJ_FILES = \
        ../heimdal/lib/des/aes.o \
        ../heimdal/lib/des/bn.o \
@@ -333,7 +334,7 @@ OBJ_FILES = \
 CFLAGS = -Iheimdal_build -Iheimdal/lib/hx509 
 PRIVATE_DEPENDENCIES = \
        HEIMDAL_ROKEN HEIMDAL_COM_ERR \
-       HEIMDAL_ASN1 HEIMDAL_DES \
+       HEIMDAL_HEIM_ASN1 HEIMDAL_DES \
        HEIMDAL_CMS_ASN1 HEIMDAL_RFC2459_ASN1 \
        HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 \
        HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1