+foreach $aux (sort keys %auxfiles) {
+ open AUX, ">$aux";
+ print AUX $auxfiles{$aux};
+ close AUX;
+}
+
+# Find object file names with predefines (in square brackets after
+# the module name), and decide on actual object names for them.
+foreach $i (@allobjs) {
+ if ($i !~ /\[/) {
+ $objname{$i} = $i;
+ $srcname{$i} = $i;
+ $usedobjname{$i} = 1;
+ }
+}
+foreach $i (@allobjs) {
+ if ($i =~ /^(.*)\[([^\]]*)/) {
+ $defs{$i} = [ split ",",$2 ];
+ $srcname{$i} = $s = $1;
+ $index = 1;
+ while (1) {
+ $maxlen = length $s;
+ $maxlen = 8 if $maxlen < 8;
+ $chop = $maxlen - length $index;
+ $chop = length $s if $chop > length $s;
+ $chop = 0 if $chop < 0;
+ $name = substr($s, 0, $chop) . $index;
+ $index++, next if $usedobjname{$name};
+ $objname{$i} = $name;
+ $usedobjname{$name} = 1;
+ last;
+ }
+ }
+}