summaryrefslogtreecommitdiff
path: root/source4/heimdal_build/asn1_deps.pl
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-09-12 17:20:32 -0700
committerAndrew Bartlett <abartlet@samba.org>2009-09-13 20:52:51 -0700
commitfde8c46855350111e94f1da7afc6c440ab746d8b (patch)
tree644fba3a6bbef1c81b5be68a25669ae6cf2e1c00 /source4/heimdal_build/asn1_deps.pl
parentab09fcf1da51451b666f962a418051581fb4e78e (diff)
downloadsamba-fde8c46855350111e94f1da7afc6c440ab746d8b.tar.gz
samba-fde8c46855350111e94f1da7afc6c440ab746d8b.tar.bz2
samba-fde8c46855350111e94f1da7afc6c440ab746d8b.zip
s4:heimdal_build Love pointed me at the --one-code-file option to asn1_compile
This new option avoids a lot of code that was used to intuit what files would be output by the compiler. Andrew Bartlett
Diffstat (limited to 'source4/heimdal_build/asn1_deps.pl')
-rwxr-xr-xsource4/heimdal_build/asn1_deps.pl49
1 files changed, 17 insertions, 32 deletions
diff --git a/source4/heimdal_build/asn1_deps.pl b/source4/heimdal_build/asn1_deps.pl
index 9da0787012..3b187558d1 100755
--- a/source4/heimdal_build/asn1_deps.pl
+++ b/source4/heimdal_build/asn1_deps.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# Generate make dependency rules for asn1 files
# Jelmer Vernooij <jelmer@samba.org> 2005
-# Andrew Bartlett <abartlet@samba.org> 2006
+# Andrew Bartlett <abartlet@samba.org> 2006-2009
# Stefan Metzmacher <metze@samba.org> 2007
# GPL
@@ -11,12 +11,6 @@ my $file = shift;
my $prefix = shift;
my $dirname = shift;
my $options = join(' ', @ARGV);
-my $x_file;
-my @x_files = ();
-my $c_file;
-my @c_files = ();
-my $o_file;
-my @o_files = ();
my $import;
my @imports = ();
my $dep;
@@ -29,31 +23,27 @@ if (not defined $options) {
my $header = "$dirname/$prefix.h";
my $headerx = "$dirname/$prefix.hx";
+my $o_file = "$dirname/asn1_$prefix.o";
+my $c_file = "$dirname/asn1_$prefix.c";
+my $x_file = "$dirname/asn1_$prefix.x";
+my $output_file = "$dirname/" . $prefix . "_asn1_files";
print "basics:: $header\n";
+print "$output_file: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
+print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
+print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(call abspath,\$(heimdalsrcdir)/$file) $prefix $options --one-code-file\n\n";
+print "$headerx: $output_file\n";
print "$header: $headerx\n";
print "\t\@cp $headerx $header\n";
-print "$headerx: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
-print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
-print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(call abspath,\$(heimdalsrcdir)/$file) $prefix $options\n\n";
+print "$x_file: $output_file\n";
+print "$c_file: $x_file\n";
+print "\t\@echo \"#include \\\"config.h\\\"\" > $c_file && cat $x_file >> $c_file\n\n";
open(IN,"heimdal/$file") or die("Can't open heimdal/$file: $!");
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";
- $x_file = "$dirname/asn1_$output.x";
- $o_file = "$dirname/asn1_$output.o";
- print "$x_file: $header\n";
- print "$c_file: $dirname/asn1_$output.x\n";
- print "\t\@echo \"#include \\\"config.h\\\"\" > $c_file && cat $x_file >> $c_file\n\n";
- 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\-]+);/) {
+ if ($line =~ /^(\s*IMPORT)([\w\,\s])*(\s+FROM\s+)([\w]+[\w\-]+);/) {
$import = $line;
chomp $import;
push @imports, $import;
@@ -94,21 +84,16 @@ print "CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -I$dirname\n";
print "PUBLIC_DEPENDENCIES = $depstr\n\n";
print "HEIMDAL_".uc($prefix)."_OBJ_FILES = ";
-foreach $o_file (@o_files) {
- print "\\\n\t$o_file";
-}
+print "\\\n\t$o_file";
print "\n\n";
print "clean:: \n";
print "\t\@echo \"Deleting ASN1 output files generated from $file\"\n";
+print "\t\@rm -f $output_file\n";
print "\t\@rm -f $header\n";
-foreach $c_file (@c_files) {
- print "\t\@rm -f $c_file\n";
-}
-foreach $x_file (@x_files) {
- print "\t\@rm -f $x_file\n";
-}
+print "\t\@rm -f $c_file\n";
+print "\t\@rm -f $x_file\n";
print "\t\@rm -f $dirname/$prefix\_files\n";
print "\t\@rm -f $dirname/$prefix\.h\n";
print "\n";